This commit is contained in:
Sebastian 2021-11-12 11:51:10 -03:00
parent 4a83e9639d
commit 377e78e854
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -38,7 +38,6 @@ export function AuthenticationEditorScreen(): VNode {
} }
const configuredAuthMethods: AuthMethod[] = const configuredAuthMethods: AuthMethod[] =
reducer.currentReducerState.authentication_methods ?? []; reducer.currentReducerState.authentication_methods ?? [];
const haveMethodsConfigured = configuredAuthMethods.length > 0;
function removeByIndex(index: number): void { function removeByIndex(index: number): void {
if (reducer) if (reducer)
@ -105,7 +104,7 @@ export function AuthenticationEditorScreen(): VNode {
onCancel={cancel} onCancel={cancel}
description="No providers founds" description="No providers founds"
label="Add a provider manually" label="Add a provider manually"
onConfirm={() => { onConfirm={async () => {
setManageProvider(selectedMethod); setManageProvider(selectedMethod);
}} }}
> >
@ -156,9 +155,7 @@ export function AuthenticationEditorScreen(): VNode {
</div> </div>
); );
} }
const errors = !haveMethodsConfigured const errors = configuredAuthMethods.length < 2 ? "There is not enough authentication methods." : undefined;
? "There is not enough authentication methods."
: undefined;
const handleNext = async () => { const handleNext = async () => {
const st = reducer.currentReducerState as ReducerStateBackup; const st = reducer.currentReducerState as ReducerStateBackup;
if ((st.authentication_methods ?? []).length <= 2) { if ((st.authentication_methods ?? []).length <= 2) {
@ -188,8 +185,8 @@ export function AuthenticationEditorScreen(): VNode {
label="Proceed anyway" label="Proceed anyway"
onConfirm={() => reducer.transition("next", {})} onConfirm={() => reducer.transition("next", {})}
> >
You have selected fewer than three authentication methods. We You have selected fewer than 3 authentication methods. We
recommend that you add at least three. recommend that you add at least 3.
</ConfirmModal> </ConfirmModal>
) : null} ) : null}
{authAvailableSet.size === 0 && ( {authAvailableSet.size === 0 && (
@ -198,7 +195,7 @@ export function AuthenticationEditorScreen(): VNode {
onCancel={() => setNoProvidersAck(true)} onCancel={() => setNoProvidersAck(true)}
description="No providers founds" description="No providers founds"
label="Add a provider manually" label="Add a provider manually"
onConfirm={() => { onConfirm={async () => {
setManageProvider(""); setManageProvider("");
}} }}
> >