Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fix authentication systems further
Browse files Browse the repository at this point in the history
  • Loading branch information
therealbenpai committed Jul 2, 2024
1 parent 5c78267 commit e50dbbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions views/mixins.pug
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ mixin adminNav()
a(class="py-3 ps-px sm:px-3 font-medium text-white/80 hover:text-white" href="/tokens") Tokens
a(class="py-3 ps-px sm:px-3 font-medium text-white/80 hover:text-white" href="/users") Users
unless currentUser.loggedIn
a(class="flex items-center gap-x-2 font-medium text-white/80 hover:text-white sm:border-s sm:border-white/30 py-2 md:py-0 sm:my-6 sm:ps-6" href="/auth/login")
a(class="flex items-center gap-x-2 font-medium text-white/80 hover:text-white sm:border-s sm:border-white/30 py-2 md:py-0 sm:my-6 sm:ps-6" href="https://auth.thefemdevs.com/login")
svg(class="flex-shrink-0 size-4" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round")
path(d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2")
circle(cx="12" cy="7" r="4")
| Log in
else
a(class="flex items-center gap-x-2 font-medium text-white/80 hover:text-white sm:border-s sm:border-white/30 py-2 md:py-0 sm:my-6 sm:ps-6" href="/auth/logout")
a(class="flex items-center gap-x-2 font-medium text-white/80 hover:text-white sm:border-s sm:border-white/30 py-2 md:py-0 sm:my-6 sm:ps-6" href="https://auth.thefemdevs.com/logout")
span(class="inline-flex items-center justify-center size-8 text-sm font-semibold leading-none rounded-full bg-pink-100 text-pink-800 border-solid border border-pink-500")= currentUser.user.name.initials
| #{currentUser.user.name.display}
24 changes: 8 additions & 16 deletions web/auth/auth/routes/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ router
case 'auth/user-not-found':
case 'auth/wrong-password':
case 'auth/invalid-credential':
return res.render('admin/auth/login.pug', {
return res.render('auth/login.pug', {
status: (await req.Database.getServerStatus()),
meta: {
title: 'Login',
Expand All @@ -54,7 +54,7 @@ router
default:
// eslint-disable-next-line no-console
console.log(error);
return res.render('admin/auth/login.pug', {
return res.render('auth/login.pug', {
status: (await req.Database.getServerStatus()),
meta: {
title: 'Login',
Expand Down Expand Up @@ -136,19 +136,6 @@ router
},
error: 'An account with that email address already exists',
});
case 'auth/user-not-found':
case 'auth/wrong-password':
case 'auth/invalid-credential':
return res.render('auth/register.pug', {
status: (await req.Database.getServerStatus()),
meta: {
title: 'Register',
desc: 'Join the FemDevs!',
url: 'https://auth.thefemdevs.com/register',
canonical: 'https://auth.thefemdevs.com/register',
},
error: 'We couldn\'t find an account with that email address and password',
});
default:
// eslint-disable-next-line no-console
console.log(error);
Expand Down Expand Up @@ -264,7 +251,12 @@ router
extended: true,
type: 'application/x-www-form-urlencoded',
}),
async (req, res) => { },
async (req, res) => {
req.session = Object.assign(req.session, {
user: {},
});
res.redirect('https://thefemdevs.com/');
},
)
.get('/', async (req, res) => {
res.render('auth/index.pug', {
Expand Down

0 comments on commit e50dbbd

Please sign in to comment.