adds verified users concept
This commit is contained in:
9
app/controllers/verification/verified_user_controller.rb
Normal file
9
app/controllers/verification/verified_user_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Verification::VerifiedUserController < ApplicationController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
skip_authorization_check
|
||||||
|
|
||||||
|
def show
|
||||||
|
@verified_users = VerifiedUser.by_user(current_user)
|
||||||
|
redirect_to new_sms_path if @verified_users.blank?
|
||||||
|
end
|
||||||
|
end
|
||||||
12
app/models/verified_user.rb
Normal file
12
app/models/verified_user.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# make sure document_type is being stored and queried in the correct format (Is it DNI? a number, a string?)
|
||||||
|
class VerifiedUser < ActiveRecord::Base
|
||||||
|
scope :by_user, -> (user) { where(document_number: user.document_number,
|
||||||
|
document_type: user.document_type) }
|
||||||
|
|
||||||
|
scope :by_email, -> (email) { where(email: email) }
|
||||||
|
scope :by_phone, -> (phone) { where(phone: phone) }
|
||||||
|
|
||||||
|
def self.phone?(user)
|
||||||
|
by_user(user).by_phone(user.unconfirmed_phone).first.present?
|
||||||
|
end
|
||||||
|
end
|
||||||
49
app/views/verification/verified_user/show.html.erb
Normal file
49
app/views/verification/verified_user/show.html.erb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<div class="row account">
|
||||||
|
<div class="small-12 column">
|
||||||
|
|
||||||
|
<h1 class="inline-block"><%= t('verification.verified_user.show.title') %></h1>
|
||||||
|
|
||||||
|
<% if @verified_users.map(&:email).any? %>
|
||||||
|
<div><strong><%= t('verification.verified_user.show.email_title') %></strong></div>
|
||||||
|
<ul>
|
||||||
|
<% @verified_users.each do |verified_user| %>
|
||||||
|
<% if verified_user.email.present? %>
|
||||||
|
<li id="<%= dom_id(verified_user) %>_email" style="float:left">
|
||||||
|
<span style="float:left">
|
||||||
|
<%= verified_user.email %>
|
||||||
|
</span>
|
||||||
|
<span style="float:left;padding-left:30px">
|
||||||
|
<%= render '/verification/email/form', verified_user: verified_user %>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<br/><br/><br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if @verified_users.map(&:phone).any? %>
|
||||||
|
<div><strong><%= t('verification.verified_user.show.phone_title') %></strong></div>
|
||||||
|
<ul style="padding-top:40px">
|
||||||
|
<% @verified_users.each do |verified_user| %>
|
||||||
|
<% if verified_user.phone.present? %>
|
||||||
|
<li id="<%= dom_id(verified_user) %>_phone" style="float:left">
|
||||||
|
<span style="float:left">
|
||||||
|
<%= verified_user.phone %>
|
||||||
|
</span>
|
||||||
|
<span style="float:left;padding-left:30px">
|
||||||
|
<%= render '/verification/sms/form', sms: Sms.new(phone: verified_user.phone) %>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<br/><br/><br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div style="margin-top: 30px">
|
||||||
|
<%= link_to t('verification.verified_user.show.use_another_phone'), new_sms_path %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user