SECURITY: signup without verified email using Google auth

This commit is contained in:
Neil Lalonde
2017-10-16 13:51:35 -04:00
parent 80d0c6df7c
commit 2db66072d7
5 changed files with 46 additions and 4 deletions

View File

@@ -351,6 +351,11 @@ class UsersController < ApplicationController
authentication.start
if authentication.email_valid? && !authentication.authenticated?
# posted email is different that the already validated one?
return fail_with('login.incorrect_username_email_or_password')
end
activation = UserActivator.new(user, request, session, cookies)
activation.start

View File

@@ -25,12 +25,16 @@ class UserAuthenticator
@session = nil
end
private
def email_valid?
@session && @session[:email_valid]
end
def authenticated?
@session && @session[:email] == @user.email && @session[:email_valid]
end
private
def authenticator
if authenticator_name
@authenticator ||= @authenticator_finder.find_authenticator(authenticator_name)