Migrate shared UI and backend components
Lint / Lint (push) Failing after 7s
Tests / Go backend (push) Failing after 6s
Tests / Dashboard checks (push) Failing after 4s
Docker / Docker Build & Push (push) Failing after 10s

This commit is contained in:
Gabriel20xx committed 2026-08-04 17:05:37 +02:00
1 parent 64d22d0aac
commit ac08be0248
16 files changed
+236 -395

No files matched your search

+5 -5
View File
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"golang.org/x/crypto/bcrypt"
sharedauth "repos.gfranz.ch/Gabriel20xx/SharedCode/backend/auth"
)
const (
@@ -238,7 +238,7 @@ func (a *AuthService) handleSetup(w http.ResponseWriter, r *http.Request) {
return
}
hash, err := bcrypt.GenerateFromPassword([]byte(request.Password), bcrypt.DefaultCost)
hash, err := sharedauth.HashPassword(request.Password)
if err != nil {
writeJSONError(w, http.StatusInternalServerError, "Internal server error")
return
@@ -283,7 +283,7 @@ func (a *AuthService) handleLogin(w http.ResponseWriter, r *http.Request) {
writeJSONError(w, http.StatusInternalServerError, "Internal server error")
return
}
if user == nil || bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(request.Password)) != nil {
if user == nil || !sharedauth.VerifyPassword(user.PasswordHash, request.Password) {
writeJSONError(w, http.StatusUnauthorized, errInvalidCredentials.Error())
return
}
@@ -318,7 +318,7 @@ func (a *AuthService) handleUpdateCredentials(w http.ResponseWriter, r *http.Req
writeJSONError(w, http.StatusBadRequest, "Invalid JSON body")
return
}
if request.CurrentPassword != nil && *request.CurrentPassword != "" && bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(*request.CurrentPassword)) != nil {
if request.CurrentPassword != nil && *request.CurrentPassword != "" && !sharedauth.VerifyPassword(user.PasswordHash, *request.CurrentPassword) {
writeJSONError(w, http.StatusBadRequest, errCurrentPasswordBad.Error())
return
}
@@ -347,7 +347,7 @@ func (a *AuthService) handleUpdateCredentials(w http.ResponseWriter, r *http.Req
writeJSONError(w, http.StatusBadRequest, err.Error())
return
}
hash, err := bcrypt.GenerateFromPassword([]byte(*request.NewPassword), bcrypt.DefaultCost)
hash, err := sharedauth.HashPassword(*request.NewPassword)
if err != nil {
writeJSONError(w, http.StatusInternalServerError, "Internal server error")
return