- catalogo avanti, parte 1
This commit is contained in:
@@ -5721,6 +5721,25 @@ UserSchema.statics.tooManyReqPassword = async function (idapp, email, set) {
|
||||
}
|
||||
|
||||
};
|
||||
UserSchema.statics.tooManyLoginWrong = async function (idapp, username, set) {
|
||||
const User = this;
|
||||
|
||||
const maxnum = 30;
|
||||
|
||||
const user = await User.findByUsername(idapp, username, true, false);
|
||||
if (user) {
|
||||
if (!user.retry_pwd)
|
||||
user.retry_pwd = 0
|
||||
if (set && user.retry_pwd <= maxnum) {
|
||||
user.retry_pwd++;
|
||||
|
||||
await User.findOneAndUpdate({ _id: user._id }, { $set: { retry_pwd: user.retry_pwd } });
|
||||
}
|
||||
return {troppilogin: user.retry_pwd > maxnum, retry_pwd: user.retry_pwd};
|
||||
}
|
||||
|
||||
return {troppilogin: false, retry_pwd: 0};
|
||||
};
|
||||
|
||||
UserSchema.statics.setLastCircuitOpened = async function (idapp, username, circuitpath) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user