mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
file based user manager fixed
This commit is contained in:
parent
17fa64499d
commit
91bd9f256f
@ -54,12 +54,18 @@ export class UserManager implements IUserManager {
|
|||||||
public async find(filter: any) {
|
public async find(filter: any) {
|
||||||
let pass = filter.password;
|
let pass = filter.password;
|
||||||
delete filter.password;
|
delete filter.password;
|
||||||
return this.db.get("users").filter((u: UserDTO) => {
|
const users = await this.db.get("users");
|
||||||
if (pass && !PasswordHelper.comparePassword(pass, u.password)) {
|
let i = users.length;
|
||||||
return false;
|
while (i--) {
|
||||||
|
if (pass && !(await PasswordHelper.comparePassword(pass, users[i].password))) {
|
||||||
|
users.splice(i, 1);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
Utils.equalsFilter(u, filter)
|
if (Utils.equalsFilter(users[i], filter) == false) {
|
||||||
});
|
users.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createUser(user: UserDTO) {
|
public async createUser(user: UserDTO) {
|
||||||
|
Loading…
Reference in New Issue
Block a user