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';
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
|
offerHelp: null,
|
||||||
|
|
||||||
@computed('accountEmailOrUsername', 'disabled')
|
@computed('accountEmailOrUsername', 'disabled')
|
||||||
submitDisabled(accountEmailOrUsername, disabled) {
|
submitDisabled(accountEmailOrUsername, disabled) {
|
||||||
|
@ -35,8 +36,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
if (data.user_found === true) {
|
if (data.user_found === true) {
|
||||||
key += '_found';
|
key += '_found';
|
||||||
this.set('accountEmailOrUsername', '');
|
this.set('accountEmailOrUsername', '');
|
||||||
bootbox.alert(I18n.t(key, {email: escaped, username: escaped}));
|
this.set('offerHelp', I18n.t(key, {email: escaped, username: escaped}));
|
||||||
this.send("closeModal");
|
|
||||||
} else {
|
} else {
|
||||||
if (data.user_found === false) {
|
if (data.user_found === false) {
|
||||||
key += '_not_found';
|
key += '_not_found';
|
||||||
|
@ -52,6 +52,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
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")),
|
showCreateAccount: unlessReadOnly('handleShowCreateAccount', I18n.t("read_only_mode.login_disabled")),
|
||||||
|
|
||||||
showForgotPassword() {
|
showForgotPassword() {
|
||||||
|
this.controllerFor('forgot-password').set('offerHelp', null);
|
||||||
showModal('forgotPassword', { title: 'forgot_password.title' });
|
showModal('forgotPassword', { title: 'forgot_password.title' });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
<form>
|
<form>
|
||||||
{{#d-modal-body}}
|
{{#d-modal-body}}
|
||||||
|
{{#unless offerHelp}}
|
||||||
<label for='username-or-email'>{{i18n 'forgot_password.invite'}}</label>
|
<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"}}
|
{{text-field value=accountEmailOrUsername placeholderKey="login.email_placeholder" id="username-or-email" autocorrect="off" autocapitalize="off"}}
|
||||||
|
{{else}}
|
||||||
|
{{{offerHelp}}}
|
||||||
|
{{/unless}}
|
||||||
{{/d-modal-body}}
|
{{/d-modal-body}}
|
||||||
<div class="modal-footer">
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1036,6 +1036,9 @@ en:
|
||||||
|
|
||||||
complete_username_not_found: "No account matches the username <b>%{username}</b>"
|
complete_username_not_found: "No account matches the username <b>%{username}</b>"
|
||||||
complete_email_not_found: "No account matches <b>%{email}</b>"
|
complete_email_not_found: "No account matches <b>%{email}</b>"
|
||||||
|
help: "Please contact site administrator."
|
||||||
|
button_ok: "OK"
|
||||||
|
button_help: "Help"
|
||||||
login:
|
login:
|
||||||
title: "Log In"
|
title: "Log In"
|
||||||
username: "User"
|
username: "User"
|
||||||
|
|
Loading…
Reference in New Issue