mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 10:03:10 +00:00
19 lines
504 B
CoffeeScript
19 lines
504 B
CoffeeScript
User = require("../../models/User").User
|
|
UserLocator = require("./UserLocator")
|
|
|
|
module.exports =
|
|
|
|
getUserOrCreateHoldingAccount: (email, callback = (err, user)->)->
|
|
self = @
|
|
UserLocator.findByEmail email, (err, user)->
|
|
if user?
|
|
callback(err, user)
|
|
else
|
|
self.createNewUser email:email, holdingAccount:true, callback
|
|
|
|
createNewUser: (opts, callback)->
|
|
user = new User()
|
|
user.email = opts.email
|
|
user.holdingAccount = opts.holdingAccount
|
|
user.save (err)->
|
|
callback(err, user)
|