mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Merge pull request #5085 from ErisDS/improved-forgotten
Improve the forgotten password flow
This commit is contained in:
commit
42756b5f44
4 changed files with 29 additions and 5 deletions
|
@ -11,9 +11,12 @@ var ForgottenController = Ember.Controller.extend(ValidationEngine, {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
submit: function () {
|
submit: function () {
|
||||||
var self = this,
|
var data = this.getProperties('email');
|
||||||
data = self.getProperties('email');
|
this.send('doForgotten', data, true);
|
||||||
|
},
|
||||||
|
doForgotten: function (data, delay) {
|
||||||
|
var self = this;
|
||||||
|
this.set('email', data.email);
|
||||||
this.toggleProperty('submitting');
|
this.toggleProperty('submitting');
|
||||||
this.validate({format: false}).then(function () {
|
this.validate({format: false}).then(function () {
|
||||||
ajax({
|
ajax({
|
||||||
|
@ -26,7 +29,7 @@ var ForgottenController = Ember.Controller.extend(ValidationEngine, {
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.toggleProperty('submitting');
|
self.toggleProperty('submitting');
|
||||||
self.notifications.showSuccess('Please check your email for instructions.', {delayed: true});
|
self.notifications.showSuccess('Please check your email for instructions.', {delayed: delay});
|
||||||
self.set('email', '');
|
self.set('email', '');
|
||||||
self.transitionToRoute('signin');
|
self.transitionToRoute('signin');
|
||||||
}).catch(function (resp) {
|
}).catch(function (resp) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import ValidationEngine from 'ghost/mixins/validation-engine';
|
||||||
|
|
||||||
var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControllerMixin, ValidationEngine, {
|
var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControllerMixin, ValidationEngine, {
|
||||||
authenticator: 'simple-auth-authenticator:oauth2-password-grant',
|
authenticator: 'simple-auth-authenticator:oauth2-password-grant',
|
||||||
|
forgotten: Ember.inject.controller(),
|
||||||
|
|
||||||
validationType: 'signin',
|
validationType: 'signin',
|
||||||
|
|
||||||
|
@ -31,6 +32,14 @@ var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControll
|
||||||
}).catch(function (errors) {
|
}).catch(function (errors) {
|
||||||
self.notifications.showErrors(errors);
|
self.notifications.showErrors(errors);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
forgotten: function () {
|
||||||
|
if (this.get('model.identification')) {
|
||||||
|
return this.get('forgotten').send('doForgotten', {email: this.get('model.identification')}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.transitionToRoute('forgotten');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -140,6 +140,18 @@
|
||||||
color: $midgrey;
|
color: $midgrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.forgotten-link {
|
||||||
|
display: inline-block;
|
||||||
|
height: auto;
|
||||||
|
width: auto;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: darken($midgrey, 10%);
|
||||||
|
text-transform: none;
|
||||||
|
letter-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: darken($midgrey, 10%);
|
color: darken($midgrey, 10%);
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-blue" type="submit" {{action "validateAndAuthenticate"}} {{bind-attr disabled=submitting}}>Log in</button>
|
<button class="btn btn-blue" 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}}
|
<button {{action 'forgotten'}} class="forgotten-link btn btn-link">Forgotten password?</button>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Reference in a new issue