Merge pull request #4937 from techAPJ/forgot-password-help
FEATURE: offer help on forgot password modal
This commit is contained in:
commit
0829bb8658
|
@ -5,6 +5,7 @@ import { extractError } from 'discourse/lib/ajax-error';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
offerHelp: null,
|
||||
|
||||
@computed('accountEmailOrUsername', 'disabled')
|
||||
submitDisabled(accountEmailOrUsername, disabled) {
|
||||
|
@ -35,8 +36,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
if (data.user_found === true) {
|
||||
key += '_found';
|
||||
this.set('accountEmailOrUsername', '');
|
||||
bootbox.alert(I18n.t(key, {email: escaped, username: escaped}));
|
||||
this.send("closeModal");
|
||||
this.set('offerHelp', I18n.t(key, {email: escaped, username: escaped}));
|
||||
} else {
|
||||
if (data.user_found === false) {
|
||||
key += '_not_found';
|
||||
|
@ -52,6 +52,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
});
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
ok() {
|
||||
this.send('closeModal');
|
||||
},
|
||||
|
||||
help() {
|
||||
this.set('offerHelp', I18n.t('forgot_password.help'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
|||
showCreateAccount: unlessReadOnly('handleShowCreateAccount', I18n.t("read_only_mode.login_disabled")),
|
||||
|
||||
showForgotPassword() {
|
||||
this.controllerFor('forgot-password').set('offerHelp', null);
|
||||
showModal('forgotPassword', { title: 'forgot_password.title' });
|
||||
},
|
||||
|
||||
|
|
|
@ -1,9 +1,25 @@
|
|||
<form>
|
||||
{{#d-modal-body}}
|
||||
<label for='username-or-email'>{{i18n 'forgot_password.invite'}}</label>
|
||||
{{text-field value=accountEmailOrUsername placeholderKey="login.email_placeholder" id="username-or-email" autocorrect="off" autocapitalize="off"}}
|
||||
{{#unless offerHelp}}
|
||||
<label for='username-or-email'>{{i18n 'forgot_password.invite'}}</label>
|
||||
{{text-field value=accountEmailOrUsername placeholderKey="login.email_placeholder" id="username-or-email" autocorrect="off" autocapitalize="off"}}
|
||||
{{else}}
|
||||
{{{offerHelp}}}
|
||||
{{/unless}}
|
||||
{{/d-modal-body}}
|
||||
<div class="modal-footer">
|
||||
<button class='btn btn-large btn-primary' disabled={{submitDisabled}} {{action "submit"}}>{{i18n 'forgot_password.reset'}}</button>
|
||||
{{#unless offerHelp}}
|
||||
{{d-button action="submit"
|
||||
label="forgot_password.reset"
|
||||
disabled=submitDisabled
|
||||
class="btn-primary"}}
|
||||
{{else}}
|
||||
{{d-button class="btn-large btn-primary"
|
||||
label="forgot_password.button_ok"
|
||||
action="ok"}}
|
||||
{{d-button class="btn-large"
|
||||
label="forgot_password.button_help"
|
||||
action="help"}}
|
||||
{{/unless}}
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -1036,6 +1036,9 @@ en:
|
|||
|
||||
complete_username_not_found: "No account matches the username <b>%{username}</b>"
|
||||
complete_email_not_found: "No account matches <b>%{email}</b>"
|
||||
help: "Please contact site administrator."
|
||||
button_ok: "OK"
|
||||
button_help: "Help"
|
||||
login:
|
||||
title: "Log In"
|
||||
username: "User"
|
||||
|
|
Loading…
Reference in New Issue