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

Merge pull request #2536 from cvium/fix-invalid-credentials

fix: redirect to login if stored credentials are invalid
(cherry picked from commit 070671f206)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Bill Thornton 2021-04-07 17:05:58 -04:00 committed by Joshua M. Boniface
parent d73d00a344
commit 79d0ed3ee4

View file

@ -425,14 +425,18 @@ class AppRouter {
onRequestFail(e, data) {
const apiClient = this;
if (data.status === 403) {
// 401 means the credentials are broken
if (data.status === 401) {
console.debug('Invalid stored credentials, redirecting to login');
appRouter.showLocalLogin(apiClient.serverId());
} else if (data.status === 403) {
if (data.errorCode === 'ParentalControl') {
const isCurrentAllowed = this.currentRouteInfo ? (this.currentRouteInfo.route.anonymous || this.currentRouteInfo.route.startup) : true;
const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true;
// Bounce to the login screen, but not if a password entry fails, obviously
if (!isCurrentAllowed) {
this.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
this.showLocalLogin(apiClient.serverId());
appRouter.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
appRouter.showLocalLogin(apiClient.serverId());
}
}
}