Allow step 0 to resend the confirmation email

This commit is contained in:
Robin Ward
2016-10-21 11:34:19 -04:00
parent bf91532260
commit 19e2eec219
8 changed files with 48 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ class FinishInstallationController < ApplicationController
skip_before_filter :check_xhr, :preload_json, :redirect_to_login_if_required
layout 'finish_installation'
before_filter :ensure_no_admins, except: ['confirm_email']
before_filter :ensure_no_admins, except: ['confirm_email', 'resend_email']
def index
end
@@ -35,6 +35,17 @@ class FinishInstallationController < ApplicationController
@email = session[:registered_email]
end
def resend_email
@email = session[:registered_email]
@user = User.where(email: @email).first
if @user.present?
@email_token = @user.email_tokens.unconfirmed.active.first
if @email_token.present?
Jobs.enqueue(:critical_user_email, type: :signup, user_id: @user.id, email_token: @email_token.token)
end
end
end
protected
def redirect_confirm(email)

View File

@@ -1,3 +1,9 @@
<h1><%= t 'first_installation.confirm_email.title' %></h1>
<h1><%= t 'finish_installation.confirm_email.title' %></h1>
<%= raw(t 'first_installation.confirm_email.message', email: @email) %>
<%= raw(t 'finish_installation.confirm_email.message', email: @email) %>
<div class='row'>
<%= button_to(finish_installation_resend_email_path, method: :put, class: 'wizard-btn') do %>
<%= t 'finish_installation.resend_email.title' %>
<% end %>
</div>

View File

@@ -1,16 +1,16 @@
<h1><%= t 'first_installation.congratulations' %></h1>
<h1><%= t 'finish_installation.congratulations' %></h1>
<div class='row'>
<%= image_tag "/images/wizard/tada.svg", class: "tada" %>
</div>
<div class='row help-text'>
<%= t 'first_installation.register.help' %>
<%= t 'finish_installation.register.help' %>
</div>
<div class='row'>
<%= link_to(finish_installation_register_path, class: 'wizard-btn primary') do %>
<i class='fa fa-user'></i>
<%= t 'first_installation.register.button' %>
<%= t 'finish_installation.register.button' %>
<% end %>
</div>

View File

@@ -1,4 +1,4 @@
<h1><%= t 'first_installation.register.title' %></h1>
<h1><%= t 'finish_installation.register.title' %></h1>
<%- if @allowed_emails.present? %>
<%= form_tag(finish_installation_register_path) do %>
@@ -43,11 +43,11 @@
<% end %>
</div>
<%= submit_tag(t('first_installation.register.button'), class: 'wizard-btn primary') %>
<%= submit_tag(t('finish_installation.register.button'), class: 'wizard-btn primary') %>
<%- end %>
<%- else -%>
<p><%= raw(t 'first_installation.register.no_emails') %></p>
<p><%= raw(t 'finish_installation.register.no_emails') %></p>
<%- end %>
<script>

View File

@@ -0,0 +1,3 @@
<h1><%= t 'finish_installation.resend_email.title' %></h1>
<%= raw(t 'finish_installation.resend_email.message', email: @email) %>