Add API support for managing account names
This commit is contained in:
		
							parent
							
								
									9f5ef9239b
								
							
						
					
					
						commit
						9bcb3adfe2
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -189,6 +189,7 @@ router.get('/account', checkLoginStatus.user, (req, res, next) => { | |||
| }); | ||||
| 
 | ||||
| router.post('/account', checkLoginStatus.user, async function(req, res, next) { | ||||
|   const name = req.body.name; | ||||
|   const email = req.body.email; | ||||
|   const password = req.body.password; | ||||
| 
 | ||||
|  | @ -206,8 +207,8 @@ router.post('/account', checkLoginStatus.user, async function(req, res, next) { | |||
|       const isAdmin = loggedInAccountIsAdmin ? !!req.body.admin : false; | ||||
| 
 | ||||
|       if(remove) await accounts.remove(accountID); | ||||
|       else if(accountID) await accounts.edit(accountID, email, password, isAdmin); | ||||
|       else await accounts.create(req.body.email, req.body.password, !!req.body.admin); | ||||
|       else if(accountID) await accounts.edit(accountID, email, password, isAdmin, name); | ||||
|       else await accounts.create(email, password, !!req.body.admin, name); | ||||
| 
 | ||||
|       res.redirect('/manage#accounts');   | ||||
|     } | ||||
|  |  | |||
		Reference in a new issue