don't log hashed passwords
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"html"
|
"html"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -50,11 +51,13 @@ func Register(c *gin.Context) {
|
|||||||
|
|
||||||
// Check if user already exists
|
// Check if user already exists
|
||||||
testUser, _ := models.GetUserByName(u.UserName)
|
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) {
|
if (models.User{} == testUser) {
|
||||||
log.Printf("Register confirmed no existing username\n")
|
log.Printf("Register confirmed no existing username\n")
|
||||||
} else {
|
} 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ func JwtAuthAdminMiddleware() gin.HandlerFunc {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
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
|
// Verify that the user has a role with the admin flag set
|
||||||
if !ur.Admin {
|
if !ur.Admin {
|
||||||
|
Reference in New Issue
Block a user