puts organizations out of verification process

This commit is contained in:
Juanjo Bazán
2015-09-12 18:05:51 +02:00
parent d9984c1ce4
commit d6c52ec866
3 changed files with 29 additions and 17 deletions

View File

@@ -11,7 +11,9 @@ class VerificationController < ApplicationController
private
def next_step_path(user = current_user)
if user.level_three_verified?
if user.organization?
{ path: account_path }
elsif user.level_three_verified?
{ path: account_path, notice: t('verification.redirect_notices.already_verified') }
elsif user.verification_letter_sent?
{ path: edit_letter_path }

View File

@@ -1,22 +1,22 @@
<div class="row account">
<div class="small-12 column">
<%= link_to t("account.show.change_credentials_link"), edit_user_registration_path, class: "button radius small secondary right" %>
<div>
<span class="right verify-account">
<% if current_user.level_three_verified? %>
<p class="verified">
<i class="icon-check"></i>
<%= t("account.show.verified_account") %>
</p>
<% elsif current_user.level_two_verified? %>
<%= link_to t("account.show.finish_verification"), verification_path, class: "button radius small success right" %>
<% else %>
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button radius small success right" %>
<% end %>
</span>
</div>
<% unless @account.organization? %>
<div>
<span class="right verify-account">
<% if current_user.level_three_verified? %>
<p class="verified">
<i class="icon-check"></i>
<%= t("account.show.verified_account") %>
</p>
<% elsif current_user.level_two_verified? %>
<%= link_to t("account.show.finish_verification"), verification_path, class: "button radius small success right" %>
<% else %>
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button radius small success right" %>
<% end %>
</span>
</div>
<% end %>
<h1 class="inline-block"><%= t("account.show.title") %></h1>
<%= form_for @account, as: :account, url: account_path do |f| %>

View File

@@ -2,6 +2,16 @@ require 'rails_helper'
feature 'Verification path' do
scenario "User is an organization" do
user = create(:user, verified_at: Time.now)
create(:organization, user: user)
login_as(user)
visit verification_path
expect(current_path).to eq account_path
end
scenario "User is verified" do
user = create(:user, verified_at: Time.now)