Skip to content

Commit

Permalink
[CL-3870] Check if Hoplr email was confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-cit committed Oct 19, 2023
1 parent 7294268 commit 992d005
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion back/app/controllers/omniauth_callback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def update_user!(auth, user, authver_method)
attrs = authver_method.updateable_user_attrs
update_hash = authver_method.profile_to_user_attrs(auth).slice(*attrs).compact
update_hash.delete(:remote_avatar_url) if user.avatar.present? # don't overwrite avatar if already present
user.confirm! # confirm user email if not already confirmed
# confirm user email if not already confirmed
user.confirm! if authver_method.email_confirmed?(auth)

if authver_method.overwrite_user_attrs?
user.update_merging_custom_fields!(update_hash)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@ def issuer
def updateable_user_attrs
%i[first_name last_name]
end

def email_confirmed?(auth)
auth.info.email_verified
end
end
end
4 changes: 4 additions & 0 deletions back/lib/omniauth_methods/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def email_always_present?
true
end

def email_confirmed?(_auth)
true
end

def verification_prioritized?
raise NotImplementedError
end
Expand Down

0 comments on commit 992d005

Please sign in to comment.