User sync fixes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-10-31 02:20:43 +01:00
parent ba5a03c980
commit ae94d7db02
1 changed files with 4 additions and 5 deletions

View File

@ -165,7 +165,7 @@ module.exports = Self => {
// Database // Database
if (user) { if (user && user.active) {
let bcryptPassword = password let bcryptPassword = password
? $.User.hashPassword(password) ? $.User.hashPassword(password)
: user.bcryptPassword; : user.bcryptPassword;
@ -175,18 +175,17 @@ module.exports = Self => {
); );
let appUser = { let appUser = {
id: user.id,
username: userName, username: userName,
email: user.email, email: user.email,
created: user.created, created: user.created,
updated: user.updated updated: user.updated
}; };
if (bcryptPassword) if (bcryptPassword)
appUser.password = bcryptPassword; appUser.password = bcryptPassword;
await $.user.upsert(appUser); await $.user.replaceById(user.id, appUser);
} } else
await $.user.destroyAll({userName});
// SIP // SIP