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