adds letter verification

This commit is contained in:
rgarcia
2015-08-27 23:58:31 +02:00
parent 570f67195c
commit f7d22f64b6
5 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
class Verification::LetterController < ApplicationController
before_action :authenticate_user!
before_action :verify_resident!
before_action :verify_phone_or_email!
skip_authorization_check
def new
@letter = Letter.new(user: current_user)
end
def create
@letter = Letter.new(user: current_user)
if @letter.save
redirect_to account_path, notice: t('verification.letter.create.flash.success')
else
flash.now.alert = t('verification.letter.create.alert.failure')
render :new
end
end
private
def letter_params
params.require(:letter).permit()
end
def verify_phone_or_email!
unless current_user.confirmed_phone?
redirect_to verified_user_path, alert: t('verification.letter.alert.unconfirmed_personal_data')
end
end
end