Removed user model
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2023-02-03 14:44:00 +01:00
parent eded1ebf20
commit d773837740
5 changed files with 12 additions and 27 deletions

View File

@ -43,18 +43,18 @@ module.exports = Self => {
let where = usesEmail
? {email: user}
: {name: user};
let account = await Self.findOne({
fields: ['active', 'password'],
let vnUser = await Self.findOne({
fields: ['active', 'oldPassword'],
where
});
let validCredentials = instance && (
await instance.hasPassword(password) ||
account.password == md5(password || '')
vnUser.oldPassword == md5(password || '')
);
if (validCredentials) {
if (!account.active)
if (!vnUser.active)
throw new UserError('User disabled');
try {

View File

@ -142,9 +142,6 @@
},
"PrintConfig": {
"dataSource": "vn"
},
"user": {
"dataSource": "vn"
}
}

View File

@ -1,19 +0,0 @@
{
"name": "user",
"base": "User",
"options": {
"mysql": {
"table": "salix.User"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"forceId": false
},
"username":{
"type": "string"
}
}
}

View File

@ -29,6 +29,13 @@
"columnName": "bcryptPassword"
}
},
"oldPassword": {
"type": "string",
"required": true,
"mysql": {
"columnName": "password"
}
},
"roleFk": {
"type": "number",
"mysql": {

View File

@ -177,7 +177,7 @@ module.exports = Self => {
async syncUser(userName, info, password) {
if (info.user && password)
await app.models.user.setPassword(info.user.id, password);
await app.models.VnUser.setPassword(info.user.id, password);
},
async getUsers(usersToSync) {