- catalogo avanti, parte 1

This commit is contained in:
Surya Paolo
2024-05-04 14:49:02 +02:00
parent e1f2e799d6
commit 07973fbf0a
14 changed files with 639 additions and 171 deletions

View File

@@ -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) {