Skip to content

Commit c4e4416

Browse files
committed
ran linter
1 parent ae392b8 commit c4e4416

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

backend/app/routes/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def register_user(user: UserCreateRequest, user_service: UserService = Dep
2121
if user.role == UserRole.ADMIN:
2222
if user.email not in allowed_Admins:
2323
raise HTTPException(status_code=403, detail="Access denied. Admin privileges required for admin portal")
24-
24+
2525
try:
2626
return await user_service.create_user(user)
2727
except HTTPException as http_ex:

frontend/src/APIClients/authAPIClient.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export interface AuthResult {
3030
errorCode?: string;
3131
}
3232

33-
const login = async (email: string, password: string, isAdminPortal: boolean = false): Promise<AuthResult> => {
33+
const login = async (
34+
email: string,
35+
password: string,
36+
isAdminPortal: boolean = false,
37+
): Promise<AuthResult> => {
3438
try {
3539
// Validate inputs
3640
if (!validateEmail(email)) {
@@ -59,28 +63,30 @@ const login = async (email: string, password: string, isAdminPortal: boolean = f
5963
try {
6064
const loginRequest: LoginRequest = { email, password };
6165
const headers: any = { withCredentials: true };
62-
66+
6367
// Add admin portal header if this is an admin login
6468
if (isAdminPortal) {
6569
headers.headers = { 'X-Admin-Portal': 'true' };
6670
}
67-
71+
6872
const { data } = await baseAPIClient.post<AuthResponse>('/auth/login', loginRequest, headers);
6973
localStorage.setItem(AUTHENTICATED_USER_KEY, JSON.stringify(data));
7074
return { success: true, user: { ...data.user, ...data } };
7175
} catch (error) {
7276
// Handle admin privilege errors specifically
7377
if (error && typeof error === 'object' && 'response' in error) {
74-
const response = (error as { response?: { status?: number; data?: { detail?: string } } }).response;
78+
const response = (error as { response?: { status?: number; data?: { detail?: string } } })
79+
.response;
7580
if (response?.status === 403 && isAdminPortal) {
7681
return {
7782
success: false,
78-
error: 'Access denied. You do not have admin privileges. Please contact an administrator.',
83+
error:
84+
'Access denied. You do not have admin privileges. Please contact an administrator.',
7985
errorCode: 'auth/insufficient-privileges',
8086
};
8187
}
8288
}
83-
89+
8490
// Backend login failure is not critical since Firebase auth succeeded
8591
return {
8692
success: true,

frontend/src/pages/admin-login.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export default function AdminLogin() {
2727
console.log('Admin login success:', result);
2828
router.push('/admin/dashboard');
2929
} else {
30-
setError('Invalid email or password. Please check your credentials and try again. If you recently signed up, make sure to verify your email first.');
30+
setError(
31+
'Invalid email or password. Please check your credentials and try again. If you recently signed up, make sure to verify your email first.',
32+
);
3133
}
3234
} catch (err: unknown) {
3335
console.error('Admin login error:', err);

frontend/src/pages/admin-signup.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ export default function AdminLoginPage() {
3838
signupMethod: SignUpMethod.PASSWORD,
3939
};
4040
const result = await register(userData);
41-
console.log("?", result)
41+
console.log('?', result);
4242
// Check if it's an admin privilege error
4343
if (!result.success && result.error && result.error.includes('Admin privileges required')) {
44-
setError('Access denied. Admin registration is restricted. Please contact an administrator.');
44+
setError(
45+
'Access denied. Admin registration is restricted. Please contact an administrator.',
46+
);
4547
return;
4648
}
47-
49+
4850
// If successful (even if success is false, check if we got a user)
4951
if (result.user || result.success) {
5052
console.log('Admin registration success:', result);

frontend/src/pages/admin/dashboard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export default function AdminDashboard() {
5050
fontWeight={400}
5151
fontSize="lg"
5252
>
53-
Welcome to the admin dashboard. You have successfully logged in to your administrator account.
53+
Welcome to the admin dashboard. You have successfully logged in to your administrator
54+
account.
5455
</Text>
5556
</Box>
5657
</Flex>

0 commit comments

Comments
 (0)