mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
commit
6d9f2571a1
2 changed files with 12 additions and 4 deletions
|
@ -23,6 +23,14 @@ var SigninRoute = Ember.Route.extend(styleBody, {
|
||||||
headers: {'X-CSRF-Token': this.get('csrf')},
|
headers: {'X-CSRF-Token': this.get('csrf')},
|
||||||
data: data
|
data: data
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
|
// once the email and password are pulled from the controller
|
||||||
|
// they need to be cleared, or they will reappear next time the signin
|
||||||
|
// page is visited
|
||||||
|
controller.setProperties({
|
||||||
|
email: '',
|
||||||
|
password: ''
|
||||||
|
});
|
||||||
|
|
||||||
self.store.pushPayload({users: [response.userData]});
|
self.store.pushPayload({users: [response.userData]});
|
||||||
return self.store.find('user', response.userData.id);
|
return self.store.find('user', response.userData.id);
|
||||||
}).then(function (user) {
|
}).then(function (user) {
|
||||||
|
|
|
@ -254,11 +254,11 @@ adminControllers = {
|
||||||
loginSecurity.push({ip: remoteAddress, time: currentTime});
|
loginSecurity.push({ip: remoteAddress, time: currentTime});
|
||||||
api.users.check({email: req.body.email, pw: req.body.password}).then(function (user) {
|
api.users.check({email: req.body.email, pw: req.body.password}).then(function (user) {
|
||||||
// Carry over the csrf secret
|
// Carry over the csrf secret
|
||||||
var existingSecret = req.session._csrfSecret;
|
var existingSecret = req.session.csrfSecret;
|
||||||
|
|
||||||
req.session.regenerate(function (err) {
|
req.session.regenerate(function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
req.session._csrfSecret = existingSecret;
|
req.session.csrfSecret = existingSecret;
|
||||||
|
|
||||||
req.session.user = user.id;
|
req.session.user = user.id;
|
||||||
req.session.userData = user.attributes;
|
req.session.userData = user.attributes;
|
||||||
|
@ -339,13 +339,13 @@ adminControllers = {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Carry over the csrf secret
|
// Carry over the csrf secret
|
||||||
existingSecret = req.session._csrfSecret;
|
existingSecret = req.session.csrfSecret;
|
||||||
req.session.regenerate(function (err) {
|
req.session.regenerate(function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
req.session._csrfSecret = existingSecret;
|
req.session.csrfSecret = existingSecret;
|
||||||
|
|
||||||
if (req.session.user === undefined) {
|
if (req.session.user === undefined) {
|
||||||
req.session.user = user.id;
|
req.session.user = user.id;
|
||||||
|
|
Loading…
Add table
Reference in a new issue