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

@ -200,7 +200,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
var apiClient = this;
if (data.status === 401) {
if (data.status === 403) {
if (data.errorCode === "ParentalControl") {
var isCurrentAllowed = currentRouteInfo ? (currentRouteInfo.route.anonymous || currentRouteInfo.route.startup) : true;

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({

View file

@ -990,6 +990,7 @@
"MessageInstallPluginFromApp": "This plugin must be installed from within the app you intend to use it in.",
"MessageInvalidForgotPasswordPin": "An invalid or expired pin code was entered. Please try again.",
"MessageInvalidUser": "Invalid username or password. Please try again.",
"MessageUnauthorizedUser": "You are not authorized to access the server at this time. Please contact your server administrator for more information.",
"MessageItemSaved": "Item saved.",
"MessageItemsAdded": "Items added.",
"MessageLeaveEmptyToInherit": "Leave empty to inherit settings from a parent item or the global default value.",