refactors lock tries [#279]

This commit is contained in:
rgarcia
2015-09-10 17:51:18 +02:00
parent c1c213f773
commit abc68dc868
19 changed files with 171 additions and 63 deletions

View File

@@ -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