summaryrefslogtreecommitdiff
path: root/lib/web/auth
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/web/auth/email/index.js12
-rw-r--r--lib/web/auth/ldap/index.js4
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/web/auth/email/index.js b/lib/web/auth/email/index.js
index 32e21428..06560545 100644
--- a/lib/web/auth/email/index.js
+++ b/lib/web/auth/email/index.js
@@ -9,7 +9,7 @@ const models = require('../../../models')
const logger = require('../../../logger')
const { setReturnToFromReferer } = require('../utils')
const { urlencodedParser } = require('../../utils')
-const response = require('../../../response')
+const errors = require('../../../errors')
let emailAuth = module.exports = Router()
@@ -39,8 +39,8 @@ passport.use(new LocalStrategy({
if (config.allowEmailRegister) {
emailAuth.post('/register', urlencodedParser, function (req, res, next) {
- if (!req.body.email || !req.body.password) return response.errorBadRequest(res)
- if (!validator.isEmail(req.body.email)) return response.errorBadRequest(res)
+ if (!req.body.email || !req.body.password) return errors.errorBadRequest(res)
+ if (!validator.isEmail(req.body.email)) return errors.errorBadRequest(res)
models.User.findOrCreate({
where: {
email: req.body.email
@@ -63,14 +63,14 @@ if (config.allowEmailRegister) {
return res.redirect(config.serverURL + '/')
}).catch(function (err) {
logger.error('auth callback failed: ' + err)
- return response.errorInternalError(res)
+ return errors.errorInternalError(res)
})
})
}
emailAuth.post('/login', urlencodedParser, function (req, res, next) {
- if (!req.body.email || !req.body.password) return response.errorBadRequest(res)
- if (!validator.isEmail(req.body.email)) return response.errorBadRequest(res)
+ if (!req.body.email || !req.body.password) return errors.errorBadRequest(res)
+ if (!validator.isEmail(req.body.email)) return errors.errorBadRequest(res)
setReturnToFromReferer(req)
passport.authenticate('local', {
successReturnToOrRedirect: config.serverURL + '/',
diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js
index 96143664..28f3e471 100644
--- a/lib/web/auth/ldap/index.js
+++ b/lib/web/auth/ldap/index.js
@@ -8,7 +8,7 @@ const models = require('../../../models')
const logger = require('../../../logger')
const { setReturnToFromReferer } = require('../utils')
const { urlencodedParser } = require('../../utils')
-const response = require('../../../response')
+const errors = require('../../../errors')
let ldapAuth = module.exports = Router()
@@ -81,7 +81,7 @@ passport.use(new LDAPStrategy({
}))
ldapAuth.post('/auth/ldap', urlencodedParser, function (req, res, next) {
- if (!req.body.username || !req.body.password) return response.errorBadRequest(res)
+ if (!req.body.username || !req.body.password) return errors.errorBadRequest(res)
setReturnToFromReferer(req)
passport.authenticate('ldapauth', {
successReturnToOrRedirect: config.serverURL + '/',