authverse 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/index.cjs +595 -445
- package/dist/index.js +588 -438
- package/dist/template/TanstackState/components/LoginComponent.tsx +0 -1
- package/dist/template/components/LoginComponent.tsx +18 -15
- package/dist/template/components/SingUpComponent.tsx +20 -20
- package/package.json +7 -13
- package/dist/template/components/Logout.tsx +0 -21
- package/dist/template/server/user.ts +0 -49
|
@@ -4,7 +4,6 @@ import { Controller, useForm } from "react-hook-form";
|
|
|
4
4
|
import { toast } from "sonner";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
7
|
-
|
|
8
7
|
import { Button } from "@/components/ui/button";
|
|
9
8
|
import {
|
|
10
9
|
Card,
|
|
@@ -23,8 +22,8 @@ import {
|
|
|
23
22
|
import { Input } from "@/components/ui/input";
|
|
24
23
|
import Link from "next/link";
|
|
25
24
|
import { useState } from "react";
|
|
26
|
-
import { signIn } from "@/server/user";
|
|
27
25
|
import { useRouter } from "next/navigation";
|
|
26
|
+
import { authClient } from "@/lib/auth-client";
|
|
28
27
|
|
|
29
28
|
const formSchema = z.object({
|
|
30
29
|
email: z.string().email(),
|
|
@@ -47,20 +46,24 @@ const LoginComponent = () => {
|
|
|
47
46
|
|
|
48
47
|
const onSubmit = async (data: z.infer<typeof formSchema>) => {
|
|
49
48
|
setIsLoading(true);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
await authClient.signIn.email(
|
|
50
|
+
{
|
|
51
|
+
email: data.email,
|
|
52
|
+
password: data.password,
|
|
53
|
+
callbackURL: "/",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
onSuccess: (data) => {
|
|
57
|
+
toast.success("Login successful!");
|
|
58
|
+
setIsLoading(false);
|
|
59
|
+
router.push("/");
|
|
60
|
+
},
|
|
61
|
+
onError: (error: any) => {
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
toast.error(error.error.message);
|
|
64
|
+
},
|
|
58
65
|
}
|
|
59
|
-
|
|
60
|
-
} catch (error: any) {
|
|
61
|
-
toast.error(error.message);
|
|
62
|
-
setIsLoading(false);
|
|
63
|
-
}
|
|
66
|
+
);
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
return (
|
|
@@ -4,7 +4,6 @@ import { Controller, useForm } from "react-hook-form";
|
|
|
4
4
|
import { toast } from "sonner";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
7
|
-
|
|
8
7
|
import { Button } from "@/components/ui/button";
|
|
9
8
|
import {
|
|
10
9
|
Card,
|
|
@@ -23,14 +22,14 @@ import {
|
|
|
23
22
|
import { Input } from "@/components/ui/input";
|
|
24
23
|
import Link from "next/link";
|
|
25
24
|
import { useState } from "react";
|
|
26
|
-
import { signUp } from "@/server/user";
|
|
27
25
|
import { useRouter } from "next/navigation";
|
|
26
|
+
import { authClient } from "@/lib/auth-client";
|
|
28
27
|
|
|
29
28
|
const formSchema = z.object({
|
|
30
29
|
name: z.string().min(3, {
|
|
31
30
|
message: "Name must be at least 3 characters",
|
|
32
31
|
}),
|
|
33
|
-
email: z.
|
|
32
|
+
email: z.email(),
|
|
34
33
|
password: z.string().min(8, {
|
|
35
34
|
message: "Password must be at least 8 characters",
|
|
36
35
|
}),
|
|
@@ -51,24 +50,25 @@ const SingUpComponent = () => {
|
|
|
51
50
|
|
|
52
51
|
const onSubmit = async (data: z.infer<typeof formSchema>) => {
|
|
53
52
|
setIsLoading(true);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data.name,
|
|
57
|
-
data.email,
|
|
58
|
-
data.password
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
await authClient.signUp.email(
|
|
54
|
+
{
|
|
55
|
+
name: data.name,
|
|
56
|
+
email: data.email,
|
|
57
|
+
password: data.password,
|
|
58
|
+
callbackURL: "/",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
onSuccess: () => {
|
|
62
|
+
toast.success("Sign up successful!");
|
|
63
|
+
setIsLoading(false);
|
|
64
|
+
router.push("/");
|
|
65
|
+
},
|
|
66
|
+
onError: (error: any) => {
|
|
67
|
+
setIsLoading(false);
|
|
68
|
+
toast.error(error.error.message);
|
|
69
|
+
},
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
} catch (error: any) {
|
|
69
|
-
toast.error(error.message);
|
|
70
|
-
setIsLoading(false);
|
|
71
|
-
}
|
|
71
|
+
);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
return (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authverse",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Authverse Fast modern CLI to generate full auth systems with OAuth Prisma Drizzle better auth and ready-to-use ShadCN UI screens",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/abdirahmanmahamoud/authverse.git",
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && cp -r ../template ./dist/template",
|
|
23
|
-
"build:
|
|
24
|
-
"
|
|
25
|
-
"semantic-release": "semantic-release"
|
|
23
|
+
"build:win": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && xcopy ..\\template dist\\template /E /I /Y && npm link",
|
|
24
|
+
"clear": "pnpm dlx rimraf dist"
|
|
26
25
|
},
|
|
27
26
|
"publishConfig": {
|
|
28
27
|
"access": "public"
|
|
@@ -50,15 +49,10 @@
|
|
|
50
49
|
"inquirer": "^12.10.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"@semantic-release/npm": "^13.1.2",
|
|
58
|
-
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
59
|
-
"@types/node": "^25.0.6",
|
|
60
|
-
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
61
|
-
"semantic-release": "^25.0.2",
|
|
52
|
+
"@commitlint/cli": "^20.3.1",
|
|
53
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
54
|
+
"@types/node": "^25.2.1",
|
|
55
|
+
"changelogithub": "^14.0.0",
|
|
62
56
|
"tsup": "^8.5.0",
|
|
63
57
|
"typescript": "^5.9.3"
|
|
64
58
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Button } from "@/components/ui/button";
|
|
3
|
-
import { authClient } from "@/lib/auth-client";
|
|
4
|
-
import { LogOutIcon } from "lucide-react";
|
|
5
|
-
import { useRouter } from "next/navigation";
|
|
6
|
-
|
|
7
|
-
const Logout = () => {
|
|
8
|
-
const router = useRouter();
|
|
9
|
-
const handleLogout = async () => {
|
|
10
|
-
await authClient.signOut();
|
|
11
|
-
router.push("/auth/login");
|
|
12
|
-
};
|
|
13
|
-
return (
|
|
14
|
-
<Button variant="outline" onClick={handleLogout}>
|
|
15
|
-
<LogOutIcon className="mr-1 h-4 w-4" />
|
|
16
|
-
Logout
|
|
17
|
-
</Button>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default Logout;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { auth } from "@/lib/auth";
|
|
3
|
-
|
|
4
|
-
export const signIn = async (email: string, password: string) => {
|
|
5
|
-
try {
|
|
6
|
-
await auth.api.signInEmail({
|
|
7
|
-
body: {
|
|
8
|
-
email,
|
|
9
|
-
password,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
success: true,
|
|
15
|
-
message: "Login successfully.",
|
|
16
|
-
};
|
|
17
|
-
} catch (error) {
|
|
18
|
-
const e = error as Error;
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
success: false,
|
|
22
|
-
message: e.message || "An unknown error occurred.",
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const signUp = async (name: string, email: string, password: string) => {
|
|
28
|
-
try {
|
|
29
|
-
await auth.api.signUpEmail({
|
|
30
|
-
body: {
|
|
31
|
-
name,
|
|
32
|
-
email,
|
|
33
|
-
password,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
success: true,
|
|
39
|
-
message: "Signed up successfully.",
|
|
40
|
-
};
|
|
41
|
-
} catch (error) {
|
|
42
|
-
const e = error as Error;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
message: e.message || "An unknown error occurred.",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
};
|