removed legacy remember me redirect
This commit is contained in:
@@ -99,7 +99,7 @@ async function authWithPassword(data) {
|
||||
await app.pb.collection("_superusers").authWithPassword(data.identity, data.password);
|
||||
app.toasts.removeAll();
|
||||
app.store.errors = null;
|
||||
app.utils.toRememberedPath();
|
||||
window.location.hash = "#/";
|
||||
} catch (err) {
|
||||
if (err.status == 401) {
|
||||
data.mfaId = err.response.mfaId;
|
||||
@@ -304,7 +304,7 @@ async function authWithOTP(data) {
|
||||
});
|
||||
app.toasts.removeAll();
|
||||
app.store.errors = null;
|
||||
app.utils.toRememberedPath();
|
||||
window.location.hash = "#/";
|
||||
} catch (err) {
|
||||
app.checkApiError(err);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ if (app.pb.authStore.isValid) {
|
||||
// clear the store only on invalidated/expired token
|
||||
const status = err?.status << 0;
|
||||
if (status == 401 || status == 403) {
|
||||
app.utils.rememberPath();
|
||||
app.pb.cancelAllRequests();
|
||||
app.pb.authStore.clear();
|
||||
}
|
||||
@@ -231,7 +230,6 @@ window.app.checkApiError = function(err, showToast = true) {
|
||||
|
||||
// unauthorized
|
||||
if (statusCode === 401 && window.location.hash != LOGIN_PATH) {
|
||||
app.utils.rememberPath();
|
||||
app.pb.cancelAllRequests();
|
||||
return app.pb.authStore.clear();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
const DEFAULT_RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
const REMEMBER_PATH_KEY = "pb_redirect";
|
||||
|
||||
const navigationStore = store({
|
||||
hash: window.location.hash,
|
||||
});
|
||||
@@ -1008,27 +1006,6 @@ const utils = {
|
||||
return newHref;
|
||||
},
|
||||
|
||||
/**
|
||||
* Locally stores the current path for later redirect.
|
||||
*/
|
||||
rememberPath() {
|
||||
window.localStorage.setItem(REMEMBER_PATH_KEY, window.location.hash);
|
||||
},
|
||||
|
||||
/**
|
||||
* Redirect to a remembered local path.
|
||||
*
|
||||
* @param {string} [fallback] Fallback path if there is nothing stored.
|
||||
*/
|
||||
toRememberedPath(fallback = "#/collections") {
|
||||
let path = window.localStorage.getItem(REMEMBER_PATH_KEY);
|
||||
if (path) {
|
||||
window.localStorage.removeItem(REMEMBER_PATH_KEY);
|
||||
}
|
||||
|
||||
window.location.hash = path || fallback;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns and deserializes a localStorage stored JSON value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user