diff options
author | Unknwon <u@gogs.io> | 2015-09-06 16:31:22 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-06 16:31:22 -0400 |
commit | 85f34ba53843177999cb98bad046e9cce22bfc8f (patch) | |
tree | f1f7ca6d3b0fc4848216becd9bc2a25e019cb12e /routers | |
parent | 00767a0522606cd504d81d35fa1d9e9c1e34610c (diff) | |
download | gitea-85f34ba53843177999cb98bad046e9cce22bfc8f.tar.gz gitea-85f34ba53843177999cb98bad046e9cce22bfc8f.zip |
new user profile settings UI
Signed-off-by: Unknwon <u@gogs.io>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install.go | 11 | ||||
-rw-r--r-- | routers/user/setting.go | 14 |
2 files changed, 16 insertions, 9 deletions
diff --git a/routers/install.go b/routers/install.go index 72c8b137b0..d9c5d51cac 100644 --- a/routers/install.go +++ b/routers/install.go @@ -85,7 +85,14 @@ func InstallInit(ctx *middleware.Context) { ctx.Data["Title"] = ctx.Tr("install.install") ctx.Data["PageIsInstall"] = true - ctx.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "SQLite3"} + dbOpts := []string{"MySQL", "PostgreSQL"} + if models.EnableSQLite3 { + dbOpts = append(dbOpts, "SQLite3") + } + if models.EnableTidb { + dbOpts = append(dbOpts, "TiDB") + } + ctx.Data["DbOptions"] = dbOpts } func Install(ctx *middleware.Context) { @@ -163,7 +170,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { // Pass basic check, now test configuration. // Test database setting. - dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "SQLite3": "sqlite3"} + dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "SQLite3": "sqlite3", "TiDB": "tidb"} models.DbCfg.Type = dbTypes[form.DbType] models.DbCfg.Host = form.DbHost models.DbCfg.User = form.DbUser diff --git a/routers/user/setting.go b/routers/user/setting.go index 8afc56ac49..f2f5a6cd93 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -47,11 +47,11 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { } // Check if user name has been changed. - if ctx.User.Name != form.UserName { - if err := models.ChangeUserName(ctx.User, form.UserName); err != nil { + if ctx.User.Name != form.Name { + if err := models.ChangeUserName(ctx.User, form.Name); err != nil { switch { case models.IsErrUserAlreadyExist(err): - ctx.Flash.Error(ctx.Tr("form.username_been_taken")) + ctx.Flash.Error(ctx.Tr("form.name_been_taken")) ctx.Redirect(setting.AppSubUrl + "/user/settings") case models.IsErrEmailAlreadyUsed(err): ctx.Flash.Error(ctx.Tr("form.email_been_used")) @@ -67,16 +67,16 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { } return } - log.Trace("User name changed: %s -> %s", ctx.User.Name, form.UserName) - ctx.User.Name = form.UserName + log.Trace("User name changed: %s -> %s", ctx.User.Name, form.Name) + ctx.User.Name = form.Name } ctx.User.FullName = form.FullName ctx.User.Email = form.Email ctx.User.Website = form.Website ctx.User.Location = form.Location - ctx.User.Avatar = base.EncodeMd5(form.Avatar) - ctx.User.AvatarEmail = form.Avatar + ctx.User.Avatar = base.EncodeMd5(form.Gravatar) + ctx.User.AvatarEmail = form.Gravatar if err := models.UpdateUser(ctx.User); err != nil { ctx.Handle(500, "UpdateUser", err) return |