Skip to content

Commit

Permalink
fix: corrected register/email;
Browse files Browse the repository at this point in the history
  • Loading branch information
ncoonrod committed Jan 25, 2024
1 parent 6e412ad commit 3d7cd65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hotstaq/userroute",
"description": "A user route for HotStaq. Allows users to be created/edited/deleted securely.",
"version": "0.4.7",
"version": "0.4.8",
"main": "build/src/index.js",
"scripts": {
"test": "hotstaq --dev --env-file .env run --server-type api --api-test",
Expand Down
9 changes: 9 additions & 0 deletions src/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ export class User implements IUser
*/
async register (db: HotDBMySQL, emailConfig: EmailConfig = null, verifyCode: string = ""): Promise<User>
{
this.email = this.email.toLowerCase ();

let tempUser: User | null = await User.getUser (db, this.email);

if (tempUser != null)
Expand Down Expand Up @@ -505,9 +507,16 @@ export class User implements IUser
let foundUser: User = null;

if (typeof (ip) === "string")
{
email = email.toLowerCase ();

foundUser = await User.getUser (db, email, true);
}
else
{
foundUser = ip;
foundUser.email = foundUser.email.toLowerCase ();
}

if (foundUser == null)
throw new Error (`Wrong email or password.`);
Expand Down

0 comments on commit 3d7cd65

Please sign in to comment.