mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 21:59:00 +02:00
Setting up hostname field and institution domain confirmation endpoint
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
module.exports = InstitutionsController =
|
||||
confirmDomain: (req, res, next = (error) ->) ->
|
||||
@@ -66,7 +66,8 @@ module.exports = UserUpdater =
|
||||
logger.err error: error, 'problem adding affiliation while adding email'
|
||||
return callback(error)
|
||||
|
||||
update = $push: emails: email: newEmail, createdAt: new Date()
|
||||
hostname = newEmail.split('@')[1]
|
||||
update = $push: emails: email: newEmail, createdAt: new Date(), hostname: hostname
|
||||
@updateUser userId, update, (error) ->
|
||||
if error?
|
||||
logger.err error: error, 'problem updating users emails'
|
||||
|
||||
@@ -10,6 +10,7 @@ UserSchema = new Schema
|
||||
email : {type : String, default : ''}
|
||||
emails: [{
|
||||
email: { type : String, default : '' },
|
||||
hostname: { type : String, default : '' },
|
||||
createdAt: { type : Date, default: () -> new Date() },
|
||||
confirmedAt: { type: Date }
|
||||
}],
|
||||
|
||||
@@ -50,6 +50,7 @@ TokenAccessController = require('./Features/TokenAccess/TokenAccessController')
|
||||
Features = require('./infrastructure/Features')
|
||||
LinkedFilesRouter = require './Features/LinkedFiles/LinkedFilesRouter'
|
||||
TemplatesRouter = require './Features/Templates/TemplatesRouter'
|
||||
InstitutionsController = require './Features/Institutions/InstitutionsController'
|
||||
|
||||
logger = require("logger-sharelatex")
|
||||
_ = require("underscore")
|
||||
@@ -330,6 +331,7 @@ module.exports = class Router
|
||||
),
|
||||
AuthenticationController.httpAuth,
|
||||
CompileController.getFileFromClsiWithoutUser
|
||||
publicApiRouter.post '/api/institutions/confirm_affiliation_domain', AuthenticationController.httpAuth, InstitutionsController.confirmDomain
|
||||
|
||||
webRouter.get '/teams', (req, res, next) ->
|
||||
# Match v1 behaviour - if the user is signed in, show their teams list
|
||||
|
||||
Reference in New Issue
Block a user