mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-08 00:29:04 +02:00
lowercase and trim add user to group email address
This commit is contained in:
@@ -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?
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user