refactor: 💡 remove dynamic component helper from form/authenticate (#3012)

* refactor: 💡 remove dynamic component helper from form/authenticate

* Add missing copyright headers
This commit is contained in:
hashicc authored and GitHub committed 2025-10-06 15:09:42 -04:00
1 parent b4f3741979
commit 240a544d82
3 files changed
+37 -5

No files matched your search

@@ -4,9 +4,8 @@
}}
{{#if @model.type}}
{{component
(concat 'form/authenticate/' @model.type)
onSubmit=@submit
disabled=@disabled
}}
<this.authenticateFormComponent
@onSubmit={{@submit}}
@disabled={{@disabled}}
/>
{{/if}}
@@ -0,0 +1,27 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
import oidc from './oidc';
import ldap from './ldap';
import password from './password';
const modelTypeToComponent = {
ldap,
password,
oidc,
};
export default class FormAuthenticateIndex extends Component {
get authenticateFormComponent() {
const component = modelTypeToComponent[this.args.model.type];
assert(
`Mapped component must exist for auth method: ${this.args.model.type}`,
component,
);
return component;
}
}
@@ -0,0 +1,6 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
export { default } from 'core/components/form/authenticate/index';