This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/templates/modal/create-account.hbs
Sam 918a0ea3a4 FIX: use autocomplete="discourse" to disable Chrome address autofill
https://stackoverflow.com/a/47822599/17174

Chrome 63 and up start ignoring `autofill="off"`

Per: https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164

> The tricky part here is that somewhere along the journey of the web autocomplete=off become a default for many form fields, without any real thought being given as to whether or not that was good for users. This doesn't mean there aren't very valid cases where you don't want the browser autofilling data (e.g. on CRM systems), but by and large, we see those as the minority cases. And as a result, we started ignoring autocomplete=off for Chrome Autofill data

So to work around this decision we now explicitly say: autocomplete="discourse"
when we don't want Chrome to randomly fill in addressed (aka. always)
2019-02-20 10:15:59 +11:00

128 lines
5.0 KiB
Handlebars

{{#create-account email=accountEmail disabled=submitDisabled action=(action "createAccount")}}
{{#unless complete}}
{{#d-modal-body title="create_account.title" class=(concat (if hasAtLeastOneLoginButton "has-alt-auth") " " (if userFields "has-user-fields"))}}
{{#unless hasAuthOptions}}
{{login-buttons externalLogin=(action "externalLogin")}}
{{/unless}}
{{#if showCreateForm}}
<div class="login-form">
<form>
<table>
<tr class="input create-account-email">
<td class="label"><label for='new-account-email'>{{i18n 'user.email.title'}}</label></td>
<td>
{{input type="email" value=accountEmail id="new-account-email" disabled=emailValidated name="email" autofocus="autofocus"}}
</td>
</tr>
<tr class="instructions create-account-email">
<td></td>
{{input-tip validation=emailValidation id="account-email-validation"}}
<td><label>{{i18n 'user.email.instructions'}}</label></td>
</tr>
{{#if usernameRequired}}
<tr class="input">
<td class="label"><label for='new-account-username'>{{i18n 'user.username.title'}}</label></td>
<td>
{{input value=accountUsername id="new-account-username" name="username" maxlength=maxUsernameLength autocomplete="discourse"}}
</td>
</tr>
<tr class="instructions">
<td></td>
{{input-tip validation=usernameValidation id="username-validation"}}
<td><label>{{i18n 'user.username.instructions'}}</label></td>
</tr>
{{/if}}
{{#if fullnameRequired}}
<tr class="input">
<td class="label">
<label for='new-account-name'>{{i18n 'user.name.title'}}</label>
</td>
<td>
{{text-field value=accountName id="new-account-name"}}
</td>
</tr>
<tr class="instructions">
<td></td>
{{input-tip validation=nameValidation}}
<td><label>{{nameInstructions}}</label></td>
</tr>
{{/if}}
{{plugin-outlet name="create-account-before-password"
noTags=true
args=(hash accountName=accountName
accountUsername=accountUsername
accountPassword=accountPassword
userFields=userFields)}}
{{#if passwordRequired}}
<tr class="input">
<td class="label"><label for='new-account-password'>{{i18n 'user.password.title'}}</label></td>
<td>
{{password-field value=accountPassword type="password" id="new-account-password" capsLockOn=capsLockOn}}
</td>
</tr>
<tr class="instructions">
<td></td>
{{input-tip validation=passwordValidation}}
<td>
<label>{{passwordInstructions}}</label>
<div class="caps-lock-warning {{unless capsLockOn 'hidden'}}">
{{d-icon "exclamation-triangle"}} {{i18n 'login.caps_lock_warning'}}</div>
</td>
</tr>
{{/if}}
<tr class="password-confirmation">
<td><label for='new-account-password-confirmation'>{{i18n 'user.password_confirmation.title'}}</label></td>
<td>
{{input type="password" value=accountPasswordConfirm id="new-account-confirmation" autocomplete="new-password"}}
{{input value=accountChallenge id="new-account-challenge"}}
</td>
</tr>
{{plugin-outlet name="create-account-after-password"
noTags=true
args=(hash accountName=accountName
accountUsername=accountUsername
accountPassword=accountPassword
userFields=userFields)}}
</table>
{{#if userFields}}
<div class='user-fields'>
{{#each userFields as |f|}}
{{user-field field=f.field value=f.value}}
{{/each}}
</div>
{{/if}}
</form>
</div>
{{/if}}
{{/d-modal-body}}
{{#if showCreateForm}}
<div class="modal-footer">
<button class='btn btn-large btn-primary' disabled={{submitDisabled}} {{action "createAccount"}}>{{i18n 'create_account.title'}}</button>
{{#conditional-loading-spinner condition=formSubmitted size="small"}}
{{#d-button class="btn btn-large" id="login-link" action=(route-action "showLogin")}}
{{i18n "log_in"}}
{{/d-button}}
{{/conditional-loading-spinner}}
<div class='disclaimer'>{{{disclaimerHtml}}}</div>
</div>
{{/if}}
{{/unless}}
{{/create-account}}