Added new security question to sign up, Added notification for unconfirmed emails

• Added:
- new security question to sign up
- notification for unconfirmed emails
- modal for describing issue with Gab emails
This commit is contained in:
mgabdev
2020-10-16 16:25:37 -05:00
parent 9c0fc47777
commit 3c07e9d63b
16 changed files with 147 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
layout :determine_layout
before_action :set_invite, only: [:new, :create]
before_action :set_challenge, only: [:new]
before_action :check_enabled_registrations, only: [:new, :create]
before_action :configure_sign_up_params, only: [:create]
before_action :set_sessions, only: [:edit, :update]
@@ -15,6 +16,16 @@ class Auth::RegistrationsController < Devise::RegistrationsController
super(&:build_invite_request)
end
def create
if session[:challenge_answer].to_s == params[:user][:challenge].to_s.strip
# Reset after, may be errors to return and this ensures its still visible
set_challenge
super
else
return false
end
end
def destroy
not_found
end
@@ -96,6 +107,12 @@ class Auth::RegistrationsController < Devise::RegistrationsController
@invite = invite&.valid_for_use? ? invite : nil
end
def set_challenge
@challenge_add_1 = rand(0...9)
@challenge_add_2 = rand(0...9)
session[:challenge_answer] = @challenge_add_1 + @challenge_add_2
end
def determine_layout
%w(edit update).include?(action_name) ? 'admin' : 'auth'
end