mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 15:11:07 +02:00
* move auth tests to folder * polish auth tests * build auth::form-template component * add components for other supported methods * add comments, add tests * convert to typesript * conver base.js to typescript * use getRelativePath helper * fix logic for hiding advanced settings toggle, use getter for selecting tab index * update tests * how in the heck did that happen * add punctuation to comments, clarify var name * update loginFields to array of objects * update tests * add helper text and custom label tests * woops, test was in the beforeEach block
35 lines
888 B
TypeScript
35 lines
888 B
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
// TODO pending feedback from the security team, we may keep autocomplete="off" for login fields
|
|
|
|
import Component from '@glimmer/component';
|
|
|
|
interface Args {
|
|
loginFields: Field[];
|
|
}
|
|
|
|
interface Field {
|
|
name: string; // sets input name
|
|
label?: string; // label will be "name" capitalized unless label exists
|
|
helperText?: string;
|
|
}
|
|
|
|
export default class AuthFields extends Component<Args> {
|
|
// token or password should render as "password" types, otherwise render text inputs
|
|
setInputType = (field: string) => (['token', 'password'].includes(field) ? 'password' : 'text');
|
|
|
|
setAutocomplete = (fieldName: string) => {
|
|
switch (fieldName) {
|
|
case 'password':
|
|
return 'current-password';
|
|
case 'token':
|
|
return 'off';
|
|
default:
|
|
return fieldName;
|
|
}
|
|
};
|
|
}
|