mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +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',
|
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;
|
export default SigninController;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<section class="login-box js-login-box fade-in">
|
<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">
|
<div class="email-wrap">
|
||||||
{{input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus" autocapitalize="off" autocorrect="off" value=identification}}
|
{{input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus" autocapitalize="off" autocorrect="off" value=identification}}
|
||||||
</div>
|
</div>
|
||||||
<div class="password-wrap">
|
<div class="password-wrap">
|
||||||
{{input class="password" type="password" placeholder="Password" name="password" value=password}}
|
{{input class="password" type="password" placeholder="Password" name="password" value=password}}
|
||||||
</div>
|
</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">
|
<section class="meta">
|
||||||
{{#link-to 'forgotten' class="forgotten-password"}}Forgotten password?{{/link-to}}
|
{{#link-to 'forgotten' class="forgotten-password"}}Forgotten password?{{/link-to}}
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user