Skip to content

Commit

Permalink
fix: restrict authentication of users
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosllz committed Dec 1, 2023
1 parent b3161fa commit fa2b6da
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/app/api/auth/[...nextauth]/auth-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ export const authOptions: NextAuthOptions = {

return session
},
signIn({ user }) {
const availableEmails = ['[email protected]']

if (availableEmails.includes(user.email)) {
return true
}

return false
},
},
session: {
strategy: 'jwt',
Expand Down
30 changes: 29 additions & 1 deletion src/app/auth/error/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
import { Button } from '@/components/ui/button'
import { Card, CardContent } from '@/components/ui/card'
import { Settings } from 'lucide-react'
import Link from 'next/link'

export default function SignInError() {
return <h1>Error</h1>
return (
<div className="wrapper">
<div className="flex items-center justify-center page-container">
<Card>
<CardContent className="mt-6 flex flex-col items-center justify-center gap-6">
<Settings size={24} className="animate-spin" />

<div>
<span className="block text-2xl font-semibold">
A plataforma ainda está em construção
</span>
<span className="block text-center text-muted-foreground">
O acesso é limite somente a alguns usuário
</span>
</div>

<Button asChild>
<Link href="/">Voltar para a página inicial</Link>
</Button>
</CardContent>
</Card>
</div>
</div>
)
}

0 comments on commit fa2b6da

Please sign in to comment.