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

fix: redirect to login if stored credentials are invalid

This commit is contained in:
cvium 2021-03-29 20:41:50 +02:00
parent 1c7ce790dc
commit 2e58ce0d18

View file

@ -424,15 +424,20 @@ 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;
// 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());
}
}
}