From 10c3b0b6de401da8eee2225d7457b1efd4ae04a9 Mon Sep 17 00:00:00 2001 From: avadesian Date: Tue, 28 Sep 2021 15:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=9A=90=E8=97=8F=E9=82=AE=E4=BB=B6=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E7=9A=84=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/user.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/models/user.go b/models/user.go index 38f699740..78ab4627a 100755 --- a/models/user.go +++ b/models/user.go @@ -1556,6 +1556,18 @@ func GetUserByActivateEmail(email string) (*User, error) { if len(users) >= 1 { return &users[0],nil }else { + // Finally, if email address is the protected email address:用户邮件地址设置为隐藏电子邮件地址 + if strings.HasSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) { + username := strings.TrimSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) + user := &User{LowerName: username} + has, err := ctx.e.Get(user) + if err != nil { + return nil, err + } + if has { + return user, nil + } + } return nil, errors.New("cannot find user by email") } }