Carter 2e6ad5da8e
Feature: Add "Authentication Method" to allow existing users to sign in with LDAP (#2143)
* adds authentication method for users

* fix db migration with postgres

* tests for auth method

* update migration ids

* hide auth method on user creation form

* (docs): Added documentation for the new authentication method

* update migration

* add  to auto-form instead of having hidden fields
2023-02-26 10:12:16 -09:00

77 lines
1.7 KiB
TypeScript

import { fieldTypes } from "../forms";
import { AutoFormItems } from "~/types/auto-forms";
export const useUserForm = () => {
const userForm: AutoFormItems = [
{
section: "User Details",
label: "User Name",
varName: "username",
type: fieldTypes.TEXT,
rules: ["required"],
},
{
label: "Full Name",
varName: "fullName",
type: fieldTypes.TEXT,
rules: ["required"],
},
{
label: "Email",
varName: "email",
type: fieldTypes.TEXT,
rules: ["required"],
},
{
label: "Password",
varName: "password",
disableUpdate: true,
type: fieldTypes.PASSWORD,
rules: ["required", "minLength:8"],
},
{
label: "Authentication Method",
varName: "authMethod",
type: fieldTypes.SELECT,
hint: "This specifies how a user will authenticate with Mealie. If you're not sure, choose 'Mealie'",
disableCreate: true,
options: [{ text: "Mealie" }, { text: "LDAP" }],
},
{
section: "Permissions",
label: "Administrator",
varName: "admin",
type: fieldTypes.BOOLEAN,
rules: ["required"],
},
{
label: "User can invite other to group",
varName: "canInvite",
type: fieldTypes.BOOLEAN,
rules: ["required"],
},
{
label: "User can manage group",
varName: "canManage",
type: fieldTypes.BOOLEAN,
rules: ["required"],
},
{
label: "User can organize group data",
varName: "canOrganize",
type: fieldTypes.BOOLEAN,
rules: ["required"],
},
{
label: "Enable advanced features",
varName: "advanced",
type: fieldTypes.BOOLEAN,
rules: ["required"],
},
];
return {
userForm,
};
};