mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Signin after Signup
closes #3125 - added manual authentication after signin - added manual authentication after setup
This commit is contained in:
parent
9550205d33
commit
1c226dca60
@ -27,18 +27,17 @@ var SetupController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
'X-CSRF-Token': self.get('csrf')
|
||||
},
|
||||
data: self.getProperties('blogTitle', 'name', 'email', 'password')
|
||||
}).then(function (resp) {
|
||||
self.toggleProperty('submitting');
|
||||
if (resp && resp.userData) {
|
||||
self.store.pushPayload({ users: [resp.userData]});
|
||||
self.store.find('user', resp.userData.id).then(function (user) {
|
||||
}).then(function () {
|
||||
self.get('session').authenticate('ember-simple-auth-authenticator:oauth2-password-grant', {
|
||||
identification: self.get('email'),
|
||||
password: self.get('password')
|
||||
}).then(function () {
|
||||
self.store.find('user', 'me').then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
self.notifications.clear();
|
||||
self.transitionToRoute('posts');
|
||||
self.transitionToRoute(Ember.SimpleAuth.routeAfterAuthentication);
|
||||
});
|
||||
} else {
|
||||
self.transitionToRoute('setup');
|
||||
}
|
||||
});
|
||||
}, function (resp) {
|
||||
self.toggleProperty('submitting');
|
||||
self.notifications.showAPIError(resp);
|
||||
|
@ -26,17 +26,17 @@ var SignupController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
'X-CSRF-Token': self.get('csrf')
|
||||
},
|
||||
data: self.getProperties('name', 'email', 'password')
|
||||
}).then(function (resp) {
|
||||
self.toggleProperty('submitting');
|
||||
if (resp && resp.userData) {
|
||||
self.store.pushPayload({ users: [resp.userData]});
|
||||
self.store.find('user', resp.userData.id).then(function (user) {
|
||||
}).then(function () {
|
||||
self.get('session').authenticate('ember-simple-auth-authenticator:oauth2-password-grant', {
|
||||
identification: self.get('email'),
|
||||
password: self.get('password')
|
||||
}).then(function () {
|
||||
self.store.find('user', 'me').then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
self.transitionToRoute('posts');
|
||||
self.notifications.clear();
|
||||
self.transitionToRoute(Ember.SimpleAuth.routeAfterAuthentication);
|
||||
});
|
||||
} else {
|
||||
self.transitionToRoute('signin');
|
||||
}
|
||||
});
|
||||
}, function (resp) {
|
||||
self.toggleProperty('submitting');
|
||||
self.notifications.showAPIError(resp);
|
||||
|
Loading…
Reference in New Issue
Block a user