mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
lowercase and trim add user to group email address
This commit is contained in:
parent
155831c3e7
commit
43102e0ffc
2 changed files with 3 additions and 3 deletions
|
@ -12,7 +12,7 @@ module.exports =
|
|||
|
||||
addUserToGroup: (req, res)->
|
||||
adminUserId = req.session.user._id
|
||||
newEmail = req.body.email
|
||||
newEmail = req.body?.email?.toLowerCase()?.trim()
|
||||
logger.log adminUserId:adminUserId, newEmail:newEmail, "adding user to group subscription"
|
||||
SubscriptionGroupHandler.addUserToGroup adminUserId, newEmail, (err, user)->
|
||||
if err?
|
||||
|
|
|
@ -54,11 +54,11 @@ describe "SubscriptionGroupController", ->
|
|||
describe "addUserToGroup", ->
|
||||
|
||||
it "should use the admin id for the logged in user and take the email address from the body", (done)->
|
||||
newEmail = "31231"
|
||||
newEmail = " boB@gmaiL.com "
|
||||
@req.body = email: newEmail
|
||||
res =
|
||||
json : (data)=>
|
||||
@GroupHandler.addUserToGroup.calledWith(@adminUserId, newEmail).should.equal true
|
||||
@GroupHandler.addUserToGroup.calledWith(@adminUserId, "bob@gmail.com").should.equal true
|
||||
data.user.should.deep.equal @user
|
||||
done()
|
||||
@Controller.addUserToGroup @req, res
|
||||
|
|
Loading…
Reference in a new issue