Allow step 0 to resend the confirmation email
This commit is contained in:
parent
bf91532260
commit
19e2eec219
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<h1><%= t 'finish_installation.resend_email.title' %></h1>
|
||||
|
||||
<%= raw(t 'finish_installation.resend_email.message', email: @email) %>
|
|
@ -3192,7 +3192,7 @@ en:
|
|||
staff_tag_remove_disallowed: "The tag \"%{tag}\" may only be removed by staff."
|
||||
rss_by_tag: "Topics tagged %{tag}"
|
||||
|
||||
first_installation:
|
||||
finish_installation:
|
||||
congratulations: "Congratulations, you installed Discourse!"
|
||||
register:
|
||||
button: "Register"
|
||||
|
@ -3202,6 +3202,9 @@ en:
|
|||
confirm_email:
|
||||
title: "Confirm your Email"
|
||||
message: "<p>We sent an activation mail to <b>%{email}</b>. Please follow the instructions in the email to activate your account.</p><p>If it doesn't arrive, ensure you have set up email correctly for your Discourse and check your spam folder.</p>"
|
||||
resend_email:
|
||||
title: "Resend Activation Email"
|
||||
message: "<p>We've re-sent the activation email to <b>%{email}</b>"
|
||||
|
||||
wizard:
|
||||
title: "Discourse Setup"
|
||||
|
|
|
@ -41,6 +41,7 @@ Discourse::Application.routes.draw do
|
|||
get "finish-installation/register" => "finish_installation#register"
|
||||
post "finish-installation/register" => "finish_installation#register"
|
||||
get "finish-installation/confirm-email" => "finish_installation#confirm_email"
|
||||
put "finish-installation/resend-email" => "finish_installation#resend_email"
|
||||
|
||||
resources :directory_items
|
||||
|
||||
|
|
|
@ -82,4 +82,18 @@ describe FinishInstallationController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.resend_email' do
|
||||
before do
|
||||
SiteSetting.has_login_hint = true
|
||||
GlobalSetting.stubs(:developer_emails).returns("robin@example.com")
|
||||
post :register, email: 'robin@example.com', username: 'eviltrout', password: 'disismypasswordokay'
|
||||
end
|
||||
|
||||
it "resends the email" do
|
||||
Jobs.expects(:enqueue).with(:critical_user_email, has_entries(type: :signup))
|
||||
get :resend_email
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue