mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-30 04:20:20 +00:00
feat: remove Enterprise badges, simplify Pro upgrade prompts
- Replace barrel import in AuditLogPanel.tsx to fix ad-blocker crash - Remove all Enterprise/Pro badges from nav and feature headers - Simplify upgrade CTAs to clean 'Upgrade to Pro' links - Update docs: PULSE_PRO.md, API.md, README.md, SECURITY.md - Align terminology: single Pro tier, no separate Enterprise tier Also includes prior refactoring: - Move auth package to pkg/auth for enterprise reuse - Export server functions for testability - Stabilize CLI tests
This commit is contained in:
parent
22059210f7
commit
3e2824a7ff
46 changed files with 509 additions and 578 deletions
42
pkg/auth/password.go
Normal file
42
pkg/auth/password.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
const (
|
||||
// BcryptCost is the cost factor for bcrypt hashing
|
||||
// Higher values are more secure but slower
|
||||
BcryptCost = 12
|
||||
|
||||
// MinPasswordLength is the minimum required password length
|
||||
MinPasswordLength = 12
|
||||
)
|
||||
|
||||
// HashPassword generates a bcrypt hash from a plain text password
|
||||
func HashPassword(password string) (string, error) {
|
||||
bytes, err := bcrypt.GenerateFromPassword([]byte(password), BcryptCost)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(bytes), nil
|
||||
}
|
||||
|
||||
// CheckPasswordHash compares a plain text password with a hash
|
||||
func CheckPasswordHash(password, hash string) bool {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// ValidatePasswordComplexity checks if a password meets complexity requirements
|
||||
func ValidatePasswordComplexity(password string) error {
|
||||
if len(password) < MinPasswordLength {
|
||||
return fmt.Errorf("password must be at least %d characters long", MinPasswordLength)
|
||||
}
|
||||
|
||||
// Let users choose their own passwords beyond length.
|
||||
// No character type requirements.
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue