adds verification tries to letter code [#332]
This commit is contained in:
@@ -2,6 +2,7 @@ class Verification::LetterController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_resident!
|
||||
before_action :verify_phone!
|
||||
before_action :verify_attemps_left!
|
||||
skip_authorization_check
|
||||
|
||||
def new
|
||||
@@ -28,6 +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
|
||||
@error = t('verification.letter.update.error')
|
||||
render :edit
|
||||
end
|
||||
@@ -44,4 +46,10 @@ class Verification::LetterController < ApplicationController
|
||||
redirect_to verified_user_path, alert: t('verification.letter.alert.unconfirmed_code')
|
||||
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