mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-25 19:27:24 +02:00
server: Allow changing email and password seperately
This commit is contained in:
parent
b2d8dd1cfc
commit
088da9bd55
1 changed files with 11 additions and 2 deletions
|
|
@ -170,11 +170,20 @@ class AccountDetailsController extends Controller {
|
|||
hash: user.hash,
|
||||
),
|
||||
)) {
|
||||
final hashResult = await compute(Crypt.hashPassword, newPassword);
|
||||
HashPasswordResult hashResult;
|
||||
|
||||
if (newPassword != null) {
|
||||
hashResult = await compute(Crypt.hashPassword, newPassword);
|
||||
} else {
|
||||
hashResult = HashPasswordResult(
|
||||
hash: user.hash,
|
||||
salt: user.salt,
|
||||
);
|
||||
}
|
||||
|
||||
db.updateUser(User(
|
||||
name: username,
|
||||
email: newEmail,
|
||||
email: newEmail ?? user.email,
|
||||
salt: hashResult.salt,
|
||||
hash: hashResult.hash,
|
||||
mayUpload: user.mayUpload,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue