mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Update passwordless root user check to user user.type instead of user.id
This commit is contained in:
parent
7a131880e5
commit
f42ab45e1b
@ -78,16 +78,10 @@ class Auth {
|
|||||||
}).bind(this)))
|
}).bind(this)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// should be already initialied here - but ci had some problems so check again
|
|
||||||
// token is required to encrypt/protect the info in jwts
|
|
||||||
if (!global.ServerSettings.tokenSecret) {
|
|
||||||
await this.initTokenSecret()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the JwtStrategy (always) -> for bearer token auth
|
// Load the JwtStrategy (always) -> for bearer token auth
|
||||||
passport.use(new JwtStrategy({
|
passport.use(new JwtStrategy({
|
||||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
secretOrKey: global.ServerSettings.tokenSecret
|
secretOrKey: Database.serverSettings.tokenSecret
|
||||||
}, this.jwtAuthCheck.bind(this)))
|
}, this.jwtAuthCheck.bind(this)))
|
||||||
|
|
||||||
// define how to seralize a user (to be put into the session)
|
// define how to seralize a user (to be put into the session)
|
||||||
@ -330,7 +324,7 @@ class Auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check passwordless root user
|
// Check passwordless root user
|
||||||
if (user.id === 'root' && (!user.pash || user.pash === '')) {
|
if (user.type === 'root' && (!user.pash || user.pash === '')) {
|
||||||
if (password) {
|
if (password) {
|
||||||
// deny login
|
// deny login
|
||||||
done(null, null)
|
done(null, null)
|
||||||
|
@ -139,7 +139,7 @@ class Server {
|
|||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
// parse cookies in requests
|
// parse cookies in requests
|
||||||
app.use(cookieParser());
|
app.use(cookieParser())
|
||||||
// enable express-session
|
// enable express-session
|
||||||
app.use(expressSession({
|
app.use(expressSession({
|
||||||
secret: global.ServerSettings.tokenSecret,
|
secret: global.ServerSettings.tokenSecret,
|
||||||
|
Loading…
Reference in New Issue
Block a user