-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2559 from alphagov/split-out-resending-signup-ema…
…il-from-edit-user-page Add separate page for resending signup email for another user
- Loading branch information
Showing
12 changed files
with
328 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class Users::InvitationResendsController < ApplicationController | ||
layout "admin_layout" | ||
|
||
before_action :authenticate_user! | ||
before_action :load_user | ||
before_action :authorize_user | ||
before_action :redirect_if_invitation_already_accepted | ||
|
||
def edit; end | ||
|
||
def update | ||
@user.invite!(current_user) | ||
EventLog.record_account_invitation(@user, current_user) | ||
flash[:notice] = "Resent account signup email to #{@user.email}" | ||
redirect_to edit_user_path(@user) | ||
end | ||
|
||
private | ||
|
||
def load_user | ||
@user = User.find(params[:user_id]) | ||
end | ||
|
||
def authorize_user | ||
authorize(@user, :resend_invitation?) | ||
end | ||
|
||
def redirect_if_invitation_already_accepted | ||
unless @user.invited_but_not_yet_accepted? | ||
flash[:notice] = "Invitation for #{@user.email} has already been accepted" | ||
redirect_to edit_user_path(@user) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<% content_for :title_caption, "Manage other users" %> | ||
<% content_for :title, "Resend signup email for #{@user.name}" %> | ||
|
||
<% content_for :breadcrumbs, | ||
render("govuk_publishing_components/components/breadcrumbs", { | ||
collapse_on_mobile: true, | ||
breadcrumbs: [ | ||
{ | ||
title: "Dashboard", | ||
url: root_path, | ||
}, | ||
{ | ||
title: "Users", | ||
url: users_path, | ||
}, | ||
{ | ||
title: @user.name, | ||
url: edit_user_path(@user), | ||
}, | ||
{ | ||
title: "Resend signup email", | ||
} | ||
] | ||
}) | ||
%> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= form_for @user, url: user_invitation_resend_path(@user) do %> | ||
<%= render "govuk_publishing_components/components/hint", { | ||
text: "Invitation not accepted. This user hasn't clicked on the link in their signup mail yet." | ||
} %> | ||
|
||
<div class="govuk-button-group"> | ||
<%= render "govuk_publishing_components/components/button", { | ||
text: "Resend signup email", | ||
} %> | ||
<%= link_to "Cancel", edit_user_path(@user), class: "govuk-link govuk-link--no-visited-state" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.