admin/login: forward plugin error message (like 2fa plugin)

Massimo Melina committed Jun 17, 2025 at 00:29 UTC d3a877df3f1e1c4683723b05746e0c1b3ca9ae45
2 files changed +2 -2
admin/src/LoginRequired.ts
+1 -1
@@ -64,7 +64,7 @@ function LoginForm() {
64
65 async function login(username: string, password: string, extra?: object) {
66 const res = await srpClientSequence(username, password, apiCall, extra).catch(err => {
67 - throw err?.code === HTTP_UNAUTHORIZED ? "Wrong username or password"
67 + throw err?.code === HTTP_UNAUTHORIZED ? err.message || "Wrong username or password"
68 : err === 'trust' ? "Login aborted: server identity cannot be trusted"
69 : err?.name === 'AbortError' ? "Server didn't respond"
70 : (err?.message || "Unknown error")
admin/src/api.ts
+1 -1
@@ -16,7 +16,7 @@ setDefaultApiCallOptions({
16 async onResponse(res: Response, body: any) {
17 if (res.status === HTTP_UNAUTHORIZED) {
18 state.loginRequired = body?.possible !== false || HTTP_FORBIDDEN
19 - throw new ApiError(res.status, "Unauthorized")
19 + throw new ApiError(res.status, body)
20 }
21 }
22 })