don't log hashed passwords
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-04 08:40:42 +10:00
parent 2d7a55e427
commit 93385646b6
2 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package controllers
import (
"errors"
"html"
"log"
"net/http"
@@ -50,11 +51,13 @@ func Register(c *gin.Context) {
// Check if user already exists
testUser, _ := models.GetUserByName(u.UserName)
log.Printf("Register checking if user already exists : '%v'\n", testUser)
log.Printf("Register checking if user '%s' already exists\n", u.UserName)
if (models.User{} == testUser) {
log.Printf("Register confirmed no existing username\n")
} else {
c.JSON(http.StatusBadRequest, gin.H{"error": "Attempt to register conflicting username"})
err := errors.New("attempt to register conflicting username")
log.Printf("Register error : '%s'\n", err)
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}

View File

@@ -51,7 +51,7 @@ func JwtAuthAdminMiddleware() gin.HandlerFunc {
c.Abort()
return
}
log.Printf("JwtAuthAdminMiddleware retrieved UserRole object '%v'\n", ur)
log.Printf("JwtAuthAdminMiddleware retrieved UserRole object for UserId '%d'\n", ur.UserId)
// Verify that the user has a role with the admin flag set
if !ur.Admin {