mirror of
https://github.com/linuxserver/heimdalljs.git
synced 2026-02-20 05:12:24 +08:00
Merge pull request #276 from memphisdj/fix-user-no-password-login
Fix user no password login and cookie maxAge extension
This commit is contained in:
commit
aa721a3412
@ -12,8 +12,9 @@ module.exports = {
|
||||
if (user && !req.originalUrl.match(/\/logout/)) {
|
||||
// Extend the tokens life while the user is browsing
|
||||
const token = user.generateJWT()
|
||||
const domain = req.hostname === 'localhost' ? 'localhost' : `.${req.hostname.split('.').slice(-2).join('.')}` // Set cookie on top level domain for auth proxying
|
||||
res.cookie('jwt', token, {
|
||||
domain: `.${req.host.split('.').slice(-2).join('.')}`, // Set cookie on top level domain for auth proxying
|
||||
domain: domain,
|
||||
maxAge: 3600000
|
||||
})
|
||||
}
|
||||
|
||||
26969
package-lock.json
generated
26969
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -28,17 +28,26 @@ router.post(
|
||||
})
|
||||
}
|
||||
|
||||
if (req.body.username === undefined) {
|
||||
return res.status(403).json({
|
||||
status: 'error',
|
||||
result: 'No username provided!'
|
||||
})
|
||||
}
|
||||
|
||||
const user = await User.findOne({
|
||||
where: {
|
||||
username: req.body.username
|
||||
}
|
||||
})
|
||||
|
||||
if (!user || !user.verifyPassword(req.body.password)) {
|
||||
return res.status(403).json({
|
||||
status: 'error',
|
||||
result: 'invalid_user'
|
||||
})
|
||||
if (req.body.username && req.body.password) {
|
||||
if (!user || !user.verifyPassword(req.body.password)) {
|
||||
return res.status(403).json({
|
||||
status: 'error',
|
||||
result: 'invalid_user'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (user.multifactorEnabled && !req.body.totp) {
|
||||
|
||||
@ -218,5 +218,4 @@ export async function logout(context) {
|
||||
// console.log(data)
|
||||
await axios.get(process.env.BACKEND_LOCATION + 'logout')
|
||||
context.commit('logout')
|
||||
this.$router.push('/')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user