mirror of
https://github.com/go-gitea/gitea
synced 2025-08-10 11:38:20 +00:00
Backport #19089 * Handle email address not exist. (#19089) * Fix lint about strings.Title Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
||||
@@ -47,6 +46,8 @@ import (
|
||||
"code.gitea.io/gitea/services/repository/archiver"
|
||||
"code.gitea.io/gitea/services/task"
|
||||
"code.gitea.io/gitea/services/webhook"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"gitea.com/go-chi/session"
|
||||
)
|
||||
@@ -111,7 +112,7 @@ func GlobalInitInstalled(ctx context.Context) {
|
||||
log.Info("Custom path: %s", setting.CustomPath)
|
||||
log.Info("Log path: %s", setting.LogRootPath)
|
||||
log.Info("Configuration file: %s", setting.CustomConf)
|
||||
log.Info("Run Mode: %s", strings.Title(setting.RunMode))
|
||||
log.Info("Run Mode: %s", cases.Title(language.English).String(setting.RunMode))
|
||||
|
||||
// Setup i18n
|
||||
translation.InitLocales()
|
||||
|
@@ -209,7 +209,7 @@ func shadowPassword(provider, cfgItem string) string {
|
||||
case "redis":
|
||||
return shadowPasswordKV(cfgItem, ",")
|
||||
case "mysql":
|
||||
//root:@tcp(localhost:3306)/macaron?charset=utf8
|
||||
// root:@tcp(localhost:3306)/macaron?charset=utf8
|
||||
atIdx := strings.Index(cfgItem, "@")
|
||||
if atIdx > 0 {
|
||||
colonIdx := strings.Index(cfgItem[:atIdx], ":")
|
||||
@@ -244,7 +244,7 @@ func Config(ctx *context.Context) {
|
||||
ctx.Data["OfflineMode"] = setting.OfflineMode
|
||||
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog
|
||||
ctx.Data["RunUser"] = setting.RunUser
|
||||
ctx.Data["RunMode"] = strings.Title(setting.RunMode)
|
||||
ctx.Data["RunMode"] = setting.RunMode
|
||||
if version, err := git.LocalVersion(); err == nil {
|
||||
ctx.Data["GitVersion"] = version.Original()
|
||||
}
|
||||
|
@@ -195,7 +195,7 @@ func SignInPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.SignInForm)
|
||||
u, source, err := auth_service.UserSignIn(form.UserName, form.Password)
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
if user_model.IsErrUserNotExist(err) || user_model.IsErrEmailAddressNotExist(err) {
|
||||
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
|
||||
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
|
||||
} else if user_model.IsErrEmailAlreadyUsed(err) {
|
||||
|
Reference in New Issue
Block a user