MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / ValidatePassword

Method ValidatePassword

internal/domain/user.go:74–84  ·  view source on GitHub ↗

ValidatePassword 验证密码格式

()

Source from the content-addressed store, hash-verified

72
73// ValidatePassword 验证密码格式
74func (u *User) ValidatePassword() error {
75 passwordRegex := regexp2.MustCompile(passwordRegexPattern, regexp2.None)
76 isMatch, err := passwordRegex.MatchString(u.Password)
77 if err != nil {
78 return err
79 }
80 if !isMatch {
81 return ErrInvalidPasswordFormat
82 }
83 return nil
84}
85
86// VerifyPassword 验证密码是否匹配
87func (u *User) VerifyPassword(password string) error {

Callers 1

SignUpMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected