FIX: activate user even if email token is already confirmed

This commit is contained in:
Arpit Jalan
2018-02-14 20:22:05 +05:30
parent 8ae2c4555a
commit f07b1a5c05
2 changed files with 19 additions and 1 deletions

View File

@ -743,7 +743,8 @@ class User < ActiveRecord::Base
def activate
if email_token = self.email_tokens.active.where(email: self.email).first
EmailToken.confirm(email_token.token)
user = EmailToken.confirm(email_token.token)
self.update!(active: true) if user.nil?
else
self.update!(active: true)
end