Remove keep logged in query string after login, dont show on select_mfa_module step (#10439)

This commit is contained in:
Bram Kragten 2021-10-28 19:05:30 +02:00 committed by GitHub
parent 7cadaf1dc3
commit bb734be4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -206,7 +206,8 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
.computeError=${this._computeErrorCallback(step)}
@value-changed=${this._stepDataChanged}
></ha-form>
${this.clientId === genClientId() && step.step_id !== "mfa"
${this.clientId === genClientId() &&
!["select_mfa_module", "mfa"].includes(step.step_id)
? html`
<ha-formfield
class="store-token"

View File

@ -1,4 +1,5 @@
import { AuthData } from "home-assistant-js-websocket";
import { extractSearchParam } from "../url/search-params";
const storage = window.localStorage || {};
@ -31,10 +32,7 @@ export function askWrite() {
export function saveTokens(tokens: AuthData | null) {
tokenCache.tokens = tokens;
if (
!tokenCache.writeEnabled &&
new URLSearchParams(window.location.search).get("storeToken") === "true"
) {
if (!tokenCache.writeEnabled && extractSearchParam("storeToken") === "true") {
tokenCache.writeEnabled = true;
}

View File

@ -60,10 +60,12 @@ const connProm = async (auth) => {
searchParams.delete("auth_callback");
searchParams.delete("code");
searchParams.delete("state");
searchParams.delete("storeToken");
const search = searchParams.toString();
history.replaceState(
null,
"",
`${location.pathname}?${searchParams.toString()}`
`${location.pathname}${search ? `?${search}` : ""}`
);
}