Change redirections when not logged in

This commit is contained in:
Thomas Miceli 2023-04-12 13:30:51 +02:00
parent ab59d7956a
commit 51dadcecef
No known key found for this signature in database
GPG key ID: D86C6F6390AF050F
2 changed files with 3 additions and 3 deletions

View file

@ -300,7 +300,7 @@ func logged(next echo.HandlerFunc) echo.HandlerFunc {
if user != nil { if user != nil {
return next(ctx) return next(ctx)
} }
return redirect(ctx, "/all") return redirect(ctx, "/login")
} }
} }

View file

@ -43,8 +43,8 @@
<div class="hidden sm:block sm:ml-6"> <div class="hidden sm:block sm:ml-6">
<div class="flex space-x-4"> <div class="flex space-x-4">
<a href="/all" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">All</a> <a href="/all" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">All</a>
{{ if .userLogged }}
<a href="/" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">New</a> <a href="/" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">New</a>
{{ if .userLogged }}
<a href="/{{ .userLogged.Username }}" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">My gists</a> <a href="/{{ .userLogged.Username }}" class="text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">My gists</a>
{{ end }} {{ end }}
</div> </div>
@ -85,8 +85,8 @@
<div class="sm:hidden hidden" id="mobile-menu"> <div class="sm:hidden hidden" id="mobile-menu">
<div class="px-2 pt-2 pb-3 space-y-1"> <div class="px-2 pt-2 pb-3 space-y-1">
<a href="/all" class="bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium" aria-current="page">All</a> <a href="/all" class="bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium" aria-current="page">All</a>
{{ if .userLogged }}
<a href="/" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">New</a> <a href="/" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">New</a>
{{ if .userLogged }}
<a href="/{{ .userLogged.Username }}" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">My gists</a> <a href="/{{ .userLogged.Username }}" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">My gists</a>
<a href="/settings" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">Settings</a> <a href="/settings" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">Settings</a>