Skip to content

Commit

Permalink
Fix TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Apr 6, 2024
1 parent 3fcde7d commit 8ef44ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class Session {
}
const userstate = await users.get(userid);
if (userstate) {
if (userstate.banstate >= 100 || ((userstate).password && userstate.nonce)) {
if (userstate.banstate >= 100 || ((userstate as any).password && userstate.nonce)) {
return ';;Your username is no longer available.';
}
if (userstate.email?.endsWith('@')) {
Expand Down Expand Up @@ -358,12 +358,12 @@ export class Session {
async passwordVerify(name: string, pass: string) {
const ip = this.context.getIp();
const userid = toID(name);
let attempts = await loginattempts.get(userid);
let attempts = (await loginattempts.get(userid)) as {time: number, count: number};
if (attempts) {
// too many attempts, no valid login session from that ip on that userid
if (attempts.count >= 500 && !(await sessions.selectOne()`WHERE ip = ${ip} AND userid = ${userid}`)) {
attempts.count++;
await attempts.update(userid, {time: time(), count: attempts.count});
await loginattempts.update(userid, {time: time(), count: attempts.count});
throw new ActionError(
`Too many unrecognized login attempts have been made against this account. Please try again later.`
);
Expand Down Expand Up @@ -430,7 +430,7 @@ export class Session {
}
if (attempts) {
attempts.count++;
await attempts.update(userid, {
await loginattempts.update(userid, {
count: attempts.count, time: time(),
});
} else {
Expand Down

0 comments on commit 8ef44ba

Please sign in to comment.