mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 04:21:52 +00:00
chore: comanyName is now optional and added confirmPassword field
This commit is contained in:
+11
-11
@@ -32,17 +32,17 @@ export const authConfig = {
|
||||
newUser: "/sign-up",
|
||||
},
|
||||
callbacks: {
|
||||
authorized({ auth, request: { nextUrl } }) {
|
||||
const isLoggedIn = !!auth?.user;
|
||||
const isOnDashboard = nextUrl.pathname.startsWith("/");
|
||||
if (isOnDashboard) {
|
||||
if (isLoggedIn) return true;
|
||||
return false; // Redirect unauthenticated users to login page
|
||||
} else if (isLoggedIn) {
|
||||
return Response.redirect(new URL("/", nextUrl));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// authorized({ auth, request: { nextUrl } }) {
|
||||
// const isLoggedIn = !!auth?.user;
|
||||
// const isOnDashboard = nextUrl.pathname.startsWith("/");
|
||||
// if (isOnDashboard) {
|
||||
// if (isLoggedIn) return true;
|
||||
// return false; // Redirect unauthenticated users to login page
|
||||
// } else if (isLoggedIn) {
|
||||
// return Response.redirect(new URL("/", nextUrl));
|
||||
// }
|
||||
// return true;
|
||||
// },
|
||||
|
||||
jwt({ token, user }) {
|
||||
if (user) {
|
||||
|
||||
@@ -3,7 +3,8 @@ import { z } from "zod";
|
||||
export const authFormSchema = (type: string) =>
|
||||
z.object({
|
||||
// Sign Up
|
||||
companyName: type === "sign-in" ? z.string().optional() : z.string().min(3),
|
||||
companyName:
|
||||
type === "sign-in" ? z.string().optional() : z.string().min(3).optional(),
|
||||
firstName:
|
||||
type === "sign-in"
|
||||
? z.string().optional()
|
||||
@@ -13,6 +14,8 @@ export const authFormSchema = (type: string) =>
|
||||
message: "The name must be at least 3 characters.",
|
||||
})
|
||||
.max(20),
|
||||
confirmPassword:
|
||||
type === "sign-in" ? z.string().optional() : z.string().min(6),
|
||||
termsAndConditions:
|
||||
type === "sign-in"
|
||||
? z.enum(["true"]).optional()
|
||||
|
||||
Reference in New Issue
Block a user