Fix Bug 62511: Uninformative error when session time expires

This commit is contained in:
Viktor Fomin 2023-05-16 15:53:40 +03:00
parent d145872b6e
commit e3bc603f9d
3 changed files with 11 additions and 9 deletions

View File

@ -57,9 +57,9 @@ class AxiosClient {
initSSR = (headers) => {
this.isSSR = true;
const proto = headers['x-forwarded-proto']?.split(',').shift();
const host = headers['x-forwarded-host']?.split(',').shift();
const proto = headers["x-forwarded-proto"]?.split(",").shift();
const host = headers["x-forwarded-host"]?.split(",").shift();
const origin = apiOrigin || `${proto}://${host}`;
const apiBaseURL = combineUrl(origin, proxyURL, apiPrefix);
@ -143,7 +143,7 @@ class AxiosClient {
url: "/authentication/logout",
}).then(() => {
this.setWithCredentialsStatus(false);
window.location.href = loginURL;
window.location.href = `${loginURL}?authError=true`;
});
break;
case 402:

View File

@ -25,7 +25,8 @@ declare global {
type MatchType = {
confirmedEmail?: string;
message?: string;
messageKey?: number;
messageKey?: string;
authError?: string;
};
type PasswordHashType = {

View File

@ -52,17 +52,17 @@ const LoginForm: React.FC<ILoginFormProps> = ({
const [isDisabled, setIsDisabled] = useState(false);
const [isChecked, setIsChecked] = useState(false);
const [isDialogVisible, setIsDialogVisible] = useState(false);
const [isWithoutPasswordLogin, setIsWithoutPasswordLogin] = useState(
IS_ROOMS_MODE
);
const [isWithoutPasswordLogin, setIsWithoutPasswordLogin] =
useState(IS_ROOMS_MODE);
const inputRef = useRef<HTMLInputElement>(null);
const { t, ready } = useTranslation(["Login", "Common"]);
const { message, confirmedEmail } = match || {
const { message, confirmedEmail, authError } = match || {
message: "",
confirmedEmail: "",
authError: "",
};
const authCallback = (profile: string) => {
@ -108,6 +108,7 @@ const LoginForm: React.FC<ILoginFormProps> = ({
const text = `${messageEmailConfirmed} ${messageAuthorize}`;
confirmedEmail && ready && toastr.success(text);
authError && ready && toastr.error(t("Common:ProviderLoginError"));
focusInput();