Skip to content

Commit 161b0bf

Browse files
committed
refactor: rename 'email' to 'login' in authentication tests and login form for consistency
1 parent 7f96b3b commit 161b0bf

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

services/backend/tests/e2e/3-email-login.e2e.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Email Login and Logout E2E Tests', () => {
2727

2828
// Login with first user credentials
2929
const loginData = {
30-
email: 'admin@example.com',
30+
login: 'admin@example.com',
3131
password: 'SecurePassword123!'
3232
};
3333

@@ -62,7 +62,7 @@ describe('Email Login and Logout E2E Tests', () => {
6262

6363
// Login with second user credentials
6464
const loginData = {
65-
email: 'user@example.com',
65+
login: 'user@example.com',
6666
password: 'SecurePassword456!'
6767
};
6868

@@ -114,7 +114,7 @@ describe('Email Login and Logout E2E Tests', () => {
114114

115115
it('should reject login with invalid email', async () => {
116116
const invalidLoginData = {
117-
email: 'nonexistent@example.com',
117+
login: 'nonexistent@example.com',
118118
password: 'SecurePassword123!'
119119
};
120120

@@ -129,7 +129,7 @@ describe('Email Login and Logout E2E Tests', () => {
129129

130130
it('should reject login with invalid password', async () => {
131131
const invalidLoginData = {
132-
email: 'admin@example.com',
132+
login: 'admin@example.com',
133133
password: 'WrongPassword123!'
134134
};
135135

@@ -213,7 +213,7 @@ describe('Email Login and Logout E2E Tests', () => {
213213

214214
// Re-login with first user after logout
215215
const loginData = {
216-
email: 'admin@example.com',
216+
login: 'admin@example.com',
217217
password: 'SecurePassword123!'
218218
};
219219

services/backend/tests/e2e/5-global-settings-api-access.e2e.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Global Settings Access Control E2E Tests', () => {
2828
const adminLoginResponse = await request(server.server)
2929
.post('/api/auth/email/login')
3030
.send({
31-
email: 'admin@example.com',
31+
login: 'admin@example.com',
3232
password: 'SecurePassword123!'
3333
});
3434

@@ -42,7 +42,7 @@ describe('Global Settings Access Control E2E Tests', () => {
4242
const userLoginResponse = await request(server.server)
4343
.post('/api/auth/email/login')
4444
.send({
45-
email: 'user@example.com',
45+
login: 'user@example.com',
4646
password: 'SecurePassword456!'
4747
});
4848

services/backend/tests/e2e/6-global-settings-helpers.e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Global Settings Helper Methods E2E Tests', () => {
3535
const adminLoginResponse = await request(server.server)
3636
.post('/api/auth/email/login')
3737
.send({
38-
email: 'admin@example.com',
38+
login: 'admin@example.com',
3939
password: 'SecurePassword123!'
4040
});
4141

services/backend/tests/e2e/7-global-enable-login.e2e.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ describe('Global Enable Login E2E Tests', () => {
99

1010
// User credentials (matching those in 2-user-registration.e2e.test.ts and 3-email-login.e2e.test.ts)
1111
const adminUserCredentials = {
12-
email: 'admin@example.com',
12+
login: 'admin@example.com',
1313
password: 'SecurePassword123!',
1414
};
1515
const regularUserCredentials = {
16-
email: 'user@example.com',
16+
login: 'user@example.com',
1717
password: 'SecurePassword456!',
1818
};
1919

@@ -82,7 +82,7 @@ describe('Global Enable Login E2E Tests', () => {
8282

8383
expect(loginResponse.status).toBe(200);
8484
expect(loginResponse.body).toHaveProperty('success', true);
85-
expect(loginResponse.body.user.email).toBe(regularUserCredentials.email);
85+
expect(loginResponse.body.user.email).toBe(regularUserCredentials.login); // Ensure we check against the correct field if it was 'email' before
8686
});
8787

8888
it('should prevent login when global.enable_login is set to false', async () => {
@@ -108,6 +108,6 @@ describe('Global Enable Login E2E Tests', () => {
108108

109109
expect(loginResponse.status).toBe(200);
110110
expect(loginResponse.body).toHaveProperty('success', true);
111-
expect(loginResponse.body.user.email).toBe(regularUserCredentials.email);
111+
expect(loginResponse.body.user.email).toBe(regularUserCredentials.login);
112112
});
113113
});

services/frontend/src/views/Login.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const { t } = useI18n() // Initialize i18n composable
3838
// Define validation schema using Zod
3939
const formSchema = toTypedSchema(
4040
z.object({
41-
email: z
41+
login: z
4242
.string()
4343
.min(1, { message: t('validation.required', { field: t('login.form.email.label') }) })
4444
.email({ message: t('validation.email') }),
@@ -53,7 +53,7 @@ const formSchema = toTypedSchema(
5353
const form = useForm({
5454
validationSchema: formSchema,
5555
initialValues: {
56-
email: '',
56+
login: '',
5757
password: '',
5858
},
5959
})
@@ -101,7 +101,7 @@ const onSubmit = form.handleSubmit(async (values) => {
101101
102102
try {
103103
// Use the UserService login method which handles cache clearing
104-
const data = await UserService.login(values.email, values.password)
104+
const data = await UserService.login(values.login, values.password)
105105
console.log('Login successful!', data)
106106
107107
// Handle successful login - redirect to dashboard or home
@@ -173,7 +173,7 @@ const navigateToRegister = () => {
173173
<Card>
174174
<CardContent class="pt-6">
175175
<form @submit="onSubmit" class="space-y-6">
176-
<FormField v-slot="{ componentField }" name="email">
176+
<FormField v-slot="{ componentField }" name="login">
177177
<FormItem>
178178
<FormLabel>{{ $t('login.form.email.label') }}</FormLabel>
179179
<FormControl>

0 commit comments

Comments
 (0)