removes unmasked emails and phones in forms
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
class Verification::EmailController < ApplicationController
|
class Verification::EmailController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :set_verified_user
|
before_action :set_verified_user, only: :create
|
||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@@ -26,6 +26,10 @@ class Verification::EmailController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_verified_user
|
def set_verified_user
|
||||||
@verified_user = VerifiedUser.by_user(current_user).by_email(params[:recipient]).first
|
@verified_user = VerifiedUser.by_user(current_user).where(id: verified_user_params[:id]).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def verified_user_params
|
||||||
|
params.require(:verified_user).permit(:id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2,6 +2,7 @@ class Verification::SmsController < ApplicationController
|
|||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :verify_resident!
|
before_action :verify_resident!
|
||||||
before_action :verify_attemps_left!, only: [:new, :create]
|
before_action :verify_attemps_left!, only: [:new, :create]
|
||||||
|
before_action :set_phone, only: :create
|
||||||
|
|
||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class Verification::SmsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@sms = Verification::Sms.new(sms_params.merge(user: current_user))
|
@sms = Verification::Sms.new(phone: @phone, user: current_user)
|
||||||
if @sms.save
|
if @sms.save
|
||||||
redirect_to edit_sms_path, notice: t('verification.sms.create.flash.success')
|
redirect_to edit_sms_path, notice: t('verification.sms.create.flash.success')
|
||||||
else
|
else
|
||||||
@@ -44,6 +45,19 @@ class Verification::SmsController < ApplicationController
|
|||||||
params.require(:sms).permit(:phone, :confirmation_code)
|
params.require(:sms).permit(:phone, :confirmation_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_phone
|
||||||
|
if verified_user
|
||||||
|
@phone = @verified_user.phone
|
||||||
|
else
|
||||||
|
@phone = sms_params[:phone]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def verified_user
|
||||||
|
return false unless params[:verified_user]
|
||||||
|
@verified_user = VerifiedUser.by_user(current_user).where(id: params[:verified_user][:id]).first
|
||||||
|
end
|
||||||
|
|
||||||
def redirect_to_next_path
|
def redirect_to_next_path
|
||||||
current_user.reload
|
current_user.reload
|
||||||
if current_user.level_three_verified?
|
if current_user.level_three_verified?
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
<%= form_for Verification::Email.new(verified_user), as: "email", url: email_path, method: :post do |f| %>
|
|
||||||
<%= hidden_field_tag :recipient, verified_user.email %>
|
|
||||||
<%= f.submit t('verification.email.form.submit_button') %>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<%= form_for sms, as: "sms", url: sms_path do |f| %>
|
|
||||||
<%= render 'shared/errors', resource: sms %>
|
|
||||||
<%= f.hidden_field :phone %>
|
|
||||||
<%= f.submit t('verification.sms.form.submit_button') %>
|
|
||||||
<% end %>
|
|
||||||
4
app/views/verification/verified_user/_form.html.erb
Normal file
4
app/views/verification/verified_user/_form.html.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<%= form_for verified_user, url: url, method: :post do |f| %>
|
||||||
|
<%= f.hidden_field :id %>
|
||||||
|
<%= f.submit t('verification.verified_user.form.submit_button') %>
|
||||||
|
<% end %>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<%= mask_email(verified_user.email) %>
|
<%= mask_email(verified_user.email) %>
|
||||||
</span>
|
</span>
|
||||||
<span style="float:left;padding-left:30px">
|
<span style="float:left;padding-left:30px">
|
||||||
<%= render '/verification/email/form', verified_user: verified_user %>
|
<%= render 'form', url: email_path, verified_user: verified_user %>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<br/><br/><br/>
|
<br/><br/><br/>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<%= mask_phone(verified_user.phone) %>
|
<%= mask_phone(verified_user.phone) %>
|
||||||
</span>
|
</span>
|
||||||
<span style="float:left;padding-left:30px">
|
<span style="float:left;padding-left:30px">
|
||||||
<%= render '/verification/sms/form', sms: Verification::Sms.new(phone: verified_user.phone) %>
|
<%= render 'form', url: sms_path, verified_user: verified_user %>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<br/><br/><br/>
|
<br/><br/><br/>
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ en:
|
|||||||
success: 'Correct code. You are now a verified user'
|
success: 'Correct code. You are now a verified user'
|
||||||
level_two:
|
level_two:
|
||||||
success: 'Correct code'
|
success: 'Correct code'
|
||||||
form:
|
|
||||||
submit_button: Send
|
|
||||||
alert:
|
alert:
|
||||||
verify_attemps_left: 'You have reached the maximum number of sms verification tries'
|
verify_attemps_left: 'You have reached the maximum number of sms verification tries'
|
||||||
email:
|
email:
|
||||||
@@ -49,8 +47,6 @@ en:
|
|||||||
success: "We have send you a confirmation email to your email account: %{email}"
|
success: "We have send you a confirmation email to your email account: %{email}"
|
||||||
alert:
|
alert:
|
||||||
failure: "There was a problem sending you an email to your account"
|
failure: "There was a problem sending you an email to your account"
|
||||||
form:
|
|
||||||
submit_button: Send
|
|
||||||
letter:
|
letter:
|
||||||
new:
|
new:
|
||||||
title: Final Verification
|
title: Final Verification
|
||||||
@@ -69,4 +65,5 @@ en:
|
|||||||
email_title: Emails
|
email_title: Emails
|
||||||
phone_title: Phones
|
phone_title: Phones
|
||||||
use_another_phone: Use another phone
|
use_another_phone: Use another phone
|
||||||
|
form:
|
||||||
|
submit_button: Send
|
||||||
@@ -34,8 +34,6 @@ es:
|
|||||||
success: 'Código correcto. Ya eres un usuario verificado'
|
success: 'Código correcto. Ya eres un usuario verificado'
|
||||||
level_two:
|
level_two:
|
||||||
success: 'Código incorrecto'
|
success: 'Código incorrecto'
|
||||||
form:
|
|
||||||
submit_button: Enviar
|
|
||||||
alert:
|
alert:
|
||||||
verify_attemps_left: 'Has llegado al máximo número de intentos de verificar tu teléfono.'
|
verify_attemps_left: 'Has llegado al máximo número de intentos de verificar tu teléfono.'
|
||||||
email:
|
email:
|
||||||
@@ -49,8 +47,6 @@ es:
|
|||||||
success: "Te hemos enviado un email de confirmación a tu cuenta: %{email}"
|
success: "Te hemos enviado un email de confirmación a tu cuenta: %{email}"
|
||||||
alert:
|
alert:
|
||||||
failure: "Hubo un problema enviándote un email a tu cuenta"
|
failure: "Hubo un problema enviándote un email a tu cuenta"
|
||||||
form:
|
|
||||||
submit_button: Enviar
|
|
||||||
letter:
|
letter:
|
||||||
new:
|
new:
|
||||||
title: Final Verification
|
title: Final Verification
|
||||||
@@ -69,3 +65,5 @@ es:
|
|||||||
email_title: Emails
|
email_title: Emails
|
||||||
phone_title: Teléfonos
|
phone_title: Teléfonos
|
||||||
use_another_phone: Utilizar otro teléfono
|
use_another_phone: Utilizar otro teléfono
|
||||||
|
form:
|
||||||
|
submit_button: Enviar
|
||||||
Reference in New Issue
Block a user