Try fix: account does not exist in db because cookie session corrupted
- commit
- 9d5ed53f1daea150c39a92b26909370728b39d08
- author
- bnema · · 2023-11-03 18:26 UTC
- parent
- fb12026
- signature
- unsigned
2 files · +62 -49
M internal/httpserve/middleware/requirelogin.go +1 -1
| @@ -16,7 +16,7 @@ func RequireLogin(a *server.App) echo.MiddlewareFunc { | |||
| 16 | 16 | return func(next echo.HandlerFunc) echo.HandlerFunc { | |
| 17 | 17 | return func(c echo.Context) error { | |
| 18 | 18 | if err := validateSessionAndUser(c, a); err != nil { | |
| 19 | - | return DeleteCookieAndRedirectToLogin(c, a) | |
| 19 | + | return redirectToLogin(c, a) | |
| 20 | 20 | } | |
| 21 | 21 | return next(c) | |
| 22 | 22 | } | |
| @@ -16,7 +16,7 @@ func RequireLogin(a *server.App) echo.MiddlewareFunc { | |||||
| 16 | return func(next echo.HandlerFunc) echo.HandlerFunc { | 16 | return func(next echo.HandlerFunc) echo.HandlerFunc { | ||
| 17 | return func(c echo.Context) error { | 17 | return func(c echo.Context) error { | ||
| 18 | if err := validateSessionAndUser(c, a); err != nil { | 18 | if err := validateSessionAndUser(c, a); err != nil { | ||
| 19 | - | return DeleteCookieAndRedirectToLogin(c, a) | 19 | + | return redirectToLogin(c, a) |
| 20 | } | 20 | } | ||
| 21 | return next(c) | 21 | return next(c) | ||
| 22 | } | 22 | } | ||
M internal/templating/models/html/login/index.gohtml +61 -48
| @@ -1,55 +1,68 @@ | |||
| 1 | - | <!DOCTYPE html> | |
| 1 | + | <!doctype html> | |
| 2 | 2 | <html lang="en"> | |
| 3 | + | <head> | |
| 4 | + | <meta charset="UTF-8" /> | |
| 5 | + | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| 6 | + | <title>{{ .header.meta.title }}</title> | |
| 7 | + | <meta name="description" content="{{ .Header.Meta.Description }}" /> | |
| 8 | + | <meta name="keywords" content="{{ .Header.Meta.Keywords }}" /> | |
| 9 | + | <!-- Custom CSS + Tailwind --> | |
| 10 | + | <link rel="stylesheet" href="/assets/css/tailwind.css" /> | |
| 11 | + | <!-- Iconoir --> | |
| 12 | + | <link rel="stylesheet" href="/libs/iconoir.css" /> | |
| 13 | + | <!-- Alpine --> | |
| 14 | + | <script src="/libs/alpine.min.js"></script> | |
| 15 | + | <!-- HTMX min js --> | |
| 16 | + | <script src="/libs/htmx.min.js"></script> | |
| 17 | + | <!-- HTMX SSE --> | |
| 18 | + | <script src="/libs/htmx-sse.js"></script> | |
| 19 | + | <!-- Custom JS from assets/js --> | |
| 20 | + | <script src="/assets/js/custom.js"></script> | |
| 21 | + | </head> | |
| 3 | 22 | ||
| 4 | - | <head> | |
| 5 | - | <meta charset="UTF-8" /> | |
| 6 | - | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| 7 | - | <title>{{ .header.meta.title }}</title> | |
| 8 | - | <meta name="description" content="{{ .Header.Meta.Description }}" /> | |
| 9 | - | <meta name="keywords" content="{{ .Header.Meta.Keywords }}" /> | |
| 10 | - | <!-- Custom CSS + Tailwind --> | |
| 11 | - | <link rel="stylesheet" href="/assets/css/tailwind.css" /> | |
| 12 | - | <!-- Iconoir --> | |
| 13 | - | <link rel="stylesheet" href="/libs/iconoir.css" /> | |
| 14 | - | <!-- Alpine --> | |
| 15 | - | <script src="/libs/alpine.min.js"></script> | |
| 16 | - | <!-- HTMX min js --> | |
| 17 | - | <script src="/libs/htmx.min.js"></script> | |
| 18 | - | <!-- HTMX SSE --> | |
| 19 | - | <script src="/libs/htmx-sse.js"></script> | |
| 20 | - | <!-- Custom JS from assets/js --> | |
| 21 | - | <script src="/assets/js/custom.js"></script> | |
| 22 | - | </head> | |
| 23 | - | ||
| 24 | - | <body class="IBMPlexSans bg-zinc-200 md:p-8 flex flex-col items-center"> | |
| 25 | - | <!-- Logo and Title --> | |
| 26 | - | <div id="logo-mascot" class="flex flex-col justify-center items-center p-4 mb-4"> | |
| 27 | - | <div class="circle-shadow flex justify-center w-100"> | |
| 28 | - | <img src="/assets/imgs/gordon-mascot-hq-trsp.png" alt="logo gordon" class="sm:h-24 h-32 xl:h-48" /> | |
| 29 | - | </div> | |
| 30 | - | <div class="flex justify-center mt-4"> | |
| 31 | - | <h1 class="gordon-title text-4xl lg:text-4xl xl:text-5xl text-gordonmascot-hblue tracking-tighter">Gordon</h1> | |
| 32 | - | <span class="gordon-v-subtitle text-gordonmascot-mblue text-sm ml-2">{{ .BuildVersion }}</span> | |
| 23 | + | <body class="IBMPlexSans bg-zinc-200 md:p-8 flex flex-col items-center"> | |
| 24 | + | <!-- Logo and Title --> | |
| 25 | + | <div | |
| 26 | + | id="logo-mascot" | |
| 27 | + | class="flex flex-col justify-center items-center p-4 mb-4"> | |
| 28 | + | <div class="circle-shadow flex justify-center w-100"> | |
| 29 | + | <img | |
| 30 | + | src="/assets/imgs/gordon-mascot-mq-trsp.png" | |
| 31 | + | alt="logo gordon" | |
| 32 | + | class="sm:h-24 h-32 xl:h-48" /> | |
| 33 | + | </div> | |
| 34 | + | <div class="flex justify-center mt-4"> | |
| 35 | + | <h1 | |
| 36 | + | class="gordon-title text-4xl lg:text-4xl xl:text-5xl text-gordonmascot-hblue tracking-tighter"> | |
| 37 | + | Gordon | |
| 38 | + | </h1> | |
| 39 | + | <span | |
| 40 | + | class="gordon-v-subtitle text-gordonmascot-mblue text-sm ml-2" | |
| 41 | + | >{{ .BuildVersion }}</span | |
| 42 | + | > | |
| 43 | + | </div> | |
| 33 | 44 | </div> | |
| 34 | - | </div> | |
| 35 | 45 | ||
| 36 | - | <!-- Main Content --> | |
| 37 | - | <div class="bg-white p-4 rounded-md shadow mb-4 w-2/3"> | |
| 38 | - | <!-- Login Section --> | |
| 39 | - | <div id="login-section"> | |
| 40 | - | <div class="flex flex-col items-center"> | |
| 41 | - | <h2 class="text-2xl font-semibold text-gray-800">Login</h2> | |
| 42 | - | <!-- GitHub OAuth --> | |
| 43 | - | <div class="mt-4 p-2 bg-gordonmascot-hblue text-white rounded-md flex justify-left"> | |
| 44 | - | <a href="login/oauth/github" class="flex items-center"> | |
| 45 | - | <img src="/assets/imgs/github/github-mark-white.png" alt="logo github" class="h-8 xl:h-12" /> | |
| 46 | - | <span class="w-full p-2 text-white ">Login with GitHub</span> | |
| 47 | - | </a> | |
| 46 | + | <!-- Main Content --> | |
| 47 | + | <div class="bg-white p-4 rounded-md shadow mb-4 w-2/3"> | |
| 48 | + | <!-- Login Section --> | |
| 49 | + | <div id="login-section"> | |
| 50 | + | <div class="flex flex-col items-center"> | |
| 51 | + | <h2 class="text-2xl font-semibold text-gray-800">Login</h2> | |
| 52 | + | <!-- GitHub OAuth --> | |
| 53 | + | <div | |
| 54 | + | class="mt-4 p-2 bg-gordonmascot-hblue text-white rounded-md flex justify-left"> | |
| 55 | + | <a href="login/oauth/github" class="flex items-center"> | |
| 56 | + | <img | |
| 57 | + | src="/assets/imgs/github/github-mark-white.png" | |
| 58 | + | alt="logo github" | |
| 59 | + | class="h-8 xl:h-12" /> | |
| 60 | + | <span class="w-full p-2 text-white">Login with GitHub</span> | |
| 61 | + | </a> | |
| 62 | + | </div> | |
| 48 | 63 | </div> | |
| 49 | 64 | </div> | |
| 65 | + | <!-- End Login Section --> | |
| 50 | 66 | </div> | |
| 51 | - | <!-- End Login Section --> | |
| 52 | - | </div> | |
| 53 | - | </body> | |
| 54 | - | ||
| 55 | - | </html>⏎̸ | |
| 67 | + | </body> | |
| 68 | + | </html> | |
| @@ -1,55 +1,68 @@ | |||||
| 1 | - | <!DOCTYPE html> | 1 | + | <!doctype html> |
| 2 | <html lang="en"> | 2 | <html lang="en"> | ||
| 3 | + | <head> | |||
| 4 | + | <meta charset="UTF-8" /> | |||
| 5 | + | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||
| 6 | + | <title>{{ .header.meta.title }}</title> | |||
| 7 | + | <meta name="description" content="{{ .Header.Meta.Description }}" /> | |||
| 8 | + | <meta name="keywords" content="{{ .Header.Meta.Keywords }}" /> | |||
| 9 | + | <!-- Custom CSS + Tailwind --> | |||
| 10 | + | <link rel="stylesheet" href="/assets/css/tailwind.css" /> | |||
| 11 | + | <!-- Iconoir --> | |||
| 12 | + | <link rel="stylesheet" href="/libs/iconoir.css" /> | |||
| 13 | + | <!-- Alpine --> | |||
| 14 | + | <script src="/libs/alpine.min.js"></script> | |||
| 15 | + | <!-- HTMX min js --> | |||
| 16 | + | <script src="/libs/htmx.min.js"></script> | |||
| 17 | + | <!-- HTMX SSE --> | |||
| 18 | + | <script src="/libs/htmx-sse.js"></script> | |||
| 19 | + | <!-- Custom JS from assets/js --> | |||
| 20 | + | <script src="/assets/js/custom.js"></script> | |||
| 21 | + | </head> | |||
| 3 | 22 | ||||
| 4 | - | <head> | 23 | + | <body class="IBMPlexSans bg-zinc-200 md:p-8 flex flex-col items-center"> |
| 5 | - | <meta charset="UTF-8" /> | 24 | + | <!-- Logo and Title --> |
| 6 | - | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | 25 | + | <div |
| 7 | - | <title>{{ .header.meta.title }}</title> | 26 | + | id="logo-mascot" |
| 8 | - | <meta name="description" content="{{ .Header.Meta.Description }}" /> | 27 | + | class="flex flex-col justify-center items-center p-4 mb-4"> |
| 9 | - | <meta name="keywords" content="{{ .Header.Meta.Keywords }}" /> | 28 | + | <div class="circle-shadow flex justify-center w-100"> |
| 10 | - | <!-- Custom CSS + Tailwind --> | 29 | + | <img |
| 11 | - | <link rel="stylesheet" href="/assets/css/tailwind.css" /> | 30 | + | src="/assets/imgs/gordon-mascot-mq-trsp.png" |
| 12 | - | <!-- Iconoir --> | 31 | + | alt="logo gordon" |
| 13 | - | <link rel="stylesheet" href="/libs/iconoir.css" /> | 32 | + | class="sm:h-24 h-32 xl:h-48" /> |
| 14 | - | <!-- Alpine --> | 33 | + | </div> |
| 15 | - | <script src="/libs/alpine.min.js"></script> | 34 | + | <div class="flex justify-center mt-4"> |
| 16 | - | <!-- HTMX min js --> | 35 | + | <h1 |
| 17 | - | <script src="/libs/htmx.min.js"></script> | 36 | + | class="gordon-title text-4xl lg:text-4xl xl:text-5xl text-gordonmascot-hblue tracking-tighter"> |
| 18 | - | <!-- HTMX SSE --> | 37 | + | Gordon |
| 19 | - | <script src="/libs/htmx-sse.js"></script> | 38 | + | </h1> |
| 20 | - | <!-- Custom JS from assets/js --> | 39 | + | <span |
| 21 | - | <script src="/assets/js/custom.js"></script> | 40 | + | class="gordon-v-subtitle text-gordonmascot-mblue text-sm ml-2" |
| 22 | - | </head> | 41 | + | >{{ .BuildVersion }}</span |
| 23 | - | 42 | + | > | |
| 24 | - | <body class="IBMPlexSans bg-zinc-200 md:p-8 flex flex-col items-center"> | 43 | + | </div> |
| 25 | - | <!-- Logo and Title --> | |||
| 26 | - | <div id="logo-mascot" class="flex flex-col justify-center items-center p-4 mb-4"> | |||
| 27 | - | <div class="circle-shadow flex justify-center w-100"> | |||
| 28 | - | <img src="/assets/imgs/gordon-mascot-hq-trsp.png" alt="logo gordon" class="sm:h-24 h-32 xl:h-48" /> | |||
| 29 | - | </div> | |||
| 30 | - | <div class="flex justify-center mt-4"> | |||
| 31 | - | <h1 class="gordon-title text-4xl lg:text-4xl xl:text-5xl text-gordonmascot-hblue tracking-tighter">Gordon</h1> | |||
| 32 | - | <span class="gordon-v-subtitle text-gordonmascot-mblue text-sm ml-2">{{ .BuildVersion }}</span> | |||
| 33 | </div> | 44 | </div> | ||
| 34 | - | </div> | |||
| 35 | 45 | ||||
| 36 | - | <!-- Main Content --> | 46 | + | <!-- Main Content --> |
| 37 | - | <div class="bg-white p-4 rounded-md shadow mb-4 w-2/3"> | 47 | + | <div class="bg-white p-4 rounded-md shadow mb-4 w-2/3"> |
| 38 | - | <!-- Login Section --> | 48 | + | <!-- Login Section --> |
| 39 | - | <div id="login-section"> | 49 | + | <div id="login-section"> |
| 40 | - | <div class="flex flex-col items-center"> | 50 | + | <div class="flex flex-col items-center"> |
| 41 | - | <h2 class="text-2xl font-semibold text-gray-800">Login</h2> | 51 | + | <h2 class="text-2xl font-semibold text-gray-800">Login</h2> |
| 42 | - | <!-- GitHub OAuth --> | 52 | + | <!-- GitHub OAuth --> |
| 43 | - | <div class="mt-4 p-2 bg-gordonmascot-hblue text-white rounded-md flex justify-left"> | 53 | + | <div |
| 44 | - | <a href="login/oauth/github" class="flex items-center"> | 54 | + | class="mt-4 p-2 bg-gordonmascot-hblue text-white rounded-md flex justify-left"> |
| 45 | - | <img src="/assets/imgs/github/github-mark-white.png" alt="logo github" class="h-8 xl:h-12" /> | 55 | + | <a href="login/oauth/github" class="flex items-center"> |
| 46 | - | <span class="w-full p-2 text-white ">Login with GitHub</span> | 56 | + | <img |
| 47 | - | </a> | 57 | + | src="/assets/imgs/github/github-mark-white.png" |
| 58 | + | alt="logo github" | |||
| 59 | + | class="h-8 xl:h-12" /> | |||
| 60 | + | <span class="w-full p-2 text-white">Login with GitHub</span> | |||
| 61 | + | </a> | |||
| 62 | + | </div> | |||
| 48 | </div> | 63 | </div> | ||
| 49 | </div> | 64 | </div> | ||
| 65 | + | <!-- End Login Section --> | |||
| 50 | </div> | 66 | </div> | ||
| 51 | - | <!-- End Login Section --> | 67 | + | </body> |
| 52 | - | </div> | 68 | + | </html> |
| 53 | - | </body> | |||
| 54 | - | ||||
| 55 | - | </html>⏎̸ | |||