Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -61,7 +61,17 @@ export class AuthService {
|
||||
});
|
||||
|
||||
// Find user by email
|
||||
const user = await User.findByEmail(email);
|
||||
let user: User | null = null;
|
||||
try {
|
||||
user = await User.findByEmail(email);
|
||||
} catch (err) {
|
||||
console.error('[AuthService] Database error finding user:', err);
|
||||
return {
|
||||
success: false,
|
||||
errorCode: 'DATABASE_ERROR',
|
||||
errorMessage: 'Unable to verify credentials. Please try again.',
|
||||
};
|
||||
}
|
||||
if (!user) {
|
||||
await auditContext.logUserLogin('', false, 'User not found');
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user