mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
* 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
77 lines
1.7 KiB
TypeScript
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,
|
|
};
|
|
};
|