FIX: do not create new email token if there already exists a confirmed one
This commit is contained in:
parent
195982fd41
commit
4e49b3b140
|
@ -115,7 +115,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
if @auth_result.email_valid && @auth_result.email == user.email
|
||||
user.update!(staged: false)
|
||||
# ensure there is an active email token
|
||||
user.email_tokens.create(email: user.email) unless user.email_tokens.active.where(email: user.email).exists?
|
||||
user.email_tokens.create(email: user.email) unless EmailToken.where(email: user.email, confirmed: true).present? || user.email_tokens.active.where(email: user.email).exists?
|
||||
user.activate
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue