Feat: 2-FA login verification

This commit is contained in:
HFO4
2020-02-21 13:48:34 +08:00
parent 11e45bc751
commit 7c07b623f6
6 changed files with 93 additions and 1 deletions

View File

@@ -172,6 +172,13 @@ func GetActiveUserByID(ID interface{}) (User, error) {
return user, result.Error
}
// GetActiveUserByOpenID 用OpenID获取可登录用户
func GetActiveUserByOpenID(openid string) (User, error) {
var user User
result := DB.Set("gorm:auto_preload", true).Where("status = ? and open_id = ?", Active, openid).Find(&user)
return user, result.Error
}
// GetUserByEmail 用Email获取用户
func GetUserByEmail(email string) (User, error) {
var user User