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

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