DEV: user-preference-page class on solo-perference

This commit is contained in:
awesomerobot 2022-04-12 10:46:57 -04:00 committed by Alan Guo Xiang Tan
parent 7f2743b4b8
commit a47efcd6ec
3 changed files with 243 additions and 237 deletions

View File

@ -1,58 +1,60 @@
<section class="user-preferences solo-preference"> {{#d-section pageClass="user-preferences" tagName=""}}
<form class="form-horizontal"> <section class="user-preferences solo-preference">
<form class="form-horizontal">
<div class="control-group">
<div class="controls">
<h3>{{i18n (if new "user.add_email.title" "user.change_email.title")}}</h3>
</div>
</div>
{{#if success}}
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<div class="instructions"> <h3>{{i18n (if new "user.add_email.title" "user.change_email.title")}}</h3>
<p>{{ successMessage }}</p>
</div>
</div> </div>
</div> </div>
{{else}}
{{#if error}} {{#if success}}
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<div class="alert alert-error">{{errorMessage}}</div> <div class="instructions">
<p>{{ successMessage }}</p>
</div>
</div>
</div>
{{else}}
{{#if error}}
<div class="control-group">
<div class="controls">
<div class="alert alert-error">{{errorMessage}}</div>
</div>
</div>
{{/if}}
<div class="control-group">
<label class="control-label">{{i18n "user.email.title"}}</label>
<div class="controls">
{{text-field value=newEmail id="change-email" classNames="input-xxlarge" autofocus="autofocus"}}
{{input-tip validation=emailValidation}}
</div>
<div class="controls">
<div class="instructions">
{{#if taken}}
{{i18n "user.change_email.taken"}}
{{else}}
{{i18n "user.email.instructions"}}
{{/if}}
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
{{d-button
class="btn-primary"
action=(action "saveEmail")
type="submit"
disabled=saveDisabled
translatedLabel=saveButtonText
}}
</div> </div>
</div> </div>
{{/if}} {{/if}}
<div class="control-group"> </form>
<label class="control-label">{{i18n "user.email.title"}}</label> </section>
<div class="controls"> {{/d-section}}
{{text-field value=newEmail id="change-email" classNames="input-xxlarge" autofocus="autofocus"}}
{{input-tip validation=emailValidation}}
</div>
<div class="controls">
<div class="instructions">
{{#if taken}}
{{i18n "user.change_email.taken"}}
{{else}}
{{i18n "user.email.instructions"}}
{{/if}}
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
{{d-button
class="btn-primary"
action=(action "saveEmail")
type="submit"
disabled=saveDisabled
translatedLabel=saveButtonText
}}
</div>
</div>
{{/if}}
</form>
</section>

View File

@ -1,169 +1,171 @@
<section class="user-preferences solo-preference second-factor"> {{#d-section pageClass="user-preferences" tagName=""}}
{{#conditional-loading-spinner condition=loading}} <section class="user-preferences solo-preference second-factor">
<form class="form-horizontal"> {{#conditional-loading-spinner condition=loading}}
{{#if showEnforcedNotice}} <form class="form-horizontal">
<div class="control-group"> {{#if showEnforcedNotice}}
<div class="controls"> <div class="control-group">
<div class="alert alert-error">{{i18n "user.second_factor.enforced_notice"}}</div> <div class="controls">
</div> <div class="alert alert-error">{{i18n "user.second_factor.enforced_notice"}}</div>
</div>
{{/if}}
{{#if displayOAuthWarning}}
<div class="control-group">
<div class="controls">
{{i18n "user.second_factor.oauth_enabled_warning"}}
</div>
</div>
{{/if}}
{{#if errorMessage}}
<div class="control-group">
<div class="controls">
<div class="alert alert-error">{{errorMessage}}</div>
</div>
</div>
{{/if}}
{{#if loaded}}
<div class="control-group totp">
<div class="controls">
<h2>{{i18n "user.second_factor.totp.title"}}</h2>
{{d-button action=(action "createTotp")
class="btn-primary new-totp"
icon="plus"
disabled=loading
label="user.second_factor.totp.add"}}
{{#each totps as |totp|}}
<div class="second-factor-item">
{{#if totp.name}}
{{totp.name}}
{{else}}
{{i18n "user.second_factor.totp.default_name"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecondFactor" totp)
class="btn-default btn-small btn-icon pad-left no-text edit"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
</div>
{{/each}}
</div>
</div>
<div class="control-group security-key">
<div class="controls">
<h2>{{i18n "user.second_factor.security_key.title"}}</h2>
{{d-button action=(action "createSecurityKey")
class="btn-primary new-security-key"
icon="plus"
disabled=loading
label="user.second_factor.security_key.add"}}
{{#each security_keys as |security_key|}}
<div class="second-factor-item">
{{#if security_key.name}}
{{security_key.name}}
{{else}}
{{i18n "user.second_factor.security_key.default_name"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecurityKey" security_key)
class="btn-default btn-small btn-icon pad-left no-text edit"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
</div>
{{/each}}
</div>
</div>
<div class="control-group pref-second-factor-backup">
<div class="controls pref-second-factor-backup">
<h2>{{i18n "user.second_factor_backup.title"}}</h2>
{{#if model.second_factor_enabled}}
{{#if model.second_factor_backup_enabled}}
{{html-safe (i18n "user.second_factor_backup.manage" count=model.second_factor_remaining_backup_codes)}}
{{else}}
{{i18n "user.second_factor_backup.enable_long"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecondFactorBackup")
class="btn-default btn-small btn-icon pad-left no-text edit edit-2fa-backup"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
{{else}}
{{i18n "user.second_factor_backup.enable_prerequisites"}}
{{/if}}
</div>
</div>
{{#if model.second_factor_enabled}}
{{#unless showEnforcedNotice}}
<div class="control-group">
<div class="controls">
{{d-button
class="btn-danger"
icon="ban"
action=(action "disableAllSecondFactors")
disabled=loading
label="user.second_factor.disable_all"}}
</div>
</div> </div>
{{/unless}} </div>
{{/if}} {{/if}}
{{else}}
<div class="control-group">
<label class="control-label">{{i18n "user.password.title"}}</label>
<div class="controls"> {{#if displayOAuthWarning}}
<div> <div class="control-group">
{{text-field value=password <div class="controls">
id="password" {{i18n "user.second_factor.oauth_enabled_warning"}}
type="password"
classNames="input-large"
autofocus="autofocus"}}
</div>
<div class="instructions">
{{i18n "user.second_factor.confirm_password_description"}}
</div> </div>
</div> </div>
</div> {{/if}}
<div class="control-group"> {{#if errorMessage}}
<div class="controls"> <div class="control-group">
{{d-button <div class="controls">
class="btn-primary" <div class="alert alert-error">{{errorMessage}}</div>
type="submit" </div>
action=(action "confirmPassword") </div>
disabled=loading {{/if}}
label="continue"}}
{{#if loaded}}
<div class="control-group totp">
<div class="controls">
<h2>{{i18n "user.second_factor.totp.title"}}</h2>
{{d-button action=(action "createTotp")
class="btn-primary new-totp"
icon="plus"
disabled=loading
label="user.second_factor.totp.add"}}
{{#each totps as |totp|}}
<div class="second-factor-item">
{{#if totp.name}}
{{totp.name}}
{{else}}
{{i18n "user.second_factor.totp.default_name"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecondFactor" totp)
class="btn-default btn-small btn-icon pad-left no-text edit"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
</div>
{{/each}}
</div>
</div>
<div class="control-group security-key">
<div class="controls">
<h2>{{i18n "user.second_factor.security_key.title"}}</h2>
{{d-button action=(action "createSecurityKey")
class="btn-primary new-security-key"
icon="plus"
disabled=loading
label="user.second_factor.security_key.add"}}
{{#each security_keys as |security_key|}}
<div class="second-factor-item">
{{#if security_key.name}}
{{security_key.name}}
{{else}}
{{i18n "user.second_factor.security_key.default_name"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecurityKey" security_key)
class="btn-default btn-small btn-icon pad-left no-text edit"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
</div>
{{/each}}
</div>
</div>
<div class="control-group pref-second-factor-backup">
<div class="controls pref-second-factor-backup">
<h2>{{i18n "user.second_factor_backup.title"}}</h2>
{{#if model.second_factor_enabled}}
{{#if model.second_factor_backup_enabled}}
{{html-safe (i18n "user.second_factor_backup.manage" count=model.second_factor_remaining_backup_codes)}}
{{else}}
{{i18n "user.second_factor_backup.enable_long"}}
{{/if}}
{{#if isCurrentUser}}
{{d-button action=(action "editSecondFactorBackup")
class="btn-default btn-small btn-icon pad-left no-text edit edit-2fa-backup"
disabled=loading
icon="pencil-alt"
aria-label="user.second_factor.edit"
title="user.second_factor.edit"
}}
{{/if}}
{{else}}
{{i18n "user.second_factor_backup.enable_prerequisites"}}
{{/if}}
</div>
</div>
{{#if model.second_factor_enabled}}
{{#unless showEnforcedNotice}} {{#unless showEnforcedNotice}}
{{cancel-link route="preferences.account" args=model.username}} <div class="control-group">
<div class="controls">
{{d-button
class="btn-danger"
icon="ban"
action=(action "disableAllSecondFactors")
disabled=loading
label="user.second_factor.disable_all"}}
</div>
</div>
{{/unless}} {{/unless}}
{{/if}}
{{else}}
<div class="control-group">
<label class="control-label">{{i18n "user.password.title"}}</label>
<div class="controls">
<div>
{{text-field value=password
id="password"
type="password"
classNames="input-large"
autofocus="autofocus"}}
</div>
<div class="instructions">
{{i18n "user.second_factor.confirm_password_description"}}
</div>
</div>
</div> </div>
<div class="controls" style="margin-top: 5px">
{{resetPasswordProgress}} <div class="control-group">
{{#unless resetPasswordLoading}} <div class="controls">
<a href class="instructions" {{action "resetPassword"}}>{{ i18n "user.second_factor.forgot_password" }}</a> {{d-button
{{/unless}} class="btn-primary"
type="submit"
action=(action "confirmPassword")
disabled=loading
label="continue"}}
{{#unless showEnforcedNotice}}
{{cancel-link route="preferences.account" args=model.username}}
{{/unless}}
</div>
<div class="controls" style="margin-top: 5px">
{{resetPasswordProgress}}
{{#unless resetPasswordLoading}}
<a href class="instructions" {{action "resetPassword"}}>{{ i18n "user.second_factor.forgot_password" }}</a>
{{/unless}}
</div>
</div> </div>
</div> {{/if}}
{{/if}} </form>
</form> {{/conditional-loading-spinner}}
{{/conditional-loading-spinner}} </section>
</section> {{/d-section}}

View File

@ -1,39 +1,41 @@
<section class="user-preferences solo-preference"> {{#d-section pageClass="user-preferences" tagName=""}}
<form class="form-horizontal"> <section class="user-preferences solo-preference">
<form class="form-horizontal">
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<h3>{{i18n "user.change_username.title"}}</h3> <h3>{{i18n "user.change_username.title"}}</h3>
</div>
</div> </div>
</div>
<div class="control-group"> <div class="control-group">
<label for="change_username" class="control-label">{{i18n "user.username.title"}}</label> <label for="change_username" class="control-label">{{i18n "user.username.title"}}</label>
<div class="controls"> <div class="controls">
{{text-field value=newUsername id="change_username" classNames="input-xxlarge" maxlength=maxLength autofocus="autofocus" insert-newline="changeUsername"}} {{text-field value=newUsername id="change_username" classNames="input-xxlarge" maxlength=maxLength autofocus="autofocus" insert-newline="changeUsername"}}
</div>
<div class="instructions controls">
<p>
{{#if taken}}
{{i18n "user.change_username.taken"}}
{{/if}}
<span>{{errorMessage}}</span>
</p>
</div>
</div> </div>
<div class="instructions controls">
<p>
{{#if taken}}
{{i18n "user.change_username.taken"}}
{{/if}}
<span>{{errorMessage}}</span>
</p>
</div>
</div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
{{d-button {{d-button
class="btn-primary" class="btn-primary"
action=(action "changeUsername") action=(action "changeUsername")
type="submit" type="submit"
disabled=saveDisabled disabled=saveDisabled
translatedLabel=saveButtonText translatedLabel=saveButtonText
}} }}
{{#if saved}}{{i18n "saved"}}{{/if}} {{#if saved}}{{i18n "saved"}}{{/if}}
</div>
</div> </div>
</div>
</form> </form>
</section> </section>
{{/d-section}}