Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultAuthorizeHandler = func(context *auth.Context) (*claims.Claims, error) { var ( authInfo auth_identity.AuthIdentity req = context.Request tx = context.Auth.GetDB(req) provider, _ = context.Provider.(*password.Provider) ) _ = req.ParseForm() authInfo.Provider = provider.GetName() authInfo.UID = strings.TrimSpace(req.Form.Get("login")) if tx.Model(context.Auth.AuthIdentityModel).Where(authInfo).Scan(&authInfo).RecordNotFound() { return nil, errors.New("请输入正确账号") } if provider.Config.Confirmable && authInfo.ConfirmedAt == nil { currentUser, _ := context.Auth.UserStorer.Get(authInfo.ToClaims(), context) _ = provider.Config.ConfirmMailer(authInfo.UID, context, authInfo.ToClaims(), currentUser) return nil, errors.New("请确认你的账号,再继续") } if err := provider.Encryptor.Compare(authInfo.EncryptedPassword, strings.TrimSpace(req.Form.Get("password"))); err == nil { return authInfo.ToClaims(), err } return nil, errors.New("请输入正确密码") }
View Source
var ErrPasswordConfirmationNotMatch = errors.New("两次密码输入不一致")
ErrPasswordConfirmationNotMatch password confirmation not match error
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.