mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix hashPassword
This commit is contained in:
		
							parent
							
								
									6cc7a44a22
								
							
						
					
					
						commit
						4ff7355262
					
				@ -431,7 +431,7 @@ class Server {
 | 
				
			|||||||
    Logger.info(`[Server] Initializing new server`)
 | 
					    Logger.info(`[Server] Initializing new server`)
 | 
				
			||||||
    const newRoot = req.body.newRoot
 | 
					    const newRoot = req.body.newRoot
 | 
				
			||||||
    const rootUsername = newRoot.username || 'root'
 | 
					    const rootUsername = newRoot.username || 'root'
 | 
				
			||||||
    const rootPash = newRoot.password ? await this.auth.hashPass(newRoot.password) : ''
 | 
					    const rootPash = newRoot.password ? await this.auth.localAuthStrategy.hashPassword(newRoot.password) : ''
 | 
				
			||||||
    if (!rootPash) Logger.warn(`[Server] Creating root user with no password`)
 | 
					    if (!rootPash) Logger.warn(`[Server] Creating root user with no password`)
 | 
				
			||||||
    await Database.createRootUser(rootUsername, rootPash, this.auth)
 | 
					    await Database.createRootUser(rootUsername, rootPash, this.auth)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -127,7 +127,7 @@ class UserController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const userId = uuidv4()
 | 
					    const userId = uuidv4()
 | 
				
			||||||
    const pash = await this.auth.hashPass(req.body.password)
 | 
					    const pash = await this.auth.localAuthStrategy.hashPassword(req.body.password)
 | 
				
			||||||
    const token = this.auth.generateAccessToken({ id: userId, username: req.body.username })
 | 
					    const token = this.auth.generateAccessToken({ id: userId, username: req.body.username })
 | 
				
			||||||
    const userType = req.body.type || 'user'
 | 
					    const userType = req.body.type || 'user'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -252,7 +252,7 @@ class UserController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Updating password
 | 
					    // Updating password
 | 
				
			||||||
    if (updatePayload.password) {
 | 
					    if (updatePayload.password) {
 | 
				
			||||||
      user.pash = await this.auth.hashPass(updatePayload.password)
 | 
					      user.pash = await this.auth.localAuthStrategy.hashPassword(updatePayload.password)
 | 
				
			||||||
      hasUpdates = true
 | 
					      hasUpdates = true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user