refactors lock tries [#279]
This commit is contained in:
@@ -2,7 +2,7 @@ class Verification::LetterController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_resident!
|
||||
before_action :verify_phone!
|
||||
before_action :verify_attemps_left!
|
||||
before_action :verify_lock
|
||||
skip_authorization_check
|
||||
|
||||
def new
|
||||
@@ -29,7 +29,7 @@ class Verification::LetterController < ApplicationController
|
||||
current_user.update(verified_at: Time.now)
|
||||
redirect_to account_path, notice: t('verification.letter.update.flash.success')
|
||||
else
|
||||
@letter.increase_letter_verification_tries
|
||||
Lock.increase_tries(@letter.user)
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
@@ -46,9 +46,4 @@ class Verification::LetterController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def verify_attemps_left!
|
||||
if current_user.letter_verification_tries >= 2
|
||||
redirect_to account_path, alert: t('verification.letter.alert.verify_attemps_left')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Verification::ResidenceController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_attemps_left!, only: [:new, :create]
|
||||
before_action :verify_lock, only: [:new, :create]
|
||||
skip_authorization_check
|
||||
|
||||
def new
|
||||
@@ -21,10 +21,4 @@ class Verification::ResidenceController < ApplicationController
|
||||
def residence_params
|
||||
params.require(:residence).permit(:document_number, :document_type, :date_of_birth, :postal_code, :terms_of_service)
|
||||
end
|
||||
|
||||
def verify_attemps_left!
|
||||
if current_user.residence_verification_tries >= 5
|
||||
redirect_to account_path, alert: t('verification.residence.alert.verify_attemps_left')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
class Verification::SmsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_resident!
|
||||
before_action :verify_attemps_left!, only: [:new, :create]
|
||||
before_action :verify_lock, only: [:new, :create]
|
||||
before_action :set_phone, only: :create
|
||||
|
||||
skip_authorization_check
|
||||
@@ -68,10 +68,4 @@ class Verification::SmsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def verify_attemps_left!
|
||||
if current_user.sms_confirmation_tries >= 3
|
||||
redirect_to account_path, notice: t('verification.sms.alert.verify_attemps_left')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user