mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Lookup users by email hostname using new field
This commit is contained in:
parent
026f7eebcd
commit
af3cc01496
2 changed files with 11 additions and 1 deletions
|
@ -1,2 +1,7 @@
|
|||
UserGetter = require("../User/UserGetter")
|
||||
|
||||
module.exports = InstitutionsController =
|
||||
confirmDomain: (req, res, next = (error) ->) ->
|
||||
confirmDomain: (req, res, next) ->
|
||||
hostname = req.body.hostname
|
||||
UserGetter.getUsersByHostname hostname, {_id:1, emails:1}, (error, users) ->
|
||||
res.json {hostname: hostname, wub: users}
|
||||
|
|
|
@ -58,6 +58,11 @@ module.exports = UserGetter =
|
|||
# well
|
||||
@getUserByMainEmail email, projection, callback
|
||||
|
||||
getUsersByHostname: (hostname, projection, callback = (error, users) ->) ->
|
||||
hostname = hostname.trim()
|
||||
query = emails: { $exists: true }, 'emails.hostname': hostname
|
||||
db.users.find query, projection, callback
|
||||
|
||||
getUsers: (user_ids, projection, callback = (error, users) ->) ->
|
||||
try
|
||||
user_ids = user_ids.map (u) -> ObjectId(u.toString())
|
||||
|
|
Loading…
Reference in a new issue