-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguide.txt
96 lines (80 loc) · 2.74 KB
/
guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
personal guide of project
git config --global user.name stephmukami
git config --global user.email [email protected]
git credential-manager erase protocol=https host=gitlab.com path=/stephmukami/repo.git
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
cmdkey /delete:LegacyGeneric:target=git:https://github.com
git config --global user.name stephmukami
git config --global user.email [email protected]
git config credential.helper ‘store’
git remote add origin repolink
git remote -v
git init
git add . (Stage)
git commit -m “message” (Commit)
import { NextAuthOptions } from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import { prisma } from '@/app/lib/prisma';
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import bcrypt from 'bcrypt';
import GoogleProvider from "next-auth/providers/google";
export const authOptions: NextAuthOptions = {
session: {
strategy: "jwt",
},
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
CredentialsProvider({
name: "Credentials",
credentials: {
email: {},
password: {},
},
async authorize(credentials) {
if (!credentials?.email || !credentials?.password) {
throw new Error('Please enter an email and password');
}
const dbUser = await prisma.user.findUnique({
where: {
email: credentials.email,
},
});
if (!dbUser || !dbUser?.hashedPassword) {
return null;
}
const passwordMatch = await bcrypt.compare(credentials.password, dbUser.hashedPassword);
if (!passwordMatch) {
return null;
}
const user = {
id: dbUser.id + '',
email: dbUser.email,
name: dbUser.firstName,
};
return user;
},
}),
],
secret: process.env.NEXTAUTH_SECRET,
debug:true,
callbacks: {
jwt: async ({ user, token, trigger, session }) => {
if (trigger === "update") {
return { ...token, ...session.user };
}
return { ...token, ...user };
},
signIn: async ({ user, account, profile }) => {
if (account?.provider === "google") {
return true; // Allows the sign in
}
return true; // Don't forget to return true for other providers
},
},
};