mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
Record local email for social users where possible (#14029)
* fix(auth): record local email for social users where possible * fix(auth): Apple emails are junk, prefer Google * fix(auth): correct placement of logic to save local email * fix(auth): run full function in both workflows to avoid conflicts Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
hasBackupAuth,
|
||||
loginSocial,
|
||||
registerLocal,
|
||||
socialEmailToLocal,
|
||||
} from '../../libs/auth';
|
||||
import { verifyUsername } from '../../libs/user/validation';
|
||||
|
||||
@@ -478,6 +479,7 @@ api.resetPasswordSetNewOne = {
|
||||
// set new password and make sure it's using bcrypt for hashing
|
||||
await passwordUtils.convertToBcrypt(user, String(newPassword));
|
||||
user.auth.local.passwordResetCode = undefined; // Reset saved password reset code
|
||||
if (!user.auth.local.email) user.auth.local.email = await socialEmailToLocal(user);
|
||||
await user.save();
|
||||
|
||||
return res.respond(200, {}, res.t('passwordChangeSuccess'));
|
||||
|
||||
Reference in New Issue
Block a user