Fix password validation issue during registration
This commit is contained in:
@ -66,25 +66,25 @@ func CheckPasswordHash(password, hash string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ValidatePassword(password string) bool {
|
func ValidatePassword(password string) bool {
|
||||||
if len(password) < 6 {
|
if len(password) < 8 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
hasNumber int
|
hasNumber bool
|
||||||
hasUppercase bool
|
hasUppercase bool
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, char := range password {
|
for _, char := range password {
|
||||||
switch {
|
switch {
|
||||||
case unicode.IsNumber(char):
|
case unicode.IsNumber(char):
|
||||||
hasNumber++
|
hasNumber = true
|
||||||
case unicode.IsUpper(char):
|
case unicode.IsUpper(char):
|
||||||
hasUppercase = true
|
hasUppercase = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNumber >= 3 && hasUppercase
|
return hasNumber && hasUppercase
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvertFileSize(byte int64) string {
|
func ConvertFileSize(byte int64) string {
|
||||||
|
Reference in New Issue
Block a user