Reset password design and Signup page update for invite-only forems. (#20145)

* Private forem signup issue fix

* Minor design fixes

* Added click on logo

* Reset password design

* UX fix

* Updated dynamic contact

* Padding fix and test fix

* Complete translations

* Skipped flay test 'should show Feature Post button on an unfeatured post'
This commit is contained in:
Rajat Talesra 2023-09-22 14:49:31 +05:30 committed by GitHub
parent 2ae46a21b3
commit 5fb94d372b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 104 additions and 37 deletions

View file

@ -21,6 +21,10 @@
display: none; display: none;
} }
.passwords-new + #footer {
display: none;
}
.crayons-footer { .crayons-footer {
--footer-padding: var(--su-5); --footer-padding: var(--su-5);
background: var(--footer-bg); background: var(--footer-bg);

View file

@ -96,7 +96,7 @@
} }
&__logo { &__logo {
width: 48px; width: auto;
height: 48px; height: 48px;
} }

View file

@ -1,16 +1,39 @@
<%= render "devise/shared/error_messages", resource: resource %> <%= render "devise/shared/error_messages", resource: resource %>
<div class="mt-8 mb-10 crayons-card p-7 pt-3 align-left mx-auto" style="max-width:490px;"> <div class="js-new-password flex flex-col items-center s:mx-auto mx-4" style="max-width:488px;">
<h2 class="pb-4">Forgot your password?</h2> <% if Settings::General.resized_logo.present? %>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> <a class="mt-4 s:mt-7" href="/">
<img class="registration__logo" src="<%= Settings::General.original_logo %>" alt="<%= community_name %>">
<div class="crayons-field"> </a>
<%= f.label :email, class: "crayons-field__label" %>
<%= f.email_field :email, class: "crayons-textfield", placeholder: "you@email.com", autofocus: true, required: true %>
</div>
<div class="crayons-field pt-6">
<%= f.submit "Send me reset password instructions", class: "crayons-btn" %>
</div>
<% end %> <% end %>
<h2 class="crayons-title s:mt-6 mt-4"><%= I18n.t("devise.passwords.reset_password.forgot_password") %></h2>
<p class="crayons-subtitle-3 fw-normal mt-1 color-secondary align-center "><%= I18n.t("devise.passwords.reset_password.forgot_password_description") %></p>
<div class="mt-5 w-100">
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<div class="crayons-field">
<%= f.label :email, class: "crayons-field__label" %>
<%= f.email_field :email, class: "crayons-textfield", placeholder: I18n.t("devise.passwords.reset_password.email_placeholder"), autofocus: true, required: true %>
</div>
<div class="crayons-field pt-6">
<%= f.submit I18n.t("devise.passwords.reset_password.send_reset_link_button"), class: "crayons-btn" %>
</div>
<% end %>
</div>
<a class="mt-6 fs-base" href="javascript:history.back()"><%= I18n.t("devise.passwords.reset_password.go_back") %></a>
</div> </div>
<script>
const resetPasswordPage = document.querySelector('.js-new-password');
const topbarElement = document.querySelector('#topbar');
// Check if the reset password element exists and the topbar element exists.
if (resetPasswordPage && topbarElement) {
topbarElement.style.display = 'none';
document.body.style.paddingTop = '0';
// This is needed to make sure that the bottom part of page is white when screen is zoomed-out.
document.body.style.backgroundColor = 'white';
}
</script>

View file

