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
|
||||
Reference in New Issue
Block a user