fix: apply prettier formatting to userService.js
- Fixed all prettier formatting issues in userService.js - All files now pass prettier format check - Maintained null checks and error handling improvements
This commit is contained in:
1 parent
25d538504c
commit
05442af050
1 file changed
+5
-5
@@ -85,12 +85,12 @@ class UserService {
|
||||
// Check if user exists
|
||||
try {
|
||||
const user = await this.db.userModule.getUserByEmail(email);
|
||||
|
||||
|
||||
// Add null check before password comparison
|
||||
if (!user || !user.comparePassword) {
|
||||
throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword);
|
||||
}
|
||||
|
||||
|
||||
// Compare password
|
||||
const match = await user.comparePassword(password);
|
||||
if (match !== true) {
|
||||
@@ -117,7 +117,7 @@ class UserService {
|
||||
error: error.message,
|
||||
stack: error.stack,
|
||||
});
|
||||
|
||||
|
||||
// If user is not found, throw a generic authentication error for security
|
||||
// Don't reveal whether user exists or password is wrong
|
||||
throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword);
|
||||
@@ -132,12 +132,12 @@ class UserService {
|
||||
updates.email = currentUser.email;
|
||||
// Get user
|
||||
const user = await this.db.userModule.getUserByEmail(currentUser.email);
|
||||
|
||||
|
||||
// Add null check before password comparison
|
||||
if (!user || !user.comparePassword) {
|
||||
throw this.errorService.createAuthorizationError(this.stringService.authIncorrectPassword);
|
||||
}
|
||||
|
||||
|
||||
// Compare passwords
|
||||
const match = await user.comparePassword(updates?.password);
|
||||
// If not a match, throw a 403
|
||||
|
||||
Reference in new issue
Block a user