[GIT-66] improvement: prevent disabling last enabled authentication method (#8570)
This commit is contained in:
parent
f7d5200ed8
commit
32a2584578
7 changed files with 167 additions and 127 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import type { TExtendedInstanceAuthenticationModeKeys } from "./auth-ee";
|
||||
|
||||
export type TCoreInstanceAuthenticationModeKeys =
|
||||
| "unique-codes"
|
||||
| "passwords-login"
|
||||
|
|
@ -8,9 +6,7 @@ export type TCoreInstanceAuthenticationModeKeys =
|
|||
| "gitlab"
|
||||
| "gitea";
|
||||
|
||||
export type TInstanceAuthenticationModeKeys =
|
||||
| TCoreInstanceAuthenticationModeKeys
|
||||
| TExtendedInstanceAuthenticationModeKeys;
|
||||
export type TInstanceAuthenticationModeKeys = TCoreInstanceAuthenticationModeKeys;
|
||||
|
||||
export type TInstanceAuthenticationModes = {
|
||||
key: TInstanceAuthenticationModeKeys;
|
||||
|
|
@ -18,6 +14,7 @@ export type TInstanceAuthenticationModes = {
|
|||
description: string;
|
||||
icon: React.ReactNode;
|
||||
config: React.ReactNode;
|
||||
enabledConfigKey: TInstanceAuthenticationMethodKeys;
|
||||
unavailable?: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ export type TOAuthOption = {
|
|||
type OAuthOptionsProps = {
|
||||
options: TOAuthOption[];
|
||||
compact?: boolean;
|
||||
|
||||
showDivider?: boolean;
|
||||
className?: string;
|
||||
containerClassName?: string;
|
||||
};
|
||||
|
||||
export function OAuthOptions(props: OAuthOptionsProps) {
|
||||
const { options, compact = false, className = "", containerClassName = "" } = props;
|
||||
const { options, compact = false, showDivider = true, className = "", containerClassName = "" } = props;
|
||||
|
||||
// Filter enabled options
|
||||
const enabledOptions = options.filter((option) => option.enabled !== false);
|
||||
|
|
@ -47,11 +47,13 @@ export function OAuthOptions(props: OAuthOptionsProps) {
|
|||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-4 flex items-center transition-all duration-300">
|
||||
<hr className="w-full border-strong transition-colors duration-300" />
|
||||
<p className="mx-3 flex-shrink-0 text-center text-13 text-placeholder transition-colors duration-300">or</p>
|
||||
<hr className="w-full border-strong transition-colors duration-300" />
|
||||
</div>
|
||||
{showDivider && (
|
||||
<div className="mt-4 flex items-center transition-all duration-300">
|
||||
<hr className="w-full border-strong transition-colors duration-300" />
|
||||
<p className="mx-3 flex-shrink-0 text-center text-13 text-placeholder transition-colors duration-300">or</p>
|
||||
<hr className="w-full border-strong transition-colors duration-300" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue