We got some auth going

This commit is contained in:
2025-09-12 18:18:17 +01:00
parent dc72c5414e
commit 54ea4c1c98
35 changed files with 494 additions and 90 deletions
+3 -11
View File
@@ -6,7 +6,6 @@ import (
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
)
const (
@@ -25,16 +24,9 @@ func loginUser(c *gin.Context) {
username := c.PostForm("login-user")
password := c.PostForm("login-pass")
user, err := exp.App.GetUserByName(username)
if err != nil {
// TODO - go to an error page here
return
}
// Check password
err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))
if err != nil {
// TODO - wrong password
user, err := exp.App.ValidateCredentials(username, password)
if err != nil {
// TODO - go to an error page or login failed or something
return
}