mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-02 16:09:59 -04:00
Merge branch 'gitlab_snippets' of https://github.com/jccrofty30/hackmd into jccrofty30-gitlab_snippets
# Conflicts: # lib/response.js
This commit is contained in:
commit
8a01b7242c
8 changed files with 348 additions and 6 deletions
18
lib/auth.js
18
lib/auth.js
|
@ -19,13 +19,23 @@ function callback(accessToken, refreshToken, profile, done) {
|
|||
profileid: profile.id.toString()
|
||||
},
|
||||
defaults: {
|
||||
profile: JSON.stringify(profile)
|
||||
profile: JSON.stringify(profile),
|
||||
accessToken: accessToken,
|
||||
refreshToken: refreshToken
|
||||
}
|
||||
}).spread(function(user, created) {
|
||||
if (user) {
|
||||
if (config.debug)
|
||||
logger.info('user login: ' + user.id);
|
||||
return done(null, user);
|
||||
if(user.accessToken == accessToken){
|
||||
if (config.debug)
|
||||
logger.info('user login: ' + user.id);
|
||||
return done(null, user);
|
||||
}
|
||||
user.accessToken = accessToken;
|
||||
user.save().then(function(){
|
||||
if (config.debug)
|
||||
logger.info('user login: ' + user.id);
|
||||
return done(null, user);
|
||||
})
|
||||
}
|
||||
}).catch(function(err) {
|
||||
logger.error('auth callback failed: ' + err);
|
||||
|
|
|
@ -23,6 +23,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||
},
|
||||
history: {
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
accessToken: {
|
||||
type: DataTypes.STRING
|
||||
}
|
||||
}, {
|
||||
classMethods: {
|
||||
|
@ -75,6 +78,6 @@ module.exports = function (sequelize, DataTypes) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return User;
|
||||
};
|
|
@ -126,7 +126,11 @@ function responseHackMD(res, note) {
|
|||
twitter: config.twitter,
|
||||
github: config.github,
|
||||
gitlab: config.gitlab,
|
||||
<<<<<<< HEAD
|
||||
dropbox: config.dropbox
|
||||
=======
|
||||
dropbox: config.dropbox,
|
||||
>>>>>>> 930afdc33738a487bd9e596c5d35bc9f686eaaa1
|
||||
});
|
||||
var buf = html;
|
||||
res.writeHead(200, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue