Redesign sign-up and login pages (#20065)

* Signin Signup screen update

* Design for signin signup finished

* On hover effect

* Fixed few tests

* Fixed rSpec tests

* Minor design fixes

* Design changes suggested by Anuj

* Test fixes

* Updated test

* Nit fixes

* Path changes and footer and topbar hidden

* A bit simplified css

* Removed custom css

* Updated tests

* Nit css fixes

* Updates as per Ridhwana's review

* CSS fixes

* Used js-registration
This commit is contained in:
Rajat Talesra 2023-09-13 21:46:57 +05:30 committed by GitHub
parent 1533936d7a
commit a679486572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 178 additions and 72 deletions

View file

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.38 6.615c.901 0 2.033-.61 2.707-1.423.61-.738 1.056-1.768 1.056-2.798 0-.14-.013-.28-.04-.394-1.004.038-2.21.673-2.936 1.525-.572.65-1.094 1.667-1.094 2.71 0 .152.026.304.038.354.064.013.166.026.267.026h.001ZM9.2 22c1.234 0 1.78-.827 3.319-.827 1.564 0 1.906.802 3.28.802 1.348 0 2.25-1.246 3.102-2.467.954-1.4 1.349-2.772 1.373-2.836-.089-.025-2.67-1.08-2.67-4.042 0-2.569 2.034-3.726 2.149-3.815-1.348-1.933-3.395-1.983-3.954-1.983-1.514 0-2.746.915-3.522.915-.84 0-1.946-.865-3.255-.865C6.529 6.882 4 8.942 4 12.832c0 2.416.94 4.972 2.097 6.625C7.088 20.857 7.954 22 9.2 22Z" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 713 B

View file

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.5 2.5a3 3 0 0 1 3 3v13a3 3 0 0 1-3 3h-13a3 3 0 0 1-3-3v-13a3 3 0 0 1 3-3h13Z" fill="#1877F2"/>
<path d="M16.12 12h-2.636v-1.781c0-.754.368-1.485 1.544-1.485h1.2V6.395s-1.087-.184-2.126-.184c-2.167 0-3.586 1.312-3.586 3.693V12H8.105v2.75h2.41v6.75h2.97v-6.757h2.214L16.115 12h.006Z" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 420 B

View file

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2.5" y="2.5" width="19" height="19" rx="3" fill="#022830"/>
<path d="M12.326 15.382a.229.229 0 0 1 .27.131 1.804 1.804 0 0 0 2.157 1.096c.887-.254 1.467-1.129 1.316-2.042a.217.217 0 0 1 .169-.248l.745-.2a.232.232 0 0 1 .277.16l.004.015a3.084 3.084 0 0 1-2.186 3.526 2.997 2.997 0 0 1-3.631-1.92.223.223 0 0 1 .142-.289l.015-.004.722-.225Z" fill="#E9F0E8"/>
<path d="M10.673 9.915a.229.229 0 0 1-.27-.131 1.804 1.804 0 0 0-2.157-1.096A1.818 1.818 0 0 0 6.93 10.73a.217.217 0 0 1-.168.248l-.745.2a.232.232 0 0 1-.278-.16l-.004-.015a3.084 3.084 0 0 1 2.187-3.526 2.997 2.997 0 0 1 3.63 1.92.223.223 0 0 1-.142.289l-.014.004-.723.225Z" fill="#4CFCA7"/>
<path d="m14.936 8.584-.774.208a.232.232 0 0 1-.278-.16l-.317-1.182a.233.233 0 0 1 .16-.278l.79-.211a.232.232 0 0 0 .16-.278l-.2-.744a.223.223 0 0 0-.277-.16l-1.954.54a.233.233 0 0 0-.16.277l.258.963.316 1.181.317 1.182.012.044.88 3.283c.03.117.146.195.263.164l.73-.196a.233.233 0 0 0 .16-.277l-.73-2.729c-.024-.087.019-.161.107-.185l.862-.23a.233.233 0 0 0 .16-.278l-.2-.744c-.039-.146-.168-.221-.285-.19Zm.986-.06a.24.24 0 0 1 .116-.266.871.871 0 0 0 .428-.975.828.828 0 0 0-.839-.62.212.212 0 0 1-.23-.157l-.2-.744c-.03-.117.044-.246.157-.292l.03-.008a2.02 2.02 0 0 1 2.251 1.508 2.058 2.058 0 0 1-1.192 2.446.235.235 0 0 1-.3-.123l-.007-.03-.214-.74Z" fill="#FBC1F5"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2C6.475 2 2 6.475 2 12a9.994 9.994 0 0 0 6.838 9.488c.5.087.687-.213.687-.476 0-.237-.013-1.024-.013-1.862-2.512.463-3.162-.612-3.362-1.175-.113-.288-.6-1.175-1.025-1.413-.35-.187-.85-.65-.013-.662.788-.013 1.35.725 1.538 1.025.9 1.512 2.338 1.087 2.912.825.088-.65.35-1.087.638-1.337-2.225-.25-4.55-1.113-4.55-4.938 0-1.088.387-1.987 1.025-2.688-.1-.25-.45-1.275.1-2.65 0 0 .837-.262 2.75 1.026a9.28 9.28 0 0 1 2.5-.338c.85 0 1.7.112 2.5.337 1.912-1.3 2.75-1.024 2.75-1.024.55 1.375.2 2.4.1 2.65.637.7 1.025 1.587 1.025 2.687 0 3.838-2.337 4.688-4.562 4.938.362.312.675.912.675 1.85 0 1.337-.013 2.412-.013 2.75 0 .262.188.574.688.474A10.016 10.016 0 0 0 22 12c0-5.525-4.475-10-10-10Z" fill="#171717"/>
</svg>

After

Width:  |  Height:  |  Size: 824 B

View file

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.09 18.75c2.115-1.973 3.052-5.25 2.49-8.393h-8.392v3.473h4.777a3.945 3.945 0 0 1-1.777 2.67l2.902 2.25Z" fill="#4285F4"/>
<path d="M4.215 15.982A9 9 0 0 0 18.09 18.75l-2.902-2.25a5.37 5.37 0 0 1-8.018-2.813l-2.955 2.296Z" fill="#34A853"/>
<path d="M7.17 13.687c-.375-1.17-.375-2.25 0-3.42L4.215 7.965a9.06 9.06 0 0 0 0 8.025l2.955-2.303Z" fill="#FBBC02"/>
<path d="M7.17 10.267c1.035-3.24 5.438-5.115 8.393-2.347l2.58-2.528A8.85 8.85 0 0 0 4.215 7.965l2.955 2.302Z" fill="#EA4335"/>
</svg>

After

Width:  |  Height:  |  Size: 614 B

View file

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22.162 5.656a8.385 8.385 0 0 1-2.402.658A4.196 4.196 0 0 0 21.6 4c-.82.488-1.719.83-2.656 1.015a4.182 4.182 0 0 0-7.126 3.814 11.874 11.874 0 0 1-8.62-4.37 4.168 4.168 0 0 0-.566 2.103c0 1.45.738 2.73 1.86 3.48a4.168 4.168 0 0 1-1.894-.522v.052a4.185 4.185 0 0 0 3.355 4.1 4.211 4.211 0 0 1-1.89.073A4.185 4.185 0 0 0 7.97 16.65a8.395 8.395 0 0 1-6.19 1.732 11.83 11.83 0 0 0 6.409 1.88c7.693 0 11.9-6.373 11.9-11.9 0-.18-.005-.362-.013-.54a8.497 8.497 0 0 0 2.087-2.165v-.001Z" fill="#1EA1F1"/>
</svg>

After

Width:  |  Height:  |  Size: 613 B

View file

@ -13,6 +13,14 @@
display: none;
}
.registrations + #footer {
display: none;
}
.notifications + #footer {
display: none;
}
.crayons-footer {
--footer-padding: var(--su-5);
background: var(--footer-bg);

View file

@ -65,21 +65,48 @@
// Registration View
.registration {
border-radius: unset;
padding: var(--su-6);
padding: var(--su-4);
@media (min-width: $breakpoint-s) {
border-radius: var(--radius);
padding: var(--su-8);
padding-top: var(--su-6);
margin: 0 auto;
width: $breakpoint-s;
}
&__button-container {
border: 1px solid var(--form-border);
a {
color: var(--label-primary);
}
.js-focus-visible &.focus-visible:focus,
&:is(label):focus-within {
box-shadow: var(--focus-ring);
outline: 0;
z-index: var(--z-elevate);
}
&:hover {
border: 1px solid var(--form-border);
background: var(--card-tertiary-bg);
}
}
&__logo {
width: 48px;
height: 48px;
}
&__content {
margin-bottom: var(--su-6);
text-align: center;
}
&__title {
margin-top: var(--su-4);
color: var(--card-color);
font-size: var(--fs-2xl);
line-height: var(--lh-tight);
@ -90,41 +117,40 @@
}
&__description {
margin-top: var(--su-1);
color: var(--card-color-secondary);
font-size: var(--fs-base);
}
&__hr {
margin-bottom: var(--su-4);
&__hr-container {
position: relative;
text-align: center;
margin: var(--su-7) 0px;
}
&:after {
border: 1px solid var(--base-20);
content: '';
display: block;
position: absolute;
top: 50%;
width: 100%;
border-radius: var(--radius);
}
&__hr {
height: 1px;
margin: var(--su-6) 0px;
background-color: var(--divider);
border: none;
}
&__hr-label {
position: relative;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 0 var(--su-4);
color: var(--grey-700);
text-align: center;
font-size: var(--fs-s);
color: var(--card-color-secondary);
background: var(--card-bg);
padding: 0 var(--su-2);
z-index: var(--z-elevate);
display: inline-block;
max-width: 75%;
}
&__actions-providers {
margin-bottom: var(--su-4);
display: grid;
grid-gap: var(--su-2);
grid-gap: var(--su-3);
width: 100%;
}

View file

@ -1,11 +1,19 @@
<section class="crayons-layout">
<div class="registration crayons-card">
<section class="crayons-layout bg-base-inverted max-w-100">
<div class="registration js-registration">
<div class="registration__content">
<% if Settings::General.resized_logo.present? %>
<img class="registration__logo" src="<%= Settings::General.original_logo %>" alt="<%= community_name %>">
<% end %>
<h1 class="registration__title">
<% if params[:state] == "new-user" && ForemInstance.invitation_only? %>
<%= community_name %> is invite only.
<% else %>
Welcome to <%= community_name %>
<% if params[:state] == "new-user" %>
Join the <%= community_name %>
<% else %>
Welcome back to <%= community_name %>
<% end %>
<% end %>
</h1>
<p class="registration__description">
@ -22,23 +30,50 @@
<%= render partial: "shared/authentication/providers_registration_form" %>
<% if params[:state] == "new-user" %>
<div class="registration__hr">
<span class="registration__hr-label">
Already have an account? <a href="<%= sign_up_path %>">Log in</a>.
</span>
<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>.
</div>
<hr class="registration__hr" />
<div class="crayons-subtitle-3 color-grey-700 fw-normal align-center">
Already have an account? <a href="<%= sign_up_path %>">Log in</a>.
</div>
<% else %>
<div class="registration__actions-email" id="sign-in-password-form">
<% if Settings::Authentication.allow_email_password_login %>
<div class="registration__hr">
<span class="registration__hr-label">
Have a password? Continue with your email address
</span>
<div class="registration__hr-container">
<hr class="registration__hr" />
<div class="registration__hr-label">OR</div>
</div>
<%= 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">
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>.
</div>
<hr class="registration__hr" />
<div class="rcrayons-subtitle-3 color-grey-700 fw-normal align-center">
New to <%= community_name %>? <a href="/enter?state=new-user">Create account</a>.
</div>
<% end %>
</div>
<% end %>
</div>
</div>
</section>
<script>
const registrationsPage = document.querySelector('.js-registration');
const topbarElement = document.querySelector('#topbar');
// Check if the registrations or notifications element exists and the topbar element exists.
if ((registrationsPage && topbarElement) || (notificationsPage && 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

@ -1,5 +1,5 @@
<div class="navigation-progress" id="navigation-progress"></div>
<header class="crayons-header print-hidden">
<header id="topbar" class="crayons-header topbar print-hidden">
<span id="route-change-target" tabindex="-1"></span>
<a href="#main-content" class="skip-content-link"><%= t("views.main.header.skip") %></a>
<div class="crayons-header__container">

View file

@ -9,17 +9,17 @@
<%= f.password_field :password, autocomplete: "current-password", class: "crayons-textfield" %>
</div>
<div class="crayons-field crayons-field--checkbox inline-flex flex-row items-center">
<%= f.check_box :remember_me, class: "crayons-checkbox" %>
<%= f.label :remember_me, class: "crayons-field__label fw-normal" %>
<div class="crayons-field flex flex-row items-center justify-between mb-3">
<div>
<%= f.check_box :remember_me, class: "crayons-checkbox" %>
<%= f.label :remember_me, class: "crayons-field__label fw-normal" %>
</div>
<a class="m-0" href="<%= new_password_path(:user) %>">
<%= t("views.auth.login.forgot") %>
</a>
</div>
<div class="actions pt-3">
<%= f.submit t("views.auth.login.continue"), class: "crayons-btn crayons-btn--l w-100" %>
<%= f.submit t("views.auth.login.text"), class: "crayons-btn crayons-btn--l w-100" %>
</div>
<% end %>
<p class="pt-6 fs-s align-center">
<a href="<%= new_password_path(:user) %>">
<%= t("views.auth.login.forgot") %>
</a>
</p>

View file

@ -2,16 +2,22 @@
<% authentication_enabled_providers.each do |provider| %>
<% next unless display_social_login?(provider.provider_name) %>
<%= form_with url: provider.sign_in_path(state: "navbar_basic"), class: "flex w-100", local: true do |f| %>
<%= f.button type: :submit, class: "crayons-btn crayons-btn--l crayons-btn--brand-#{provider.provider_name} crayons-btn--icon-left grow-1 whitespace-nowrap" do %>
<%= crayons_icon_tag(provider.provider_name, aria_hidden: true, title: provider.provider_name) %>
<%= t("views.auth.provider.text", action: params[:state] == "new-user" ? t("views.auth.provider.signup") : t("views.auth.provider.login"), provider: provider.official_name) %>
<%= f.button type: :submit, class: "flex w-100 p-3 radius-default items-center bg-base-inverted registration__button-container brand-#{provider.provider_name}" do %>
<%= crayons_icon_tag("#{provider.provider_name}-icon", class: "crayons-icon--default", aria_hidden: true, width: 24, height: 24) %>
<span class="w-100 flex fw-medium fs-s justify-center items-center self-center color-primary">
<%= t("views.auth.provider.text", action: params[:state] == "new-user" ? t("views.auth.provider.signup") : t("views.auth.provider.login"), provider: provider.official_name) %>
</span>
<% end %>
<% end %>
<% end %>
<% if params[:state] == "new-user" && Settings::Authentication.allow_email_password_registration && !ForemInstance.invitation_only? %>
<%= link_to "#{crayons_icon_tag(:email, aria_hidden: true, title: t('views.auth.provider.email.icon'))}#{t('views.auth.provider.email.text')}".html_safe,
request.params.merge(state: "email_signup").except("i"),
class: "crayons-btn crayons-btn--l crayons-btn--brand-email crayons-btn--icon-left whitespace-nowrap",
data: { no_instant: "" } %>
<a href="<%= url_for(request.params.merge(state: "email_signup").except("i")) %>"
class="flex w-100 p-3 radius-default items-center bg-base-inverted registration__button-container"
data-no_instant="">
<%= crayons_icon_tag(:email, class: "crayons-icon--default", aria_hidden: true, width: 24, height: 24) %>
<span class="w-100 flex fw-medium fs-s justify-center items-center self-center color-primary">
<%= t("views.auth.provider.email.text") %>
</span>
</a>
<% end %>
</div>

View file

@ -20,8 +20,7 @@ en:
login:
aria_label: Log in
text: Log in
continue: Continue
forgot: I forgot my password
forgot: Forgot password?
provider:
text: "%{action} with %{provider}"
login: Continue

View file

@ -20,8 +20,7 @@ fr:
login:
aria_label: Log in
text: Se connecter
continue: Continue
forgot: I forgot my password
forgot: Forgot password?
provider:
text: "%{action} with %{provider}"
login: Continue

View file

@ -49,7 +49,7 @@ describe('User Change Password', () => {
);
// Submit the form
cy.get('@loginForm').findByText('Continue').click();
cy.get('@loginForm').findByText('Log in').click();
cy.wait(loginNetworkRequests);
const { baseUrl } = Cypress.config();

View file

@ -27,7 +27,7 @@ describe('User Login', () => {
});
// Submit the form
cy.get('@loginForm').findByText('Continue').click();
cy.get('@loginForm').findByText('Log in').click();
// User should be redirected to onboarding
const { baseUrl } = Cypress.config();
@ -56,7 +56,7 @@ describe('User Login', () => {
});
// Submit the form
cy.get('@loginForm').findByText('Continue').click();
cy.get('@loginForm').findByText('Log in').click();
cy.url().should('contains', '/new?prefill=');

View file

@ -9,8 +9,10 @@ RSpec.describe "NotificationsIndex" do
let(:organization) { create(:organization) }
before do
# rubocop:disable RSpec/ReceiveMessages
allow(User).to receive(:staff_account).and_return(staff_account)
allow(User).to receive(:mascot_account).and_return(mascot_account)
# rubocop:enable RSpec/ReceiveMessages
end
def has_both_names(response_body)
@ -41,10 +43,10 @@ RSpec.describe "NotificationsIndex" do
end
context "when signed out" do
it "renders the signup page" do
it "renders the signin page" do
get "/notifications"
expect(response.body).to include("Continue with")
expect(response.body).to include("By signing in")
end
end
@ -53,7 +55,7 @@ RSpec.describe "NotificationsIndex" do
sign_in user
get "/notifications"
expect(response.body).not_to include("Continue with")
expect(response.body).not_to include("By signing in")
end
end

View file

@ -33,7 +33,7 @@ RSpec.describe "Registrations" do
it "shows the sign in text for password based authentication" do
get sign_up_path
expect(response.body).to include("Have a password? Continue with your email address")
expect(response.body).to include("By signing in")
end
end
@ -125,10 +125,12 @@ RSpec.describe "Registrations" do
context "when email registration allowed and captcha required" do
before do
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
# rubocop:disable RSpec/ReceiveMessages
allow(Settings::Authentication).to receive(:recaptcha_secret_key).and_return("someSecretKey")
allow(Settings::Authentication).to receive(:recaptcha_site_key).and_return("someSiteKey")
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
allow(Settings::Authentication).to receive(:require_captcha_for_email_password_registration).and_return(true)
# rubocop:enable RSpec/ReceiveMessages
end
it "displays the captcha box on email signup page" do
@ -265,8 +267,10 @@ RSpec.describe "Registrations" do
context "when email registration allowed and email allow list empty" do
before do
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
# rubocop:disable RSpec/ReceiveMessages
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
allow(Settings::Authentication).to receive(:allowed_registration_email_domains).and_return([])
# rubocop:enable RSpec/ReceiveMessages
end
it "creates user when email in allow list" do
@ -283,9 +287,11 @@ RSpec.describe "Registrations" do
context "when email registration allowed and email allow list present" do
before do
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
# rubocop:disable RSpec/ReceiveMessages
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
allow(Settings::Authentication).to receive(:allowed_registration_email_domains).and_return(["dev.to",
"forem.com"])
# rubocop:enable RSpec/ReceiveMessages
end
it "does not create user when email not in allow list" do
@ -312,10 +318,12 @@ RSpec.describe "Registrations" do
context "when Forem instance configured to accept email registration AND require captcha" do
before do
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
# rubocop:disable RSpec/ReceiveMessages
allow(Settings::Authentication).to receive(:recaptcha_secret_key).and_return("someSecretKey")
allow(Settings::Authentication).to receive(:recaptcha_site_key).and_return("someSiteKey")
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
allow(Settings::Authentication).to receive(:require_captcha_for_email_password_registration).and_return(true)
# rubocop:enable RSpec/ReceiveMessages
end
it "creates user when valid params passed and recaptcha completed" do

View file

@ -35,7 +35,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
visit sign_up_path
expect(page).to have_text("Continue with Apple")
expect(page).to have_text("Continue with GitHub")
expect(page).to have_text("Have a password? Continue with your email address")
end
it "renders the social providers when all providers except Apple are enabled" do
@ -50,7 +49,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
visit sign_up_path
expect(page).not_to have_text("Continue with Apple")
expect(page).to have_text("Continue with GitHub")
expect(page).to have_text("Have a password? Continue with your email address")
end
end
@ -69,7 +67,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
visit sign_up_path
expect(page).to have_text("Continue with Apple")
expect(page).to have_text("Continue with GitHub")
expect(page).to have_text("Have a password? Continue with your email address")
end
it "doesn't render social providers if Apple Auth isn't enabled" do
@ -84,7 +81,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
visit sign_up_path
expect(page).not_to have_text("Continue with Apple")
expect(page).not_to have_text("Continue with GitHub")
expect(page).to have_text("Have a password? Continue with your email address")
end
context "when Apple Auth and email registration aren't enabled" do
@ -107,7 +103,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
visit sign_up_path
expect(page).not_to have_text("Continue with Apple")
expect(page).not_to have_text("Continue with GitHub")
expect(page).to have_text("Have a password? Continue with your email address")
end
it "doesn't render the fallback because Forem Auth is enabled" do
@ -124,7 +119,6 @@ RSpec.describe "Conditional registration (ForemWebView)" do
expect(page).not_to have_text("Continue with Apple")
expect(page).not_to have_text("Continue with GitHub")
expect(page).to have_text("Continue with Forem")
expect(page).to have_text("Have a password? Continue with your email address")
end
end
end

View file

@ -20,7 +20,7 @@ RSpec.describe "Omniauth redirect_uri" do
allow(Settings::Authentication).to receive(:providers).and_return(Authentication::Providers.available)
visit sign_up_path
Authentication::Providers.available.each do |provider_name|
provider_auth_button = find("button.crayons-btn--brand-#{provider_name}")
provider_auth_button = find("button.brand-#{provider_name}")
provider_auth_url = provider_auth_button.find(:xpath, "..")["action"]
expect(provider_auth_url).to match(provider_redirect_regex(provider_name))
end
@ -30,7 +30,7 @@ RSpec.describe "Omniauth redirect_uri" do
# After an update the callback_url should now match Settings::General.app_domain
Authentication::Providers.available.each do |provider_name|
provider_auth_button = find("button.crayons-btn--brand-#{provider_name}")
provider_auth_button = find("button.brand-#{provider_name}")
provider_auth_url = provider_auth_button.find(:xpath, "..")["action"]
expect(provider_auth_url).to match(provider_redirect_regex(provider_name))
end

View file

@ -5,8 +5,10 @@ RSpec.describe "Authenticating with Email" do
let(:sign_up_link) { "Sign up with Email" }
before do
# rubocop:disable RSpec/ReceiveMessages
allow(Settings::Authentication).to receive(:allow_email_password_registration).and_return(true)
allow(Settings::Authentication).to receive(:allow_email_password_login).and_return(true)
# rubocop:enable RSpec/ReceiveMessages
allow(ForemInstance).to receive(:smtp_enabled?).and_return(true)
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(ProfileImageUploader).to receive(:download!)
@ -69,7 +71,7 @@ RSpec.describe "Authenticating with Email" do
visit sign_up_path
fill_in("user_email", with: "foo@bar.com")
fill_in("user_password", with: "password")
click_button("Continue", match: :first)
click_button("Log in", match: :first)
expect(page).to have_current_path("/users/sign_in")
expect(page).to have_text("Unable to login.")
@ -129,7 +131,7 @@ RSpec.describe "Authenticating with Email" do
context "when requesting a password reset mail" do
it "does not let malicious users enumerate email addresses" do
visit new_user_session_path
click_link "I forgot my password"
click_link "Forgot password?"
fill_in "Email", with: "doesnotexist@example.com"
click_button "Send me reset password instructions"
@ -149,6 +151,6 @@ RSpec.describe "Authenticating with Email" do
def log_in_user(user)
fill_in("user_email", with: user.email)
fill_in("user_password", with: user.password)
click_button("Continue", match: :first)
click_button("Log in", match: :first)
end
end

View file

@ -8,6 +8,7 @@ RSpec.describe "Completing Onboarding", js: true do
sign_out user
end
# rubocop:disable RSpec/PendingWithoutReason
context "when the user hasn't seen onboarding" do
xit "does not render the onboarding task card on the feed" do
sign_in(user)
@ -84,11 +85,12 @@ RSpec.describe "Completing Onboarding", js: true do
end
end
end
# rubocop:enable RSpec/PendingWithoutReason
# TODO: Extract this into a reusable helper
def log_in_user(user)
fill_in("user_email", with: user.email)
fill_in("user_password", with: user.password)
click_button("Continue", match: :first)
click_button("Log in", match: :first)
end
end

View file

@ -5,7 +5,7 @@ RSpec.describe "Authenticating with a password" do
allow(ForemInstance).to receive(:smtp_enabled?).and_return(true)
fill_in "Email", with: email
fill_in "Password", with: password
click_button "Continue"
click_button "Log in"
end
let(:password) { "p4assw0rd" }