@ -2,63 +2,81 @@
<div class="registration js-registration"> <div class="registration js-registration">
<div class="registration__content"> <div class="registration__content">
<% if Settings::General.resized_logo.present? %> <% if Settings::General.resized_logo.present? %>
<img class="registration__logo" src="<%= Settings::General.original_logo %>" alt="<%= community_name %>"> <a href="/">
<img class="registration__logo" src="<%= Settings::General.original_logo %>" alt="<%= community_name %>">
</a>
<% end %> <% end %>
<h1 class="registration__title"> <h1 class="registration__title">
<% if params[:state] == "new-user" && ForemInstance.invitation_only? %> <% if params[:state] == "new-user" && ForemInstance.invitation_only? %>
<%= community_name %> is invite only. <%= I18n.t("devise.registrations.title.invite_only_commuty", community_name: community_name) %>
<% else %> <% else %>
<% if params[:state] == "new-user" %> <% if params[:state] == "new-user" %>
Join the <%= community_name %> <%= I18n.t("devise.registrations.title.join_community", community_name: community_name) %>
<% else %> <% else %>
Welcome back to <%= community_name %> <%= I18n.t("devise.registrations.title.welcome_back_community", community_name: community_name) %>
<% end %> <% end %>
<% end %> <% end %>
</h1> </h1>
<p class="registration__description">
<%= render "shared/authentication_title" %> <% if params[:state] == "new-user" && ForemInstance.invitation_only? %>
</p> <p class="registration__description -mb-6">
<%= t("devise.registrations.invite_only_disclaimer_html", contact_link: contact_link) %>
</p>
<% else %>
<p class="registration__description">
<%= render "shared/authentication_title" %>
</p>
<% end %>
</div> </div>
<div class="registration__actions"> <div class="registration__actions">
<% if display_registration_fallback?(params[:state]) %> <% if display_registration_fallback?(params[:state]) %>
<h2 class="mt-8" style="text-align: center;" aria-live="polite">Sorry to be a bummer...</h2> <h2 class="mt-8" style="text-align: center;" aria-live="polite"><%= t("devise.registrations.errors.bummer") %></h2>
<p class="mb-8" style="text-align: center;" aria-live="polite">Unfortunately, we do not support creating new accounts right now on our mobile app. If you want create a new account to join <%= community_name %>, please do that on the web at <a href="<%= URL.url %>"><%= URL.url %></a>.</p> <p class="mb-8" style="text-align: center;" aria-live="polite"><%= t("devise.registrations.errors.mobile_app_no_new_account_html", community_name: community_name, path: URL.url) %></p>
<% end %> <% end %>
<%= render partial: "shared/authentication/providers_registration_form" %> <%= render partial: "shared/authentication/providers_registration_form" %>
<% if params[:state] == "new-user" %> <% if params[:state] == "new-user" %>
<% unless ForemInstance.invitation_only? %>
<div class="mt-6 align-center fs-s fw-normal fs-italic px-0 s:px-9 color-secondary"> <div class="mt-6 align-center fs-s fw-normal fs-italic px-0 s:px-9 color-secondary">
By signing up, you are agreeing to our <a href="<%= privacy_path %>">privacy policy</a>, <a href="<%= terms_path %>">terms of use</a> and <a href="<%= code_of_conduct_path %>">code of conduct</a>. <%= t("devise.registrations.agreement.sign_up_html", privacy_path: privacy_path, terms_path: terms_path, code_of_conduct_path: code_of_conduct_path) %>
</div> </div>
<% end %>
<hr class="registration__hr" /> <hr class="registration__hr" />
<div class="crayons-subtitle-3 color-grey-700 fw-normal align-center"> <div class="crayons-subtitle-3 color-grey-700 fw-normal align-center">
Already have an account? <a href="<%= sign_up_path %>">Log in</a>. <%= t("devise.registrations.already_have_an_account_html", sign_up_path: sign_up_path) %>
</div> </div>
<% else %> <% else %>
<div class="registration__actions-email" id="sign-in-password-form"> <div class="registration__actions-email" id="sign-in-password-form">
<% if Settings::Authentication.allow_email_password_login %> <% if Settings::Authentication.allow_email_password_login %>
<div class="registration__hr-container"> <% unless authentication_enabled_providers.empty? %>
<hr class="registration__hr" /> <div class="registration__hr-container">
<div class="registration__hr-label">OR</div> <hr class="registration__hr" />
</div> <div class="registration__hr-label"><%= t("devise.registrations.or") %></div>
</div>
<% end %>
<%= render partial: "shared/authentication/email_login_form" %> <%= render partial: "shared/authentication/email_login_form" %>
<div class="mt-6 align-center fs-s fw-normal fs-italic px-0 s:px-9 color-secondary"> <div class="mt-6 align-center fs-s fw-normal fs-italic px-0 s:px-9 color-secondary">
By signing in, you are agreeing to our <a href="<%= privacy_path %>">privacy policy</a>, <a href="<%= terms_path %>">terms of use</a> and <a href="<%= code_of_conduct_path %>">code of conduct</a>. <%= t("devise.registrations.agreement.sign_in_html", privacy_path: privacy_path, terms_path: terms_path, code_of_conduct_path: code_of_conduct_path) %>
</div> </div>
<hr class="registration__hr" /> <hr class="registration__hr" />
<div class="rcrayons-subtitle-3 color-grey-700 fw-normal align-center"> <% if ForemInstance.invitation_only? %>
New to <%= community_name %>? <a href="/enter?state=new-user">Create account</a>. <p class="registration__description -mb-6 align-center pb-6">
</div> <%= t("devise.registrations.invite_only_disclaimer_html", contact_link: contact_link) %>
</p>
<% else %>
<div class="crayons-subtitle-3 color-grey-700 fw-normal align-center pb-6">
<%= t("devise.registrations.create_account_html", community_name: community_name, sign_up_path: sign_up_path(state: "new-user")) %>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>

