FIX: Signup fields tab order and descriptions (#29772)
This commit is contained in:
parent
276bc8a565
commit
876591fdab
|
@ -0,0 +1,33 @@
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { on } from "@ember/modifier";
|
||||||
|
import InputTip from "discourse/components/input-tip";
|
||||||
|
import TextField from "discourse/components/text-field";
|
||||||
|
import valueEntered from "discourse/helpers/value-entered";
|
||||||
|
|
||||||
|
export default class SidebarEditNavigationMenuTagsModal extends Component {
|
||||||
|
get showFullname() {
|
||||||
|
return (
|
||||||
|
this.siteSettings.full_name_required || this.siteSettings.enable_names
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ...attributes>
|
||||||
|
<TextField
|
||||||
|
{{on "focusin" @onFocusIn}}
|
||||||
|
@disabled={{@nameDisabled}}
|
||||||
|
@value={{@accountName}}
|
||||||
|
@id="new-account-name"
|
||||||
|
aria-describedby="fullname-validation fullname-validation-more-info"
|
||||||
|
aria-invalid={{@nameValidation.failed}}
|
||||||
|
class={{valueEntered @accountName}}
|
||||||
|
name="name"
|
||||||
|
/>
|
||||||
|
<label class="alt-placeholder" for="new-account-name">
|
||||||
|
{{@nameTitle}}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<InputTip @validation={{@nameValidation}} id="fullname-validation" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
}
|
|
@ -95,6 +95,17 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if 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}}
|
||||||
|
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
@name="create-account-before-password"
|
@name="create-account-before-password"
|
||||||
@outletArgs={{hash
|
@outletArgs={{hash
|
||||||
|
@ -200,33 +211,16 @@
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
{{#if (and this.showFullname (not this.fullnameRequired))}}
|
||||||
class={{concat-class
|
<FullnameInput
|
||||||
"input-group"
|
@nameValidation={{this.nameValidation}}
|
||||||
"create-account__fullname"
|
@nameTitle={{this.nameTitle}}
|
||||||
(if this.siteSettings.full_name_required "required")
|
@accountName={{this.accountName}}
|
||||||
}}
|
@nameDisabled={{this.nameDisabled}}
|
||||||
>
|
@onFocusIn={{this.scrollInputIntoView}}
|
||||||
{{#if this.fullnameRequired}}
|
class="input-group create-account__fullname"
|
||||||
<TextField
|
/>
|
||||||
{{on "focusin" this.scrollInputIntoView}}
|
{{/if}}
|
||||||
@disabled={{this.nameDisabled}}
|
|
||||||
@value={{this.model.accountName}}
|
|
||||||
@id="new-account-name"
|
|
||||||
aria-describedby="fullname-validation fullname-validation-more-info"
|
|
||||||
aria-invalid={{this.nameValidation.failed}}
|
|
||||||
class={{value-entered this.model.accountName}}
|
|
||||||
/>
|
|
||||||
<label class="alt-placeholder" for="new-account-name">
|
|
||||||
{{this.nameTitle}}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<InputTip
|
|
||||||
@validation={{this.nameValidation}}
|
|
||||||
id="fullname-validation"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if this.userFields}}
|
{{#if this.userFields}}
|
||||||
<div class="user-fields">
|
<div class="user-fields">
|
||||||
|
|
|
@ -132,11 +132,14 @@ export default class CreateAccount extends Component.extend(
|
||||||
return authOptions && !canEditName;
|
return authOptions && !canEditName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discourseComputed
|
||||||
|
showFullname() {
|
||||||
|
return this.siteSettings.enable_names;
|
||||||
|
}
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
fullnameRequired() {
|
fullnameRequired() {
|
||||||
return (
|
return this.siteSettings.full_name_required;
|
||||||
this.siteSettings.full_name_required || this.siteSettings.enable_names
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed("model.authOptions.auth_provider")
|
@discourseComputed("model.authOptions.auth_provider")
|
||||||
|
|
|
@ -155,11 +155,14 @@ export default class InvitesShowController extends Controller.extend(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discourseComputed
|
||||||
|
showFullname() {
|
||||||
|
return this.siteSettings.enable_names;
|
||||||
|
}
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
fullnameRequired() {
|
fullnameRequired() {
|
||||||
return (
|
return this.siteSettings.full_name_required;
|
||||||
this.siteSettings.full_name_required || this.siteSettings.enable_names
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
|
@ -281,6 +284,14 @@ export default class InvitesShowController extends Controller.extend(
|
||||||
this.toggleProperty("maskPassword");
|
this.toggleProperty("maskPassword");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
scrollInputIntoView(event) {
|
||||||
|
event.target.scrollIntoView({
|
||||||
|
behavior: "smooth",
|
||||||
|
block: "center",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
submit() {
|
submit() {
|
||||||
const userFields = this.userFields;
|
const userFields = this.userFields;
|
||||||
|
|
|
@ -121,11 +121,14 @@ export default class SignupPageController extends Controller.extend(
|
||||||
return authOptions && !canEditName;
|
return authOptions && !canEditName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discourseComputed
|
||||||
|
showFullname() {
|
||||||
|
return this.siteSettings.enable_names;
|
||||||
|
}
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
fullnameRequired() {
|
fullnameRequired() {
|
||||||
return (
|
return this.siteSettings.full_name_required;
|
||||||
this.siteSettings.full_name_required || this.siteSettings.enable_names
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed("authOptions.auth_provider")
|
@discourseComputed("authOptions.auth_provider")
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
{{#if this.isInviteLink}}
|
{{#if this.isInviteLink}}
|
||||||
<div class="input email-input input-group">
|
<div class="input email-input input-group">
|
||||||
<Input
|
<Input
|
||||||
|
{{on "focusin" this.scrollInputIntoView}}
|
||||||
@type="email"
|
@type="email"
|
||||||
@value={{this.email}}
|
@value={{this.email}}
|
||||||
id="new-account-email"
|
id="new-account-email"
|
||||||
|
@ -91,6 +92,7 @@
|
||||||
|
|
||||||
<div class="input username-input input-group">
|
<div class="input username-input input-group">
|
||||||
<Input
|
<Input
|
||||||
|
{{on "focusin" this.scrollInputIntoView}}
|
||||||
@value={{this.accountUsername}}
|
@value={{this.accountUsername}}
|
||||||
class={{value-entered this.accountUsername}}
|
class={{value-entered this.accountUsername}}
|
||||||
id="new-account-username"
|
id="new-account-username"
|
||||||
|
@ -107,9 +109,21 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if this.fullnameRequired}}
|
||||||
|
<FullnameInput
|
||||||
|
@nameValidation={{this.nameValidation}}
|
||||||
|
@nameTitle={{this.nameTitle}}
|
||||||
|
@accountName={{this.accountName}}
|
||||||
|
@nameDisabled={{this.nameDisabled}}
|
||||||
|
@onFocusIn={{this.scrollInputIntoView}}
|
||||||
|
class="input name-input input-group name-required"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#unless this.externalAuthsOnly}}
|
{{#unless this.externalAuthsOnly}}
|
||||||
<div class="input password-input input-group">
|
<div class="input password-input input-group">
|
||||||
<PasswordField
|
<PasswordField
|
||||||
|
{{on "focusin" this.scrollInputIntoView}}
|
||||||
@value={{this.accountPassword}}
|
@value={{this.accountPassword}}
|
||||||
@capsLockOn={{this.capsLockOn}}
|
@capsLockOn={{this.capsLockOn}}
|
||||||
type={{if this.maskPassword "password" "text"}}
|
type={{if this.maskPassword "password" "text"}}
|
||||||
|
@ -143,29 +157,15 @@
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
{{#if this.fullnameRequired}}
|
{{#if (and this.showFullname (not this.fullnameRequired))}}
|
||||||
<div
|
<FullnameInput
|
||||||
class={{concat-class
|
@nameValidation={{this.nameValidation}}
|
||||||
"input"
|
@nameTitle={{this.nameTitle}}
|
||||||
"name-input"
|
@accountName={{this.accountName}}
|
||||||
"input-group"
|
@nameDisabled={{this.nameDisabled}}
|
||||||
(if this.siteSettings.full_name_required "name-required")
|
@onFocusIn={{this.scrollInputIntoView}}
|
||||||
}}
|
class="input name-input input-group"
|
||||||
>
|
/>
|
||||||
<Input
|
|
||||||
@value={{this.accountName}}
|
|
||||||
class={{value-entered this.accountName}}
|
|
||||||
id="new-account-name"
|
|
||||||
name="name"
|
|
||||||
/>
|
|
||||||
<label class="alt-placeholder" for="new-account-name">
|
|
||||||
{{i18n "invites.name_label"}}
|
|
||||||
</label>
|
|
||||||
<InputTip
|
|
||||||
@validation={{this.nameValidation}}
|
|
||||||
id="fullname-validation"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.userFields}}
|
{{#if this.userFields}}
|
||||||
|
@ -173,6 +173,7 @@
|
||||||
{{#each this.userFields as |f|}}
|
{{#each this.userFields as |f|}}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<UserField
|
<UserField
|
||||||
|
{{on "focusin" this.scrollInputIntoView}}
|
||||||
@field={{f.field}}
|
@field={{f.field}}
|
||||||
@value={{f.value}}
|
@value={{f.value}}
|
||||||
class={{value-entered f.value}}
|
class={{value-entered f.value}}
|
||||||
|
|
|
@ -91,6 +91,17 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if 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}}
|
||||||
|
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
@name="create-account-before-password"
|
@name="create-account-before-password"
|
||||||
@outletArgs={{hash
|
@outletArgs={{hash
|
||||||
|
@ -196,33 +207,16 @@
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
{{#if (and this.showFullname (not this.fullnameRequired))}}
|
||||||
class={{concat-class
|
<FullnameInput
|
||||||
"input-group"
|
@nameValidation={{this.nameValidation}}
|
||||||
"create-account__fullname"
|
@nameTitle={{this.nameTitle}}
|
||||||
(if this.siteSettings.full_name_required "required")
|
@accountName={{this.accountName}}
|
||||||
}}
|
@nameDisabled={{this.nameDisabled}}
|
||||||
>
|
@onFocusIn={{this.scrollInputIntoView}}
|
||||||
{{#if this.fullnameRequired}}
|
class="input-group create-account__fullname"
|
||||||
<TextField
|
/>
|
||||||
{{on "focusin" this.scrollInputIntoView}}
|
{{/if}}
|
||||||
@disabled={{this.nameDisabled}}
|
|
||||||
@value={{this.accountName}}
|
|
||||||
@id="new-account-name"
|
|
||||||
aria-describedby="fullname-validation fullname-validation-more-info"
|
|
||||||
aria-invalid={{this.nameValidation.failed}}
|
|
||||||
class={{value-entered this.accountName}}
|
|
||||||
/>
|
|
||||||
<label class="alt-placeholder" for="new-account-name">
|
|
||||||
{{this.nameTitle}}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<InputTip
|
|
||||||
@validation={{this.nameValidation}}
|
|
||||||
id="fullname-validation"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if this.userFields}}
|
{{#if this.userFields}}
|
||||||
<div class="user-fields">
|
<div class="user-fields">
|
||||||
|
|
|
@ -193,14 +193,6 @@ body.signup-page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.input-group {
|
|
||||||
&.create-account-email,
|
|
||||||
&.create-account__username,
|
|
||||||
&.create-account__fullname.required {
|
|
||||||
order: -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-account-associate-link {
|
.create-account-associate-link {
|
||||||
order: 1;
|
order: 1;
|
||||||
}
|
}
|
||||||
|
@ -244,15 +236,6 @@ body.signup-page {
|
||||||
font-size: var(--font-down-1);
|
font-size: var(--font-down-1);
|
||||||
color: var(--primary-medium);
|
color: var(--primary-medium);
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group input:focus {
|
|
||||||
& ~ .more-info,
|
|
||||||
& ~ .instructions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.caps-lock-warning {
|
.caps-lock-warning {
|
||||||
|
|
|
@ -68,13 +68,6 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.input-group {
|
|
||||||
&.create-account-email,
|
|
||||||
&.create-account__username,
|
|
||||||
&.create-account__fullname.required {
|
|
||||||
order: -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.create-account-associate-link {
|
.create-account-associate-link {
|
||||||
order: 1;
|
order: 1;
|
||||||
}
|
}
|
||||||
|
@ -98,15 +91,6 @@
|
||||||
font-size: var(--font-down-1);
|
font-size: var(--font-down-1);
|
||||||
color: var(--primary-medium);
|
color: var(--primary-medium);
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group input:focus {
|
|
||||||
& ~ .more-info,
|
|
||||||
& ~ .instructions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.caps-lock-warning {
|
.caps-lock-warning {
|
||||||
|
|
Loading…
Reference in New Issue