lib/password_strength.go
func (p *PasswordStrengthRequirements) Validate(password string) (bool, string) {
	reqs := MakeRequirements(password)
	if p.MaximumTotalLength > 0 && reqs.MaximumTotalLength > p.MaximumTotalLength {
		return false, "password is too long"
	}
	if reqs.MinimumTotalLength < p.MinimumTotalLength {
		return false, "password is too short"
	}
	if reqs.Digits < p.Digits {
		return false, "password has too few digits"
	}
	if reqs.Punctuation < p.Punctuation {
		return false, "password has too few punctuation characters"
	}
	if reqs.Uppercase < p.Uppercase {
		return false, "password has too few uppercase characters"
	}
	return true, ""
}
func (p *PasswordStrengthRequirements) Validate(password string) (bool, string) {
	reqs := MakeRequirements(password)
	if p.MaximumTotalLength > 0 && reqs.MaximumTotalLength > p.MaximumTotalLength {
		return false, "password is too long"
	}
	if reqs.MinimumTotalLength < p.MinimumTotalLength {
		return false, "password is too short"
	}
	if reqs.Digits < p.Digits {
		return false, "password has too few digits"
	}
	if reqs.Punctuation < p.Punctuation {
		return false, "password has too few punctuation characters"
	}
	if reqs.Uppercase < p.Uppercase {
		return false, "password has too few uppercase characters"
	}
	return true, ""
}
//Validate a password against the given requirements
//Returns a boolean indicating whether the password meets the requirements.
//The second argument is a string explaining why it doesn't meet the requirements,
//if it doesn't. It is empty if the requirements are met.