View file

@ -32,16 +32,36 @@ en:
passwords: passwords:
no_token: You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided. no_token: You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided.
reset_instructions_sent: Your password reset instructions have been sent. reset_instructions_sent: Your password reset instructions have been sent.
reset_password:
email_placeholder: you@email.com
forgot_password: Forgot your password?
forgot_password_description: Enter the email address associated with your account, and we'll send you a link to reset your password.
go_back: Go back
send_reset_link_button: Send reset link
send_instructions: You will receive an email with instructions on how to reset your password in a few minutes. send_instructions: You will receive an email with instructions on how to reset your password in a few minutes.
send_paranoid_instructions: If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes. send_paranoid_instructions: If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.
updated: Your password has been changed successfully. You are now signed in. updated: Your password has been changed successfully. You are now signed in.
updated_not_active: Your password has been changed successfully. updated_not_active: Your password has been changed successfully.
registrations: registrations:
agreement:
sign_in_html: By signing in, you are agreeing to our <a href="%{privacy_path}">privacy policy</a>, <a href="%{terms_path}">terms of use</a> and <a href="%{code_of_conduct_path}">code of conduct</a>.
sign_up_html: By signing up, you are agreeing to our <a href="%{privacy_path}">privacy policy</a>, <a href="%{terms_path}">terms of use</a> and <a href="%{code_of_conduct_path}">code of conduct</a>.
already_have_an_account_html: Already have an account? <a href="%{sign_up_path}">Log in</a>.
create_account_html: New to %{community_name}? <a href="%{sign_up_path}">Create account</a>.
destroyed: Bye! Your account has been successfully cancelled. We hope to see you again soon. destroyed: Bye! Your account has been successfully cancelled. We hope to see you again soon.
errors:
bummer: Sorry to be a bummer...
mobile_app_no_new_account_html: Unfortunately, we do not support creating new accounts right now on our mobile app. If you want create a new account to join %{community_name}, please do that on the web at <a href="%{path}">%{path}></a>
invite_only_disclaimer_html: Since this is an invite-only community, you cannot join without an invitation. If you would like to request an invitation, please contact the community admin at %{contact_link}
or: OR
signed_up: Welcome! You have signed up successfully. signed_up: Welcome! You have signed up successfully.
signed_up_but_inactive: You have signed up successfully. However, we could not sign you in because your account is not yet activated. signed_up_but_inactive: You have signed up successfully. However, we could not sign you in because your account is not yet activated.
signed_up_but_locked: You have signed up successfully. However, we could not sign you in because your account is locked. signed_up_but_locked: You have signed up successfully. However, we could not sign you in because your account is locked.
signed_up_but_unconfirmed: A message with a confirmation link has been sent to your email address. Please follow the link to activate your account. signed_up_but_unconfirmed: A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.
title:
invite_only_commuty: '%{community_name} is invite only.'
join_community: 'Join the %{community_name}'
welcome_back_community: 'Join the %{community_name}'
update_needs_confirmation: You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address. update_needs_confirmation: You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address.
updated: Your account has been updated successfully. updated: Your account has been updated successfully.
updated_but_not_signed_in: Your account has been updated successfully, but since your password was changed, you need to sign in again. updated_but_not_signed_in: Your account has been updated successfully, but since your password was changed, you need to sign in again.

View file

@ -54,7 +54,9 @@ describe('Moderation Tools for Posts', () => {
}); });
}); });
it('should show Feature Post button on an unfeatured post', () => { // This is a flaky test. The test is failing with Timeout error as it is unable
// to find `Moderation` button.
it.skip('should show Feature Post button on an unfeatured post', () => {
cy.get('@adminUser').then((user) => { cy.get('@adminUser').then((user) => {
cy.loginAndVisit(user, '/admin_mcadmin/unfeatured-article-slug').then( cy.loginAndVisit(user, '/admin_mcadmin/unfeatured-article-slug').then(
() => { () => {

View file

@ -133,7 +133,7 @@ RSpec.describe "Authenticating with Email" do
visit new_user_session_path visit new_user_session_path
click_link "Forgot password?" click_link "Forgot password?"
fill_in "Email", with: "doesnotexist@example.com" fill_in "Email", with: "doesnotexist@example.com"
click_button "Send me reset password instructions" click_button "Send reset link"
expect(page).not_to have_text("Email not found") expect(page).not_to have_text("Email not found")
end end