瀏覽代碼

Fix default user domain for Keystone UI login

The `defaultUserDomain` option from the config file was previously
ignored if a successful login was already done with a different user
domain in the same browser.

This is fixed by always using the `defaultUserDomain` option when
logging in, if `showUserDomainInput` is false. If `showUserDomainInput`
is true, then the user domain input is shown when logging in and the
behaviour is kept as it was previously, where the last successful user
domain is pre-filled in the user domain input.
Sergiu Miclea 3 年之前
父節點
當前提交
b66a6b9187
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 5 5
      src/sources/UserSource.ts
  2. 1 1
      src/stores/UserStore.ts

+ 5 - 5
src/sources/UserSource.ts

@@ -38,11 +38,11 @@ class UserSource {
     localStorage.setItem("userDomainName", domainName);
   }
 
-  getDomainName(): string {
-    return (
-      localStorage.getItem("userDomainName") ||
-      configLoader.config.defaultUserDomain
-    );
+  get domainName(): string {
+    return configLoader.config.showUserDomainInput
+      ? localStorage.getItem("userDomainName") ||
+          configLoader.config.defaultUserDomain
+      : configLoader.config.defaultUserDomain;
   }
 
   async login(userData: Credentials): Promise<any> {

+ 1 - 1
src/stores/UserStore.ts

@@ -52,7 +52,7 @@ class UserStore {
   @observable allUsersLoading = false;
 
   get domainName(): string {
-    return UserSource.getDomainName();
+    return UserSource.domainName;
   }
 
   saveDomainName(domainName: string) {