mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01: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,
|
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(
|
db.updateUser(User(
|
||||||
name: username,
|
name: username,
|
||||||
email: newEmail,
|
email: newEmail ?? user.email,
|
||||||
salt: hashResult.salt,
|
salt: hashResult.salt,
|
||||||
hash: hashResult.hash,
|
hash: hashResult.hash,
|
||||||
mayUpload: user.mayUpload,
|
mayUpload: user.mayUpload,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue