mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-12-02 21:24:08 +01:00
Use transaction and check root on server init
This commit is contained in:
1 parent
2a0507ffc6
commit
34715558df
3 files changed
+22
-6
No files matched your search
+5
-1
@@ -472,7 +472,11 @@ class Server {
|
||||
const rootUsername = newRoot.username || 'root'
|
||||
const rootPash = newRoot.password ? await this.auth.localAuthStrategy.hashPassword(newRoot.password) : ''
|
||||
if (!rootPash) Logger.warn(`[Server] Creating root user with no password`)
|
||||
await Database.createRootUser(rootUsername, rootPash, this.auth)
|
||||
const created = await Database.createRootUser(rootUsername, rootPash, this.auth)
|
||||
if (!created) {
|
||||
Logger.error(`[Server] attempt to init server when server already has a root user`)
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user