mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 08:56:36 +08:00
FEATURE: carry username or email from login form to the forgot password and signup forms
This commit is contained in:
parent
7209f67898
commit
def034cd08
|
@ -2,7 +2,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
needs: ['modal', 'createAccount', 'application'],
|
||||
needs: ['modal', 'createAccount', 'forgotPassword', 'application'],
|
||||
authenticate: null,
|
||||
loggingIn: false,
|
||||
loggedIn: false,
|
||||
|
@ -122,8 +122,22 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
|
||||
createAccount: function() {
|
||||
var createAccountController = this.get('controllers.createAccount');
|
||||
createAccountController.resetForm();
|
||||
if (createAccountController) {
|
||||
createAccountController.resetForm();
|
||||
var loginName = this.get('loginName');
|
||||
if (loginName && loginName.indexOf('@') > 0) {
|
||||
createAccountController.set("accountEmail", loginName);
|
||||
} else {
|
||||
createAccountController.set("accountUsername", loginName);
|
||||
}
|
||||
}
|
||||
this.send('showCreateAccount');
|
||||
},
|
||||
|
||||
forgotPassword: function() {
|
||||
var forgotPasswordController = this.get('controllers.forgotPassword');
|
||||
if (forgotPasswordController) { forgotPasswordController.set("accountEmailOrUsername", this.get("loginName")); }
|
||||
this.send("showForgotPassword");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
{{password-field value=loginPassword type="password" id="login-account-password" maxlength="200" capsLockOn=capsLockOn}}
|
||||
</td>
|
||||
<td>
|
||||
<a id="forgot-password-link" {{action "showForgotPassword"}}>{{i18n 'forgot_password.action'}}</a>
|
||||
<a id="forgot-password-link" {{action "forgotPassword"}}>{{i18n 'forgot_password.action'}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue
Block a user