mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Fix code styles and user refreshToken might need update when accessToken not match
This commit is contained in:
parent
6e9cb49c27
commit
6b521b99d4
1 changed files with 5 additions and 4 deletions
|
@ -23,21 +23,22 @@ function callback(accessToken, refreshToken, profile, done) {
|
|||
accessToken: accessToken,
|
||||
refreshToken: refreshToken
|
||||
}
|
||||
}).spread(function(user, created) {
|
||||
}).spread(function (user, created) {
|
||||
if (user) {
|
||||
if(user.accessToken == accessToken){
|
||||
if (user.accessToken == accessToken) {
|
||||
if (config.debug)
|
||||
logger.info('user login: ' + user.id);
|
||||
return done(null, user);
|
||||
}
|
||||
user.accessToken = accessToken;
|
||||
user.save().then(function(){
|
||||
user.refreshToken = refreshToken;
|
||||
user.save().then(function () {
|
||||
if (config.debug)
|
||||
logger.info('user login: ' + user.id);
|
||||
return done(null, user);
|
||||
})
|
||||
}
|
||||
}).catch(function(err) {
|
||||
}).catch(function (err) {
|
||||
logger.error('auth callback failed: ' + err);
|
||||
return done(err, null);
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue