Skip to content

Commit be9abc8

Browse files
author
Petr Kachanovsky
committed
change translation handling for login error
1 parent 8d5cd7a commit be9abc8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

adminforth/modules/restApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
109109
noAuth: true,
110110
method: 'POST',
111111
path: '/login',
112-
handler: async ({ body, response, headers, query, cookies, requestUrl }) => {
112+
handler: async ({ body, response, headers, query, cookies, requestUrl, tr }) => {
113113

114-
const INVALID_MESSAGE = 'invalid_username_or_password';
114+
const INVALID_MESSAGE = await tr('Invalid username or password', 'errors');
115115
const { username, password, rememberMe } = body;
116116
let adminUser: AdminUser;
117117
let toReturn: { redirectTo?: string, allowedLogin:boolean, error?: string } = { allowedLogin: true };

adminforth/spa/src/views/LoginView.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,7 @@ async function login() {
194194
}
195195
});
196196
if (resp.error) {
197-
if (resp.error === 'invalid_username_or_password') {
198-
error.value = t('Invalid username or password');
199-
} else {
200197
error.value = resp.error;
201-
}
202198
} else if (resp.redirectTo) {
203199
router.push(resp.redirectTo);
204200
} else {

0 commit comments

Comments
 (0)