mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-25 00:31:36 +00:00
on register try and auto allocate a group licence if one exists
This commit is contained in:
parent
3360b3c35a
commit
0a64c1c8ac
2 changed files with 11 additions and 0 deletions
|
@ -10,6 +10,7 @@ AuthenticationController = require("../Authentication/AuthenticationController")
|
|||
AuthenticationManager = require("../Authentication/AuthenticationManager")
|
||||
ReferalAllocator = require("../Referal/ReferalAllocator")
|
||||
UserUpdater = require("./UserUpdater")
|
||||
SubscriptionDomainAllocator = require("../Subscription/SubscriptionDomainAllocator")
|
||||
|
||||
module.exports =
|
||||
|
||||
|
@ -91,6 +92,7 @@ module.exports =
|
|||
req.session.user = user
|
||||
req.session.justRegistered = true
|
||||
ReferalAllocator.allocate req.session.referal_id, user._id, req.session.referal_source, req.session.referal_medium
|
||||
SubscriptionDomainAllocator.autoAllocate(user)
|
||||
res.send
|
||||
redir:redir
|
||||
id:user._id.toString()
|
||||
|
|
|
@ -35,6 +35,8 @@ describe "UserController", ->
|
|||
setUserPassword: sinon.stub()
|
||||
@ReferalAllocator =
|
||||
allocate:sinon.stub()
|
||||
@SubscriptionDomainAllocator =
|
||||
autoAllocate:sinon.stub()
|
||||
@UserUpdater =
|
||||
changeEmailAddress:sinon.stub()
|
||||
@UserController = SandboxedModule.require modulePath, requires:
|
||||
|
@ -47,6 +49,7 @@ describe "UserController", ->
|
|||
"../Authentication/AuthenticationController": @AuthenticationController
|
||||
"../Authentication/AuthenticationManager": @AuthenticationManager
|
||||
"../Referal/ReferalAllocator":@ReferalAllocator
|
||||
"../Subscription/SubscriptionDomainAllocator":@SubscriptionDomainAllocator
|
||||
"logger-sharelatex": {log:->}
|
||||
|
||||
|
||||
|
@ -212,6 +215,12 @@ describe "UserController", ->
|
|||
done()
|
||||
@UserController.register @req, @res
|
||||
|
||||
it "should auto allocate the subscription for that domain", (done)->
|
||||
@UserRegistrationHandler.registerNewUser.callsArgWith(1, null, @user)
|
||||
@res.send = (opts)=>
|
||||
@SubscriptionDomainAllocator.autoAllocate.calledWith(@user).should.equal true
|
||||
done()
|
||||
@UserController.register @req, @res
|
||||
|
||||
|
||||
describe "changePassword", ->
|
||||
|
|
Loading…
Reference in a new issue