MCPcopy Create free account
hub / github.com/epicweb-dev/epic-stack / signupWithConnection

Function signupWithConnection

app/utils/auth.server.ts:148–183  ·  view source on GitHub ↗
({
	email,
	username,
	name,
	providerId,
	providerName,
	imageUrl,
}: {
	email: User['email']
	username: User['username']
	name: User['name']
	providerId: Connection['providerId']
	providerName: Connection['providerName']
	imageUrl?: string
})

Source from the content-addressed store, hash-verified

146}
147
148export async function signupWithConnection({
149 email,
150 username,
151 name,
152 providerId,
153 providerName,
154 imageUrl,
155}: {
156 email: User['email']
157 username: User['username']
158 name: User['name']
159 providerId: Connection['providerId']
160 providerName: Connection['providerName']
161 imageUrl?: string
162}) {
163 const session = await prisma.session.create({
164 data: {
165 expirationDate: getSessionExpirationDate(),
166 user: {
167 create: {
168 email: email.toLowerCase(),
169 username: username.toLowerCase(),
170 name,
171 roles: { connect: { name: 'user' } },
172 connections: { create: { providerId, providerName } },
173 image: imageUrl
174 ? { create: await downloadFile(imageUrl) }
175 : undefined,
176 },
177 },
178 },
179 select: { id: true, expirationDate: true },
180 })
181
182 return session
183}
184
185export async function logout(
186 {

Callers 1

actionFunction · 0.90

Calls 2

downloadFileFunction · 0.90
getSessionExpirationDateFunction · 0.85

Tested by

no test coverage detected