mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-03-19 15:18:02 -04:00
Add full name to form detector (#622)
This commit is contained in:
@@ -66,6 +66,10 @@ export function fillCredential(credential: Credential, input: HTMLInputElement)
|
||||
form.emailConfirmField.value = credential.Email;
|
||||
triggerInputEvents(form.emailConfirmField);
|
||||
}
|
||||
if (form.fullNameField) {
|
||||
form.fullNameField.value = `${credential.Alias.FirstName} ${credential.Alias.LastName}`;
|
||||
triggerInputEvents(form.fullNameField);
|
||||
}
|
||||
if (form.firstNameField) {
|
||||
form.firstNameField.value = credential.Alias.FirstName;
|
||||
triggerInputEvents(form.firstNameField);
|
||||
|
||||
@@ -5,6 +5,7 @@ export type FieldPatterns = {
|
||||
username: string[];
|
||||
firstName: string[];
|
||||
lastName: string[];
|
||||
fullName: string[];
|
||||
email: string[];
|
||||
emailConfirm: string[];
|
||||
password: string[];
|
||||
@@ -29,6 +30,7 @@ export type GenderOptionPatterns = {
|
||||
*/
|
||||
export const EnglishFieldPatterns: FieldPatterns = {
|
||||
username: ['username', 'login', 'identifier', 'user'],
|
||||
fullName: ['fullname', 'full-name', 'full name'],
|
||||
firstName: ['firstname', 'first-name', 'fname', 'name', 'given-name'],
|
||||
lastName: ['lastname', 'last-name', 'lname', 'surname', 'family-name'],
|
||||
email: ['email', 'mail', 'emailaddress'],
|
||||
@@ -55,6 +57,7 @@ export const EnglishGenderOptionPatterns: GenderOptionPatterns = {
|
||||
*/
|
||||
export const DutchFieldPatterns: FieldPatterns = {
|
||||
username: ['gebruikersnaam', 'gebruiker', 'login', 'identifier'],
|
||||
fullName: ['volledige naam'],
|
||||
firstName: ['voornaam', 'naam'],
|
||||
lastName: ['achternaam'],
|
||||
email: ['e-mailadres', 'e-mail'],
|
||||
@@ -81,6 +84,7 @@ export const DutchGenderOptionPatterns: GenderOptionPatterns = {
|
||||
*/
|
||||
export const CombinedFieldPatterns: FieldPatterns = {
|
||||
username: [...new Set([...EnglishFieldPatterns.username, ...DutchFieldPatterns.username])],
|
||||
fullName: [...new Set([...EnglishFieldPatterns.fullName, ...DutchFieldPatterns.fullName])],
|
||||
firstName: [...new Set([...EnglishFieldPatterns.firstName, ...DutchFieldPatterns.firstName])],
|
||||
lastName: [...new Set([...EnglishFieldPatterns.lastName, ...DutchFieldPatterns.lastName])],
|
||||
/**
|
||||
|
||||
@@ -428,6 +428,11 @@ export class FormDetector {
|
||||
detectedFields.push(usernameField);
|
||||
}
|
||||
|
||||
const fullNameField = this.findInputField(wrapper as HTMLFormElement | null, CombinedFieldPatterns.fullName, ['text'], detectedFields);
|
||||
if (fullNameField) {
|
||||
detectedFields.push(fullNameField);
|
||||
}
|
||||
|
||||
const firstNameField = this.findInputField(wrapper as HTMLFormElement | null, CombinedFieldPatterns.firstName, ['text'], detectedFields);
|
||||
if (firstNameField) {
|
||||
detectedFields.push(firstNameField);
|
||||
@@ -464,6 +469,7 @@ export class FormDetector {
|
||||
usernameField,
|
||||
passwordField: passwordFields.primary,
|
||||
passwordConfirmField: passwordFields.confirm,
|
||||
fullNameField,
|
||||
firstNameField,
|
||||
lastNameField,
|
||||
birthdateField,
|
||||
|
||||
@@ -7,6 +7,7 @@ export type FormFields = {
|
||||
passwordConfirmField: HTMLInputElement | null;
|
||||
|
||||
// Identity fields
|
||||
fullNameField: HTMLInputElement | null;
|
||||
firstNameField: HTMLInputElement | null;
|
||||
lastNameField: HTMLInputElement | null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user