Skip to content

A platform for community discussion. Free, open, simple.

FIX: Revert "Automatic auth flow with full page login/signup" (#30960)

Jan Cernik3070b8eeaefd
diff --git a/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js b/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js
index 6a0e348e32c..7bfc0847876 100644
--- a/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js
+++ b/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js
@@ -140,18 +140,14 @@ export default {
};
if (siteSettings.full_page_login) {
- router
- .transitionTo("signup", {
- queryParams: { authComplete: true },
- })
- .then((signup) => {
- const signupController =
- signup.controller || owner.lookup("controller:signup");
- Object.keys(createAccountProps || {}).forEach((key) => {
- signupController.set(key, createAccountProps[key]);
- });
- signupController.handleSkipConfirmation();
+ router.transitionTo("signup").then((signup) => {
+ const signupController =
+ signup.controller || owner.lookup("controller:signup");
+ Object.keys(createAccountProps || {}).forEach((key) => {
+ signupController.set(key, createAccountProps[key]);
});
+ signupController.handleSkipConfirmation();
+ });
} else {
modal.show(CreateAccount, { model: createAccountProps });
}
diff --git a/app/assets/javascripts/discourse/app/routes/application.js b/app/assets/javascripts/discourse/app/routes/application.js
index 8fe8de6bb27..630094bbd78 100644
--- a/app/assets/javascripts/discourse/app/routes/application.js
+++ b/app/assets/javascripts/discourse/app/routes/application.js
@@ -17,6 +17,7 @@ import DiscourseURL from "discourse/lib/url";
import { postRNWebviewMessage } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import Composer from "discourse/models/composer";
+import { findAll } from "discourse/models/login-method";
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
@@ -43,6 +44,17 @@ export default class ApplicationRoute extends DiscourseRoute {
@setting("title") siteTitle;
@setting("short_site_description") shortSiteDescription;
+ get isOnlyOneExternalLoginMethod() {
+ return (
+ !this.siteSettings.enable_local_logins &&
+ this.externalLoginMethods.length === 1
+ );
+ }
+
+ get externalLoginMethods() {
+ return findAll();
+ }
+
@action
loading(transition) {
this.loadingSlider.transitionStarted();
@@ -283,8 +295,8 @@ export default class ApplicationRoute extends DiscourseRoute {
: encodeURIComponent(window.location.pathname);
window.location = getURL("/session/sso?return_path=" + returnPath);
} else {
- if (this.login.isOnlyOneExternalLoginMethod) {
- this.login.singleExternalLogin();
+ if (this.isOnlyOneExternalLoginMethod) {
+ this.login.externalLogin(this.externalLoginMethods[0]);
} else if (this.siteSettings.full_page_login) {
this.router.transitionTo("login").then((login) => {
login.controller.set("canSignUp", this.controller.canSignUp);
@@ -309,9 +321,11 @@ export default class ApplicationRoute extends DiscourseRoute {
const returnPath = encodeURIComponent(window.location.pathname);
window.location = getURL("/session/sso?return_path=" + returnPath);
} else {
- if (this.login.isOnlyOneExternalLoginMethod) {
+ if (this.isOnlyOneExternalLoginMethod) {
// we will automatically redirect to the external auth service
- this.login.singleExternalLogin({ signup: true });
+ this.login.externalLogin(this.externalLoginMethods[0], {
+ signup: true,
+ });
} else if (this.siteSettings.full_page_login) {
this.router.transitionTo("signup").then((signup) => {
Object.keys(createAccountProps || {}).forEach((key) => {
diff --git a/app/assets/javascripts/discourse/app/routes/login.js b/app/assets/javascripts/discourse/app/routes/login.js
index 94cf8fa7c74..05c2ff10ce2 100644
--- a/app/assets/javascripts/discourse/app/routes/login.js
+++ b/app/assets/javascripts/discourse/app/routes/login.js
@@ -7,12 +7,9 @@ import DiscourseRoute from "discourse/routes/discourse";
export default class LoginRoute extends DiscourseRoute {
@service siteSettings;
@service router;
- @service login;
beforeModel() {
- if (this.login.isOnlyOneExternalLoginMethod) {
- this.login.singleExternalLogin();
- } else if (
+ if (
!this.siteSettings.login_required &&
(!this.siteSettings.full_page_login ||
this.siteSettings.enable_discourse_connect)
@@ -38,10 +35,6 @@ export default class LoginRoute extends DiscourseRoute {
controller.set("flashType", "");
controller.set("flash", "");
- if (this.login.isOnlyOneExternalLoginMethod) {
- controller.set("isRedirecting", true);
- }
-
if (this.siteSettings.login_required) {
controller.set("showLogin", false);
}
diff --git a/app/assets/javascripts/discourse/app/routes/signup.js b/app/assets/javascripts/discourse/app/routes/signup.js
index 562055e43cb..e78b79a459f 100644
--- a/app/assets/javascripts/discourse/app/routes/signup.js
+++ b/app/assets/javascripts/discourse/app/routes/signup.js
@@ -4,28 +4,11 @@ import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class SignupRoute extends DiscourseRoute {
- @service siteSettings;
@service router;
- @service login;
-
- authComplete = false;
-
- beforeModel(transition) {
- this.authComplete = transition.to.queryParams.authComplete || false;
-
- if (this.login.isOnlyOneExternalLoginMethod && !this.authComplete) {
- this.login.singleExternalLogin({ signup: true });
- } else {
- this.showCreateAccount();
- }
- }
-
- setupController(controller) {
- super.setupController(...arguments);
+ @service siteSettings;
- if (this.login.isOnlyOneExternalLoginMethod && !this.authComplete) {
- controller.set("isRedirecting", true);
- }
+ beforeModel() {
+ this.showCreateAccount();
}
@action
diff --git a/app/assets/javascripts/discourse/app/services/login.js b/app/assets/javascripts/discourse/app/services/login.js
index c6aec234e83..4c92ea7e460 100644
--- a/app/assets/javascripts/discourse/app/services/login.js
+++ b/app/assets/javascripts/discourse/app/services/login.js
@@ -1,12 +1,9 @@
import { action } from "@ember/object";
-import Service, { service } from "@ember/service";
+import Service from "@ember/service";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
-import { findAll } from "discourse/models/login-method";
@disableImplicitInjections
export default class LoginService extends Service {
- @service siteSettings;
-
@action
async externalLogin(
loginMethod,
@@ -19,20 +16,4 @@ export default class LoginService extends Service {
setLoggingIn?.(false);
}
}
-
- @action
- async singleExternalLogin(opts) {
- await this.externalLogin(this.externalLoginMethods[0], opts);
- }
-
- get isOnlyOneExternalLoginMethod() {
- return (
- !this.siteSettings.enable_local_logins &&
- this.externalLoginMethods.length === 1
- );
- }
-
- get externalLoginMethods() {
- return findAll();
- }
}
diff --git a/app/assets/javascripts/discourse/app/templates/login.hbs b/app/assets/javascripts/discourse/app/templates/login.hbs
index fc786cc4f9f..70310b1cc30 100644
--- a/app/assets/javascripts/discourse/app/templates/login.hbs
+++ b/app/assets/javascripts/discourse/app/templates/login.hbs
@@ -1,183 +1,176 @@
-{{hide-application-sidebar}}
-{{body-class "login-page"}}
+{{#if
+ (and
+ this.siteSettings.full_page_login
+ (or this.showLogin (not this.siteSettings.login_required))
+ )
+}}
+ {{hide-application-header-buttons "search" "login" "signup" "menu"}}
+ {{hide-application-sidebar}}
+ {{body-class "login-page"}}
+ <div class="login-fullpage">
+ <FlashMessage @flash={{this.flash}} @type={{this.flashType}} />
-{{#if this.isRedirecting}}
- {{loading-spinner}}
-{{else}}
- {{#if
- (and
- this.siteSettings.full_page_login
- (or this.showLogin (not this.siteSettings.login_required))
- )
- }}
- {{hide-application-header-buttons "search" "login" "signup" "menu"}}
- <div class="login-fullpage">
- <FlashMessage @flash={{this.flash}} @type={{this.flashType}} />
-
- <div class={{concat-class "login-body" this.bodyClasses}}>
- <PluginOutlet @name="login-before-modal-body" @connectorTagName="div" />
+ <div class={{concat-class "login-body" this.bodyClasses}}>
+ <PluginOutlet @name="login-before-modal-body" @connectorTagName="div" />
- {{#if this.hasNoLoginOptions}}
- <div class={{if this.site.desktopView "login-left-side"}}>
- <div class="login-welcome-header no-login-methods-configured">
- <h1 class="login-title">{{i18n
- "login.no_login_methods.title"
- }}</h1>
- <img />
- <p class="login-subheader">
- {{html-safe
- (i18n
- "login.no_login_methods.description"
- (hash adminLoginPath=this.adminLoginPath)
- )
- }}
- </p>
- </div>
+ {{#if this.hasNoLoginOptions}}
+ <div class={{if this.site.desktopView "login-left-side"}}>
+ <div class="login-welcome-header no-login-methods-configured">
+ <h1 class="login-title">{{i18n "login.no_login_methods.title"}}</h1>
+ <img />
+ <p class="login-subheader">
+ {{html-safe
+ (i18n
+ "login.no_login_methods.description"
+ (hash adminLoginPath=this.adminLoginPath)
+ )
+ }}
+ </p>
</div>
- {{else}}
- {{#if this.site.mobileView}}
- <WelcomeHeader @header={{i18n "login.header_title"}}>
- <PluginOutlet
- @name="login-header-bottom"
- @outletArgs={{hash createAccount=this.createAccount}}
- />
- </WelcomeHeader>
- {{#if this.showLoginButtons}}
- <LoginButtons
- @externalLogin={{this.externalLoginAction}}
- @passkeyLogin={{this.passkeyLogin}}
- @context="login"
- />
- {{/if}}
+ </div>
+ {{else}}
+ {{#if this.site.mobileView}}
+ <WelcomeHeader @header={{i18n "login.header_title"}}>
+ <PluginOutlet
+ @name="login-header-bottom"
+ @outletArgs={{hash createAccount=this.createAccount}}
+ />
+ </WelcomeHeader>
+ {{#if this.showLoginButtons}}
+ <LoginButtons
+ @externalLogin={{this.externalLoginAction}}
+ @passkeyLogin={{this.passkeyLogin}}
+ @context="login"
+ />
{{/if}}
+ {{/if}}
- {{#if this.canLoginLocal}}
- <div class={{if this.site.desktopView "login-left-side"}}>
- {{#if this.site.desktopView}}
- <WelcomeHeader @header={{i18n "login.header_title"}}>
- <PluginOutlet
- @name="login-header-bottom"
- @outletArgs={{hash createAccount=this.createAccount}}
- />
- </WelcomeHeader>
- {{/if}}
- <LocalLoginForm
- @loginName={{this.loginName}}
- @loginNameChanged={{this.loginNameChanged}}
- @canLoginLocalWithEmail={{this.canLoginLocalWithEmail}}
- @canUsePasskeys={{this.canUsePasskeys}}
- @passkeyLogin={{this.passkeyLogin}}
- @loginPassword={{this.loginPassword}}
- @secondFactorMethod={{this.secondFactorMethod}}
- @secondFactorToken={{this.secondFactorToken}}
- @backupEnabled={{this.backupEnabled}}
- @totpEnabled={{this.totpEnabled}}
- @securityKeyAllowedCredentialIds={{this.securityKeyAllowedCredentialIds}}
- @securityKeyChallenge={{this.securityKeyChallenge}}
+ {{#if this.canLoginLocal}}
+ <div class={{if this.site.desktopView "login-left-side"}}>
+ {{#if this.site.desktopView}}
+ <WelcomeHeader @header={{i18n "login.header_title"}}>
+ <PluginOutlet
+ @name="login-header-bottom"
+ @outletArgs={{hash createAccount=this.createAccount}}
+ />
+ </WelcomeHeader>
+ {{/if}}
+ <LocalLoginForm
+ @loginName={{this.loginName}}
+ @loginNameChanged={{this.loginNameChanged}}
+ @canLoginLocalWithEmail={{this.canLoginLocalWithEmail}}
+ @canUsePasskeys={{this.canUsePasskeys}}
+ @passkeyLogin={{this.passkeyLogin}}
+ @loginPassword={{this.loginPassword}}
+ @secondFactorMethod={{this.secondFactorMethod}}
+ @secondFactorToken={{this.secondFactorToken}}
+ @backupEnabled={{this.backupEnabled}}
+ @totpEnabled={{this.totpEnabled}}
+ @securityKeyAllowedCredentialIds={{this.securityKeyAllowedCredentialIds}}
+ @securityKeyChallenge={{this.securityKeyChallenge}}
+ @showSecurityKey={{this.showSecurityKey}}
+ @otherMethodAllowed={{this.otherMethodAllowed}}
+ @showSecondFactor={{this.showSecondFactor}}
+ @handleForgotPassword={{this.handleForgotPassword}}
+ @login={{this.triggerLogin}}
+ @flashChanged={{this.flashChanged}}
+ @flashTypeChanged={{this.flashTypeChanged}}
+ @securityKeyCredentialChanged={{this.securityKeyCredentialChanged}}
+ />
+ {{#if this.site.desktopView}}
+ <LoginPageCta
+ @canLoginLocal={{this.canLoginLocal}}
@showSecurityKey={{this.showSecurityKey}}
- @otherMethodAllowed={{this.otherMethodAllowed}}
- @showSecondFactor={{this.showSecondFactor}}
- @handleForgotPassword={{this.handleForgotPassword}}
@login={{this.triggerLogin}}
- @flashChanged={{this.flashChanged}}
- @flashTypeChanged={{this.flashTypeChanged}}
- @securityKeyCredentialChanged={{this.securityKeyCredentialChanged}}
+ @loginButtonLabel={{this.loginButtonLabel}}
+ @loginDisabled={{this.loginDisabled}}
+ @showSignupLink={{this.showSignupLink}}
+ @createAccount={{this.createAccount}}
+ @loggingIn={{this.loggingIn}}
+ @showSecondFactor={{this.showSecondFactor}}
/>
- {{#if this.site.desktopView}}
- <LoginPageCta
- @canLoginLocal={{this.canLoginLocal}}
- @showSecurityKey={{this.showSecurityKey}}
- @login={{this.triggerLogin}}
- @loginButtonLabel={{this.loginButtonLabel}}
- @loginDisabled={{this.loginDisabled}}
- @showSignupLink={{this.showSignupLink}}
- @createAccount={{this.createAccount}}
- @loggingIn={{this.loggingIn}}
- @showSecondFactor={{this.showSecondFactor}}
- />
- {{/if}}
- </div>
- {{/if}}
-
- {{#if (and this.showLoginButtons this.site.desktopView)}}
- {{#unless this.canLoginLocal}}
- <div class="login-left-side">
- <WelcomeHeader @header={{i18n "login.header_title"}} />
- </div>
- {{/unless}}
- {{#if this.hasAtLeastOneLoginButton}}
- <div class="login-right-side">
- <LoginButtons
- @externalLogin={{this.externalLoginAction}}
- @passkeyLogin={{this.passkeyLogin}}
- @context="login"
- />
- </div>
{{/if}}
- {{/if}}
+ </div>
{{/if}}
- {{#if this.site.mobileView}}
- {{#unless this.hasNoLoginOptions}}
- <LoginPageCta
- @canLoginLocal={{this.canLoginLocal}}
- @showSecurityKey={{this.showSecurityKey}}
- @login={{this.triggerLogin}}
- @loginButtonLabel={{this.loginButtonLabel}}
- @loginDisabled={{this.loginDisabled}}
- @showSignupLink={{this.showSignupLink}}
- @createAccount={{this.createAccount}}
- @loggingIn={{this.loggingIn}}
- @showSecondFactor={{this.showSecondFactor}}
- />
+ {{#if (and this.showLoginButtons this.site.desktopView)}}
+ {{#unless this.canLoginLocal}}
+ <div class="login-left-side">
+ <WelcomeHeader @header={{i18n "login.header_title"}} />
+ </div>
{{/unless}}
+ {{#if this.hasAtLeastOneLoginButton}}
+ <div class="login-right-side">
+ <LoginButtons
+ @externalLogin={{this.externalLoginAction}}
+ @passkeyLogin={{this.passkeyLogin}}
+ @context="login"
+ />
+ </div>
+ {{/if}}
{{/if}}
- </div>
- </div>
+ {{/if}}
- {{else}}
- {{body-class "static-login"}}
- <section class="container">
- <div class="contents clearfix body-page">
- <div class="login-welcome">
- <PluginOutlet
- @name="above-login"
- @outletArgs={{hash model=this.model}}
+ {{#if this.site.mobileView}}
+ {{#unless this.hasNoLoginOptions}}
+ <LoginPageCta
+ @canLoginLocal={{this.canLoginLocal}}
+ @showSecurityKey={{this.showSecurityKey}}
+ @login={{this.triggerLogin}}
+ @loginButtonLabel={{this.loginButtonLabel}}
+ @loginDisabled={{this.loginDisabled}}
+ @showSignupLink={{this.showSignupLink}}
+ @createAccount={{this.createAccount}}
+ @loggingIn={{this.loggingIn}}
+ @showSecondFactor={{this.showSecondFactor}}
/>
- <PluginOutlet @name="above-static" />
+ {{/unless}}
+ {{/if}}
+ </div>
+ </div>
- <div class="login-content">
- {{html-safe this.model.html}}
- </div>
+{{else}}
+ {{body-class "static-login"}}
+ <section class="container">
+ <div class="contents clearfix body-page">
+ <div class="login-welcome">
+ <PluginOutlet
+ @name="above-login"
+ @outletArgs={{hash model=this.model}}
+ />
+ <PluginOutlet @name="above-static" />
- <PluginOutlet @name="below-static" />
- <PluginOutlet
- @name="below-login"
- @outletArgs={{hash model=this.model}}
- />
+ <div class="login-content">
+ {{html-safe this.model.html}}
+ </div>
- <div class="body-page-button-container">
- {{#if this.application.canSignUp}}
- <DButton
- @action={{route-action "showCreateAccount"}}
- @label="sign_up"
- class="btn-primary sign-up-button"
- />
- {{/if}}
+ <PluginOutlet @name="below-static" />
+ <PluginOutlet
+ @name="below-login"
+ @outletArgs={{hash model=this.model}}
+ />
+ <div class="body-page-button-container">
+ {{#if this.application.canSignUp}}
<DButton
- @action={{if
- this.shouldTriggerRouteAction
- (route-action "showLogin")
- this.showFullPageLogin
- }}
- @icon="user"
- @label="log_in"
- class="btn-primary login-button"
+ @action={{route-action "showCreateAccount"}}
+ @label="sign_up"
+ class="btn-primary sign-up-button"
/>
- </div>
+ {{/if}}
+
+ <DButton
+ @action={{if
+ this.shouldTriggerRouteAction
+ (route-action "showLogin")
+ this.showFullPageLogin
+ }}
+ @icon="user"
+ @label="log_in"
+ class="btn-primary login-button"
+ />
</div>
</div>
- </section>
- {{/if}}
+ </div>
+ </section>
{{/if}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/templates/signup.hbs b/app/assets/javascripts/discourse/app/templates/signup.hbs
index 0c8091a596c..e68ddd160b7 100644
--- a/app/assets/javascripts/discourse/app/templates/signup.hbs
+++ b/app/assets/javascripts/discourse/app/templates/signup.hbs
@@ -2,294 +2,286 @@
{{hide-application-header-buttons "search" "login" "signup" "menu"}}
{{hide-application-sidebar}}
{{body-class "signup-page"}}
+<div class="signup-fullpage">
+ <FlashMessage @flash={{this.flash}} @type={{this.flashType}} />
-{{#if this.isRedirecting}}
- {{loading-spinner}}
-{{else}}
- <div class="signup-fullpage">
- <FlashMessage @flash={{this.flash}} @type={{this.flashType}} />
+ <div class={{concat-class "signup-body" this.bodyClasses}}>
+ <PluginOutlet
+ @name="create-account-before-modal-body"
+ @connectorTagName="div"
+ />
- <div class={{concat-class "signup-body" this.bodyClasses}}>
- <PluginOutlet
- @name="create-account-before-modal-body"
- @connectorTagName="div"
- />
-
- <div
- class={{concat-class
- (if this.site.desktopView "login-left-side")
- this.authOptions.auth_provider
- }}
+ <div
+ class={{concat-class
+ (if this.site.desktopView "login-left-side")
+ this.authOptions.auth_provider
+ }}
+ >
+ <SignupProgressBar @step="signup" />
+ <WelcomeHeader
+ id="create-account-title"
+ @header={{i18n "create_account.header_title"}}
>
- <SignupProgressBar @step="signup" />
- <WelcomeHeader
- id="create-account-title"
- @header={{i18n "create_account.header_title"}}
- >
- <PluginOutlet
- @name="create-account-header-bottom"
- @outletArgs={{hash showLogin=(route-action "showLogin")}}
- />
- </WelcomeHeader>
- {{#if this.showCreateForm}}
- <form id="login-form">
- {{#if this.associateHtml}}
- <div class="input-group create-account-associate-link">
- <span>{{html-safe this.associateHtml}}</span>
- </div>
- {{/if}}
- <div class="input-group create-account-email">
- <Input
- {{on "focusout" this.checkEmailAvailability}}
- {{on "focusin" this.scrollInputIntoView}}
- @type="email"
- @value={{this.accountEmail}}
- disabled={{this.emailDisabled}}
- autofocus="autofocus"
- aria-describedby="account-email-validation account-email-validation-more-info"
- aria-invalid={{this.emailValidation.failed}}
- name="email"
- id="new-account-email"
- class={{value-entered this.accountEmail}}
- />
- <label class="alt-placeholder" for="new-account-email">
- {{i18n "user.email.title"}}
- </label>
- {{#if this.showEmailValidation}}
- <InputTip
- @validation={{this.emailValidation}}
- id="account-email-validation"
- />
- {{else}}
- <span class="more-info" id="account-email-validation-more-info">
- {{#if this.siteSettings.show_signup_form_email_instructions}}
- {{i18n "user.email.instructions"}}
- {{/if}}
- </span>
- {{/if}}
+ <PluginOutlet
+ @name="create-account-header-bottom"
+ @outletArgs={{hash showLogin=(route-action "showLogin")}}
+ />
+ </WelcomeHeader>
+ {{#if this.showCreateForm}}
+ <form id="login-form">
+ {{#if this.associateHtml}}
+ <div class="input-group create-account-associate-link">
+ <span>{{html-safe this.associateHtml}}</span>
</div>
-
- <div class="input-group create-account__username">
- <Input
- {{on "focusin" this.scrollInputIntoView}}
- @value={{this.accountUsername}}
- disabled={{this.usernameDisabled}}
- maxlength={{this.maxUsernameLength}}
- aria-describedby="username-validation username-validation-more-info"
- aria-invalid={{this.usernameValidation.failed}}
- autocomplete="off"
- name="username"
- id="new-account-username"
- class={{value-entered this.accountUsername}}
+ {{/if}}
+ <div class="input-group create-account-email">
+ <Input
+ {{on "focusout" this.checkEmailAvailability}}
+ {{on "focusin" this.scrollInputIntoView}}
+ @type="email"
+ @value={{this.accountEmail}}
+ disabled={{this.emailDisabled}}
+ autofocus="autofocus"
+ aria-describedby="account-email-validation account-email-validation-more-info"
+ aria-invalid={{this.emailValidation.failed}}
+ name="email"
+ id="new-account-email"
+ class={{value-entered this.accountEmail}}
+ />
+ <label class="alt-placeholder" for="new-account-email">
+ {{i18n "user.email.title"}}
+ </label>
+ {{#if this.showEmailValidation}}
+ <InputTip
+ @validation={{this.emailValidation}}
+ id="account-email-validation"
/>
- <label class="alt-placeholder" for="new-account-username">
- {{i18n "user.username.title"}}
- </label>
+ {{else}}
+ <span class="more-info" id="account-email-validation-more-info">
+ {{#if this.siteSettings.show_signup_form_email_instructions}}
+ {{i18n "user.email.instructions"}}
+ {{/if}}
+ </span>
+ {{/if}}
+ </div>
- {{#if this.showUsernameInstructions}}
- <span class="more-info" id="username-validation-more-info">
- {{i18n "user.username.instructions"}}
- </span>
+ <div class="input-group create-account__username">
+ <Input
+ {{on "focusin" this.scrollInputIntoView}}
+ @value={{this.accountUsername}}
+ disabled={{this.usernameDisabled}}
+ maxlength={{this.maxUsernameLength}}
+ aria-describedby="username-validation username-validation-more-info"
+ aria-invalid={{this.usernameValidation.failed}}
+ autocomplete="off"
+ name="username"
+ id="new-account-username"
+ class={{value-entered this.accountUsername}}
+ />
+ <label class="alt-placeholder" for="new-account-username">
+ {{i18n "user.username.title"}}
+ </label>
- {{else}}
- <InputTip
- @validation={{this.usernameValidation}}
- id="username-validation"
- />
- {{/if}}
- </div>
+ {{#if this.showUsernameInstructions}}
+ <span class="more-info" id="username-validation-more-info">
+ {{i18n "user.username.instructions"}}
+ </span>
- {{#if (and this.showFullname this.fullnameRequired)}}
- <FullnameInput
- @nameValidation={{this.nameValidation}}
- @nameTitle={{this.nameTitle}}
- @accountName={{this.accountName}}
- @nameDisabled={{this.nameDisabled}}
- @onFocusIn={{this.scrollInputIntoView}}
- class="input-group create-account__fullname required"
+ {{else}}
+ <InputTip
+ @validation={{this.usernameValidation}}
+ id="username-validation"
/>
{{/if}}
+ </div>
- <PluginOutlet
- @name="create-account-before-password"
- @outletArgs={{hash
- accountName=this.accountName
- accountUsername=this.accountUsername
- accountPassword=this.accountPassword
- userFields=this.userFields
- authOptions=this.authOptions
- }}
+ {{#if (and this.showFullname this.fullnameRequired)}}
+ <FullnameInput
+ @nameValidation={{this.nameValidation}}
+ @nameTitle={{this.nameTitle}}
+ @accountName={{this.accountName}}
+ @nameDisabled={{this.nameDisabled}}
+ @onFocusIn={{this.scrollInputIntoView}}
+ class="input-group create-account__fullname required"
/>
+ {{/if}}
- <div class="input-group create-account__password">
- {{#if this.passwordRequired}}
- <PasswordField
- {{on "focusout" this.togglePasswordValidation}}
- {{on "focusin" this.scrollInputIntoView}}
- @value={{this.accountPassword}}
- @capsLockOn={{this.capsLockOn}}
- type={{if this.maskPassword "password" "text"}}
- autocomplete="current-password"
- aria-describedby="password-validation password-validation-more-info"
- aria-invalid={{this.passwordValidation.failed}}
- id="new-account-password"
- class={{value-entered this.accountPassword}}
- />
- <label class="alt-placeholder" for="new-account-password">
- {{i18n "user.password.title"}}
- </label>
- <TogglePasswordMask
- @maskPassword={{this.maskPassword}}
- @togglePasswordMask={{this.togglePasswordMask}}
- />
- <div class="create-account__password-info">
- <div class="create-account__password-tip-validation">
- {{#if this.showPasswordValidation}}
- <InputTip
- @validation={{this.passwordValidation}}
- id="password-validation"
- />
- {{else if
- this.siteSettings.show_signup_form_password_instructions
+ <PluginOutlet
+ @name="create-account-before-password"
+ @outletArgs={{hash
+ accountName=this.accountName
+ accountUsername=this.accountUsername
+ accountPassword=this.accountPassword
+ userFields=this.userFields
+ authOptions=this.authOptions
+ }}
+ />
+
+ <div class="input-group create-account__password">
+ {{#if this.passwordRequired}}
+ <PasswordField
+ {{on "focusout" this.togglePasswordValidation}}
+ {{on "focusin" this.scrollInputIntoView}}
+ @value={{this.accountPassword}}
+ @capsLockOn={{this.capsLockOn}}
+ type={{if this.maskPassword "password" "text"}}
+ autocomplete="current-password"
+ aria-describedby="password-validation password-validation-more-info"
+ aria-invalid={{this.passwordValidation.failed}}
+ id="new-account-password"
+ class={{value-entered this.accountPassword}}
+ />
+ <label class="alt-placeholder" for="new-account-password">
+ {{i18n "user.password.title"}}
+ </label>
+ <TogglePasswordMask
+ @maskPassword={{this.maskPassword}}
+ @togglePasswordMask={{this.togglePasswordMask}}
+ />
+ <div class="create-account__password-info">
+ <div class="create-account__password-tip-validation">
+ {{#if this.showPasswordValidation}}
+ <InputTip
+ @validation={{this.passwordValidation}}
+ id="password-validation"
+ />
+ {{else if
+ this.siteSettings.show_signup_form_password_instructions
+ }}
+ <span class="more-info" id="password-validation-more-info">
+ {{this.passwordInstructions}}
+ </span>
+ {{/if}}
+ <div
+ class={{concat-class
+ "caps-lock-warning"
+ (unless this.capsLockOn "hidden")
}}
- <span
- class="more-info"
- id="password-validation-more-info"
- >
- {{this.passwordInstructions}}
- </span>
- {{/if}}
- <div
- class={{concat-class
- "caps-lock-warning"
- (unless this.capsLockOn "hidden")
- }}
- >
- {{d-icon "triangle-exclamation"}}
- {{i18n "login.caps_lock_warning"}}
- </div>
+ >
+ {{d-icon "triangle-exclamation"}}
+ {{i18n "login.caps_lock_warning"}}
</div>
</div>
- {{/if}}
-
- <div class="password-confirmation">
- <label for="new-account-password-confirmation">
- {{i18n "user.password_confirmation.title"}}
- </label>
- <HoneypotInput
- @id="new-account-confirmation"
- @autocomplete="new-password"
- @value={{this.accountHoneypot}}
- />
- <Input
- @value={{this.accountChallenge}}
- id="new-account-challenge"
- />
- </div>
- </div>
-
- {{#if this.requireInviteCode}}
- <div class="input-group create-account__invite-code">
- <Input
- {{on "focusin" this.scrollInputIntoView}}
- @value={{this.inviteCode}}
- id="inviteCode"
- class={{value-entered this.inviteCode}}
- />
- <label class="alt-placeholder" for="invite-code">
- {{i18n "user.invite_code.title"}}
- </label>
- <span class="more-info">
- {{i18n "user.invite_code.instructions"}}
- </span>
</div>
{{/if}}
- <PluginOutlet
- @name="create-account-after-password"
- @outletArgs={{hash
- accountName=this.accountName
- accountUsername=this.accountUsername
- accountPassword=this.accountPassword
- userFields=this.userFields
- }}
- />
+ <div class="password-confirmation">
+ <label for="new-account-password-confirmation">
+ {{i18n "user.password_confirmation.title"}}
+ </label>
+ <HoneypotInput
+ @id="new-account-confirmation"
+ @autocomplete="new-password"
+ @value={{this.accountHoneypot}}
+ />
+ <Input
+ @value={{this.accountChallenge}}
+ id="new-account-challenge"
+ />
+ </div>
+ </div>
- {{#if (and this.showFullname (not this.fullnameRequired))}}
- <FullnameInput
- @nameValidation={{this.nameValidation}}
- @nameTitle={{this.nameTitle}}
- @accountName={{this.accountName}}
- @nameDisabled={{this.nameDisabled}}
- @onFocusIn={{this.scrollInputIntoView}}
- class="input-group create-account__fullname"
+ {{#if this.requireInviteCode}}
+ <div class="input-group create-account__invite-code">
+ <Input
+ {{on "focusin" this.scrollInputIntoView}}
+ @value={{this.inviteCode}}
+ id="inviteCode"
+ class={{value-entered this.inviteCode}}
/>
- {{/if}}
+ <label class="alt-placeholder" for="invite-code">
+ {{i18n "user.invite_code.title"}}
+ </label>
+ <span class="more-info">
+ {{i18n "user.invite_code.instructions"}}
+ </span>
+ </div>
+ {{/if}}
- {{#if this.userFields}}
- <div class="user-fields">
- {{#each this.userFields as |f|}}
- <div class="input-group">
- <UserField
- {{on "focusin" this.scrollInputIntoView}}
- @field={{f.field}}
- @value={{f.value}}
- @validation={{f.validation}}
- class={{value-entered f.value}}
- />
- </div>
- {{/each}}
- </div>
- {{/if}}
+ <PluginOutlet
+ @name="create-account-after-password"
+ @outletArgs={{hash
+ accountName=this.accountName
+ accountUsername=this.accountUsername
+ accountPassword=this.accountPassword
+ userFields=this.userFields
+ }}
+ />
- <PluginOutlet
- @name="create-account-after-user-fields"
- @outletArgs={{hash
- accountName=this.accountName
- accountUsername=this.accountUsername
- accountPassword=this.accountPassword
- userFields=this.userFields
- }}
+ {{#if (and this.showFullname (not this.fullnameRequired))}}
+ <FullnameInput
+ @nameValidation={{this.nameValidation}}
+ @nameTitle={{this.nameTitle}}
+ @accountName={{this.accountName}}
+ @nameDisabled={{this.nameDisabled}}
+ @onFocusIn={{this.scrollInputIntoView}}
+ class="input-group create-account__fullname"
/>
- </form>
+ {{/if}}
- {{#if this.site.desktopView}}
- <SignupPageCta
- @formSubmitted={{this.formSubmitted}}
- @hasAuthOptions={{this.hasAuthOptions}}
- @createAccount={{this.createAccount}}
- @submitDisabled={{this.submitDisabled}}
- @disclaimerHtml={{this.disclaimerHtml}}
- />
+ {{#if this.userFields}}
+ <div class="user-fields">
+ {{#each this.userFields as |f|}}
+ <div class="input-group">
+ <UserField
+ {{on "focusin" this.scrollInputIntoView}}
+ @field={{f.field}}
+ @value={{f.value}}
+ @validation={{f.validation}}
+ class={{value-entered f.value}}
+ />
+ </div>
+ {{/each}}
+ </div>
{{/if}}
- {{/if}}
- {{#if this.skipConfirmation}}
- {{loading-spinner size="large"}}
- {{/if}}
- </div>
+ <PluginOutlet
+ @name="create-account-after-user-fields"
+ @outletArgs={{hash
+ accountName=this.accountName
+ accountUsername=this.accountUsername
+ accountPassword=this.accountPassword
+ userFields=this.userFields
+ }}
+ />
+ </form>
- {{#if this.hasAtLeastOneLoginButton}}
- {{#if this.site.mobileView}}
- <div class="login-or-separator"><span>
- {{i18n "login.or"}}</span></div>{{/if}}
- <div class="login-right-side">
- <LoginButtons
- @externalLogin={{this.externalLogin}}
- @context="create-account"
+ {{#if this.site.desktopView}}
+ <SignupPageCta
+ @formSubmitted={{this.formSubmitted}}
+ @hasAuthOptions={{this.hasAuthOptions}}
+ @createAccount={{this.createAccount}}
+ @submitDisabled={{this.submitDisabled}}
+ @disclaimerHtml={{this.disclaimerHtml}}
/>
- </div>
+ {{/if}}
{{/if}}
- {{#if (and this.showCreateForm this.site.mobileView)}}
- <SignupPageCta
- @formSubmitted={{this.formSubmitted}}
- @hasAuthOptions={{this.hasAuthOptions}}
- @createAccount={{this.createAccount}}
- @submitDisabled={{this.submitDisabled}}
- @disclaimerHtml={{this.disclaimerHtml}}
- />
+ {{#if this.skipConfirmation}}
+ {{loading-spinner size="large"}}
{{/if}}
</div>
+
+ {{#if this.hasAtLeastOneLoginButton}}
+ {{#if this.site.mobileView}}
+ <div class="login-or-separator"><span>
+ {{i18n "login.or"}}</span></div>{{/if}}
+ <div class="login-right-side">
+ <LoginButtons
+ @externalLogin={{this.externalLogin}}
+ @context="create-account"
+ />
+ </div>
+ {{/if}}
+
+ {{#if (and this.showCreateForm this.site.mobileView)}}
+ <SignupPageCta
+ @formSubmitted={{this.formSubmitted}}
+ @hasAuthOptions={{this.hasAuthOptions}}
+ @createAccount={{this.createAccount}}
+ @submitDisabled={{this.submitDisabled}}
+ @disclaimerHtml={{this.disclaimerHtml}}
+ />
+ {{/if}}
</div>
-{{/if}}
\ No newline at end of file
+</div>
\ No newline at end of file
diff --git a/spec/system/social_authentication_spec.rb b/spec/system/social_authentication_spec.rb
index 64deab2a676..908726e9647 100644
--- a/spec/system/social_authentication_spec.rb
+++ b/spec/system/social_authentication_spec.rb
@@ -232,34 +232,6 @@ shared_examples "social authentication scenarios" do |signup_page_object, login_
expect(page).to have_css(".header-dropdown-toggle.current-user")
end
end
-
- context "when there is only one external login method enabled" do
- before do
- SiteSetting.enable_google_oauth2_logins = true
- SiteSetting.enable_local_logins = false
- end
- after { reset_omniauth_config(:google_oauth2) }
-
- it "automatically redirects to the external auth provider" do
- mock_google_auth
- visit("/login")
-
- expect(signup_form).to be_open
- expect(signup_form).to have_no_password_input
- expect(signup_form).to have_valid_username
- expect(signup_form).to have_valid_email
- signup_form.click_create_account
- expect(page).to have_css(".header-dropdown-toggle.current-user")
- end
-
- it "automatically redirects to the external auth provider when skipping the signup form" do
- SiteSetting.auth_skip_create_confirm = true
- mock_google_auth
- visit("/login")
-
- expect(page).to have_css(".header-dropdown-toggle.current-user")
- end
- end
end
context "when user exists" do