mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Merge pull request #3159 from darvelo/signin-validation
Signin Validation
This commit is contained in:
commit
c5771e73bb
@ -1,5 +1,21 @@
|
||||
var SigninController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin, {
|
||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||
|
||||
var SigninController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin, ValidationEngine, {
|
||||
authenticatorFactory: 'ember-simple-auth-authenticator:oauth2-password-grant',
|
||||
|
||||
validationType: 'signin',
|
||||
|
||||
actions: {
|
||||
validateAndAuthenticate: function () {
|
||||
var self = this;
|
||||
|
||||
this.validate({ format: false }).then(function () {
|
||||
self.send('authenticate');
|
||||
}).catch(function (errors) {
|
||||
self.notifications.showErrors(errors);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default SigninController;
|
||||
|
@ -1,12 +1,12 @@
|
||||
<section class="login-box js-login-box fade-in">
|
||||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'authenticate' on='submit'}}>
|
||||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'validateAndAuthenticate' on='submit'}}>
|
||||
<div class="email-wrap">
|
||||
{{input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus" autocapitalize="off" autocorrect="off" value=identification}}
|
||||
</div>
|
||||
<div class="password-wrap">
|
||||
{{input class="password" type="password" placeholder="Password" name="password" value=password}}
|
||||
</div>
|
||||
<button class="button-save" type="submit" {{action "authenticate"}} {{bind-attr disabled=submitting}}>Log in</button>
|
||||
<button class="button-save" type="submit" {{action "validateAndAuthenticate"}} {{bind-attr disabled=submitting}}>Log in</button>
|
||||
<section class="meta">
|
||||
{{#link-to 'forgotten' class="forgotten-password"}}Forgotten password?{{/link-to}}
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user