mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #575 from sharelatex/ja-overleaf-oauth
Allow OAuth based log-ins from Overleaf
This commit is contained in:
commit
1f326f7990
4 changed files with 29 additions and 17 deletions
|
@ -17,23 +17,15 @@ module.exports = UserCreator =
|
|||
createNewUser: (opts, callback)->
|
||||
logger.log opts:opts, "creating new user"
|
||||
user = new User()
|
||||
user.email = opts.email
|
||||
user.holdingAccount = opts.holdingAccount
|
||||
user.ace.syntaxValidation = true
|
||||
|
||||
username = opts.email.match(/^[^@]*/)
|
||||
if opts.first_name? and opts.first_name.length != 0
|
||||
user.first_name = opts.first_name
|
||||
else if username?
|
||||
user.first_name = username[0]
|
||||
else
|
||||
user.first_name = ""
|
||||
|
||||
if opts.last_name?
|
||||
user.last_name = opts.last_name
|
||||
else
|
||||
user.last_name = ""
|
||||
if !opts.first_name? or opts.first_name == ""
|
||||
opts.first_name = username[0]
|
||||
|
||||
for key, value of opts
|
||||
user[key] = value
|
||||
|
||||
user.ace.syntaxValidation = true
|
||||
user.featureSwitches?.pdfng = true
|
||||
|
||||
user.save (err)->
|
||||
|
|
|
@ -59,6 +59,10 @@ UserSchema = new Schema
|
|||
zotero: Boolean
|
||||
}
|
||||
betaProgram: { type:Boolean, default: false}
|
||||
overleaf:
|
||||
id: { type: Number }
|
||||
accessToken: { type: String }
|
||||
refreshToken: { type: String }
|
||||
|
||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: 10)
|
||||
|
||||
|
|
21
services/web/npm-shrinkwrap.json
generated
21
services/web/npm-shrinkwrap.json
generated
|
@ -1509,7 +1509,7 @@
|
|||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"from": "minimatch@^3.0.4",
|
||||
"from": "minimatch@^3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"dev": true
|
||||
},
|
||||
|
@ -1678,7 +1678,7 @@
|
|||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.2.11",
|
||||
"from": "iconv-lite@>=0.2.11 <0.3.0",
|
||||
"from": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz"
|
||||
},
|
||||
"ieee754": {
|
||||
|
@ -1698,7 +1698,7 @@
|
|||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"from": "inherits@>=2.0.1 <2.1.0",
|
||||
"from": "inherits@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
|
||||
},
|
||||
"ini": {
|
||||
|
@ -2847,6 +2847,11 @@
|
|||
"from": "number-is-nan@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz"
|
||||
},
|
||||
"oauth": {
|
||||
"version": "0.9.15",
|
||||
"from": "oauth@>=0.9.0 <0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz"
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.8.2",
|
||||
"from": "oauth-sign@>=0.8.1 <0.9.0",
|
||||
|
@ -3070,6 +3075,11 @@
|
|||
"from": "passport-local@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/passport-local/-/passport-local-1.0.0.tgz"
|
||||
},
|
||||
"passport-oauth2": {
|
||||
"version": "1.4.0",
|
||||
"from": "passport-oauth2@latest",
|
||||
"resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.4.0.tgz"
|
||||
},
|
||||
"passport-saml": {
|
||||
"version": "0.15.0",
|
||||
"from": "passport-saml@>=0.15.0 <0.16.0",
|
||||
|
@ -4292,6 +4302,11 @@
|
|||
"from": "uid-safe@2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.4.tgz"
|
||||
},
|
||||
"uid2": {
|
||||
"version": "0.0.3",
|
||||
"from": "uid2@>=0.0.0 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz"
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.6.0",
|
||||
"from": "underscore@1.6.0",
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
"passport": "^0.3.2",
|
||||
"passport-ldapauth": "^0.6.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"passport-oauth2": "^1.4.0",
|
||||
"passport-saml": "^0.15.0",
|
||||
"pug": "^2.0.0-beta6",
|
||||
"redis": "0.10.1",
|
||||
|
|
Loading…
Reference in a new issue