1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #1083 from mark-monteiro/handle-auth-response-codes-correctly

Handle 401 & 403 Server Responses Correctly
This commit is contained in:
dkanada 2020-04-23 14:10:35 +09:00 committed by GitHub
commit 5be5f25841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -24,9 +24,11 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout
page.querySelector("#txtManualPassword").value = "";
loading.hide();
if (response.status === 401) {
const UnauthorizedOrForbidden = [401, 403];
if (UnauthorizedOrForbidden.includes(response.status)) {
require(["toast"], function (toast) {
toast(Globalize.translate("MessageInvalidUser"));
const messageKey = response.status === 401 ? "MessageInvalidUser" : "MessageUnauthorizedUser";
toast(Globalize.translate(messageKey));
});
} else {
Dashboard.alert({