Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
refactor: Remove duplicate IsPasswordHashed from auth package
rcourtman1a5acc2542e8
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.goindex ee1a361330..754ba6b3a8 100644--- a/internal/auth/auth_test.go+++ b/internal/auth/auth_test.go@@ -204,59 +204,6 @@ func TestCheckPasswordHash(t *testing.T) {}}-func TestIsPasswordHashed(t *testing.T) {- tests := []struct {- name string- input string- expected bool- }{- {- name: "valid bcrypt hash",- input: "$2a$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.qGAL0kcNWQKS5.",- expected: true,- },- {- name: "bcrypt 2b variant",- input: "$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.qGAL0kcNWQKS5.",- expected: true,- },- {- name: "bcrypt 2y variant",- input: "$2y$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.qGAL0kcNWQKS5.",- expected: true,- },- {- name: "plain password",- input: "mypassword",- expected: false,- },- {- name: "empty string",- input: "",- expected: false,- },- {- name: "wrong length",- input: "$2a$12$short",- expected: false,- },- {- name: "wrong prefix",- input: "$1a$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.qGAL0kcNWQKS5.",- expected: false,- },- }-- for _, tc := range tests {- t.Run(tc.name, func(t *testing.T) {- result := IsPasswordHashed(tc.input)- if result != tc.expected {- t.Errorf("IsPasswordHashed(%q) = %v, want %v", tc.input, result, tc.expected)- }- })- }-}-func TestValidatePasswordComplexity(t *testing.T) {tests := []struct {name stringdiff --git a/internal/auth/password.go b/internal/auth/password.goindex 902695ec4c..b40b4ad9f4 100644--- a/internal/auth/password.go+++ b/internal/auth/password.go@@ -2,7 +2,6 @@ package authimport ("fmt"- "strings""golang.org/x/crypto/bcrypt")@@ -32,12 +31,6 @@ func CheckPasswordHash(password, hash string) bool {return err == nil}-// IsPasswordHashed checks if a string looks like a bcrypt hash-func IsPasswordHashed(password string) bool {- // Bcrypt hashes start with $2a$, $2b$, or $2y$ and are 60 characters long- return strings.HasPrefix(password, "$2") && len(password) == 60-}-// ValidatePasswordComplexity checks if a password meets complexity requirementsfunc ValidatePasswordComplexity(password string) error {if len(password) < MinPasswordLength {