跳到主内容

指定登录组织

在这里,我们将向您展示如何启用为应用指定登录组织的选项。

例如,端点/login是属于内置组织的账户的默认登录页面。 然而,您可以在属于内置组织的app-built-in应用上启用指定登录组织的选项。 这允许用户在登录时选择一个组织。 用户选择组织后,他们将被重定向到/login/<organization>

Configuration

在应用编辑页面上,您可以找到Org select mode配置选项。 您可以从下拉列表中选择模式。

mode_config

  • 无:不会显示组织选择页面。
  • 输入:用户可以在输入框中输入组织名称。
  • 选择:用户可以从下拉列表中选择组织。

mode_input

mode_select

信息

The organization select page will only be shown when the route is /login or <organization>/login. 这意味着应用应该在组织或app-built-in中设置为默认应用

Automatic Organization Redirect

When a user's session expires, Casdoor remembers which organization they last used and automatically redirects them to that organization's login page. This saves time by eliminating the need to select the organization again after a session timeout.

The organization context is stored in the browser's localStorage when you visit an organization-specific login page (e.g., /login/my-org). When your session expires and you need to log in again, Casdoor automatically redirects you to that same organization's login page instead of the generic /login page.

If no organization context is found in localStorage, you'll be redirected to the default /login page where you can select an organization using the configured mode (Input or Select) if enabled.