mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01:00
golint fixed for parts of routers root, dev, user and org dirs (#167)
* golint fixed for parts of routers root, dev and org dirs * add user/auth.go golint fixed * rename unnecessary exported to unexported and user dir golint fixed
This commit is contained in:
parent
91953ae9b4
commit
cf045b029c
11 changed files with 225 additions and 132 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TemplatePreview render for previewing the indicated template
|
||||||
func TemplatePreview(ctx *context.Context) {
|
func TemplatePreview(ctx *context.Context) {
|
||||||
ctx.Data["User"] = models.User{Name: "Unknown"}
|
ctx.Data["User"] = models.User{Name: "Unknown"}
|
||||||
ctx.Data["AppName"] = setting.AppName
|
ctx.Data["AppName"] = setting.AppName
|
||||||
|
|
|
@ -17,17 +17,22 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HOME base.TplName = "home"
|
// tplHome home page template
|
||||||
EXPLORE_REPOS base.TplName = "explore/repos"
|
tplHome base.TplName = "home"
|
||||||
EXPLORE_USERS base.TplName = "explore/users"
|
// tplExploreRepos explore repositories page template
|
||||||
EXPLORE_ORGANIZATIONS base.TplName = "explore/organizations"
|
tplExploreRepos base.TplName = "explore/repos"
|
||||||
|
// tplExploreUsers explore users page template
|
||||||
|
tplExploreUsers base.TplName = "explore/users"
|
||||||
|
// tplExploreOrganizations explore organizations page template
|
||||||
|
tplExploreOrganizations base.TplName = "explore/organizations"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Home render home page
|
||||||
func Home(ctx *context.Context) {
|
func Home(ctx *context.Context) {
|
||||||
if ctx.IsSigned {
|
if ctx.IsSigned {
|
||||||
if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
|
if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
||||||
ctx.HTML(200, user.ACTIVATE)
|
ctx.HTML(200, user.TplActivate)
|
||||||
} else {
|
} else {
|
||||||
user.Dashboard(ctx)
|
user.Dashboard(ctx)
|
||||||
}
|
}
|
||||||
|
@ -42,9 +47,10 @@ func Home(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["PageIsHome"] = true
|
ctx.Data["PageIsHome"] = true
|
||||||
ctx.HTML(200, HOME)
|
ctx.HTML(200, tplHome)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RepoSearchOptions when calling search repositories
|
||||||
type RepoSearchOptions struct {
|
type RepoSearchOptions struct {
|
||||||
Counter func(bool) int64
|
Counter func(bool) int64
|
||||||
Ranger func(int, int) ([]*models.Repository, error)
|
Ranger func(int, int) ([]*models.Repository, error)
|
||||||
|
@ -54,6 +60,7 @@ type RepoSearchOptions struct {
|
||||||
TplName base.TplName
|
TplName base.TplName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RenderRepoSearch render repositories search page
|
||||||
func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 0 {
|
if page <= 0 {
|
||||||
|
@ -102,6 +109,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||||
ctx.HTML(200, opts.TplName)
|
ctx.HTML(200, opts.TplName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExploreRepos render explore repositories page
|
||||||
func ExploreRepos(ctx *context.Context) {
|
func ExploreRepos(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("explore")
|
ctx.Data["Title"] = ctx.Tr("explore")
|
||||||
ctx.Data["PageIsExplore"] = true
|
ctx.Data["PageIsExplore"] = true
|
||||||
|
@ -112,10 +120,11 @@ func ExploreRepos(ctx *context.Context) {
|
||||||
Ranger: models.GetRecentUpdatedRepositories,
|
Ranger: models.GetRecentUpdatedRepositories,
|
||||||
PageSize: setting.UI.ExplorePagingNum,
|
PageSize: setting.UI.ExplorePagingNum,
|
||||||
OrderBy: "updated_unix DESC",
|
OrderBy: "updated_unix DESC",
|
||||||
TplName: EXPLORE_REPOS,
|
TplName: tplExploreRepos,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserSearchOptions options when render search user page
|
||||||
type UserSearchOptions struct {
|
type UserSearchOptions struct {
|
||||||
Type models.UserType
|
Type models.UserType
|
||||||
Counter func() int64
|
Counter func() int64
|
||||||
|
@ -125,6 +134,7 @@ type UserSearchOptions struct {
|
||||||
TplName base.TplName
|
TplName base.TplName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RenderUserSearch render user search page
|
||||||
func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
|
func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 1 {
|
if page <= 1 {
|
||||||
|
@ -166,6 +176,7 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
|
||||||
ctx.HTML(200, opts.TplName)
|
ctx.HTML(200, opts.TplName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExploreUsers render explore users page
|
||||||
func ExploreUsers(ctx *context.Context) {
|
func ExploreUsers(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("explore")
|
ctx.Data["Title"] = ctx.Tr("explore")
|
||||||
ctx.Data["PageIsExplore"] = true
|
ctx.Data["PageIsExplore"] = true
|
||||||
|
@ -177,10 +188,11 @@ func ExploreUsers(ctx *context.Context) {
|
||||||
Ranger: models.Users,
|
Ranger: models.Users,
|
||||||
PageSize: setting.UI.ExplorePagingNum,
|
PageSize: setting.UI.ExplorePagingNum,
|
||||||
OrderBy: "name ASC",
|
OrderBy: "name ASC",
|
||||||
TplName: EXPLORE_USERS,
|
TplName: tplExploreUsers,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExploreOrganizations render explore organizations page
|
||||||
func ExploreOrganizations(ctx *context.Context) {
|
func ExploreOrganizations(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("explore")
|
ctx.Data["Title"] = ctx.Tr("explore")
|
||||||
ctx.Data["PageIsExplore"] = true
|
ctx.Data["PageIsExplore"] = true
|
||||||
|
@ -192,10 +204,11 @@ func ExploreOrganizations(ctx *context.Context) {
|
||||||
Ranger: models.Organizations,
|
Ranger: models.Organizations,
|
||||||
PageSize: setting.UI.ExplorePagingNum,
|
PageSize: setting.UI.ExplorePagingNum,
|
||||||
OrderBy: "name ASC",
|
OrderBy: "name ASC",
|
||||||
TplName: EXPLORE_ORGANIZATIONS,
|
TplName: tplExploreOrganizations,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotFound render 404 page
|
||||||
func NotFound(ctx *context.Context) {
|
func NotFound(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = "Page Not Found"
|
ctx.Data["Title"] = "Page Not Found"
|
||||||
ctx.Handle(404, "home.NotFound", nil)
|
ctx.Handle(404, "home.NotFound", nil)
|
||||||
|
|
|
@ -34,7 +34,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
INSTALL base.TplName = "install"
|
// tplInstall template for installation page
|
||||||
|
tplInstall base.TplName = "install"
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkRunMode() {
|
func checkRunMode() {
|
||||||
|
@ -49,6 +50,7 @@ func checkRunMode() {
|
||||||
log.Info("Run Mode: %s", strings.Title(macaron.Env))
|
log.Info("Run Mode: %s", strings.Title(macaron.Env))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServices init new services
|
||||||
func NewServices() {
|
func NewServices() {
|
||||||
setting.NewServices()
|
setting.NewServices()
|
||||||
mailer.NewContext()
|
mailer.NewContext()
|
||||||
|
@ -97,6 +99,7 @@ func GlobalInit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstallInit prepare for rendering installation page
|
||||||
func InstallInit(ctx *context.Context) {
|
func InstallInit(ctx *context.Context) {
|
||||||
if setting.InstallLock {
|
if setting.InstallLock {
|
||||||
ctx.Handle(404, "Install", errors.New("Installation is prohibited"))
|
ctx.Handle(404, "Install", errors.New("Installation is prohibited"))
|
||||||
|
@ -116,6 +119,7 @@ func InstallInit(ctx *context.Context) {
|
||||||
ctx.Data["DbOptions"] = dbOpts
|
ctx.Data["DbOptions"] = dbOpts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Install render installation page
|
||||||
func Install(ctx *context.Context) {
|
func Install(ctx *context.Context) {
|
||||||
form := auth.InstallForm{}
|
form := auth.InstallForm{}
|
||||||
|
|
||||||
|
@ -175,9 +179,10 @@ func Install(ctx *context.Context) {
|
||||||
form.RequireSignInView = setting.Service.RequireSignInView
|
form.RequireSignInView = setting.Service.RequireSignInView
|
||||||
|
|
||||||
auth.AssignForm(form, ctx.Data)
|
auth.AssignForm(form, ctx.Data)
|
||||||
ctx.HTML(200, INSTALL)
|
ctx.HTML(200, tplInstall)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstallPost response for submit install items
|
||||||
func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
ctx.Data["CurDbOption"] = form.DbType
|
ctx.Data["CurDbOption"] = form.DbType
|
||||||
|
|
||||||
|
@ -191,12 +196,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
ctx.Data["Err_Admin"] = true
|
ctx.Data["Err_Admin"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, INSTALL)
|
ctx.HTML(200, tplInstall)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := exec.LookPath("git"); err != nil {
|
if _, err := exec.LookPath("git"); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.test_git_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.test_git_failed", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,12 +219,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") &&
|
if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") &&
|
||||||
len(models.DbCfg.Path) == 0 {
|
len(models.DbCfg.Path) == 0 {
|
||||||
ctx.Data["Err_DbPath"] = true
|
ctx.Data["Err_DbPath"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), tplInstall, &form)
|
||||||
return
|
return
|
||||||
} else if models.DbCfg.Type == "tidb" &&
|
} else if models.DbCfg.Type == "tidb" &&
|
||||||
strings.ContainsAny(path.Base(models.DbCfg.Path), ".-") {
|
strings.ContainsAny(path.Base(models.DbCfg.Path), ".-") {
|
||||||
ctx.Data["Err_DbPath"] = true
|
ctx.Data["Err_DbPath"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.err_invalid_tidb_name"), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.err_invalid_tidb_name"), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,10 +233,10 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
if err := models.NewTestEngine(x); err != nil {
|
if err := models.NewTestEngine(x); err != nil {
|
||||||
if strings.Contains(err.Error(), `Unknown database type: sqlite3`) {
|
if strings.Contains(err.Error(), `Unknown database type: sqlite3`) {
|
||||||
ctx.Data["Err_DbType"] = true
|
ctx.Data["Err_DbType"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.sqlite3_not_available", "https://gogs.io/docs/installation/install_from_binary.html"), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.sqlite3_not_available", "https://gogs.io/docs/installation/install_from_binary.html"), tplInstall, &form)
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["Err_DbSetting"] = true
|
ctx.Data["Err_DbSetting"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.invalid_db_setting", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.invalid_db_setting", err), tplInstall, &form)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -240,7 +245,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
form.RepoRootPath = strings.Replace(form.RepoRootPath, "\\", "/", -1)
|
form.RepoRootPath = strings.Replace(form.RepoRootPath, "\\", "/", -1)
|
||||||
if err := os.MkdirAll(form.RepoRootPath, os.ModePerm); err != nil {
|
if err := os.MkdirAll(form.RepoRootPath, os.ModePerm); err != nil {
|
||||||
ctx.Data["Err_RepoRootPath"] = true
|
ctx.Data["Err_RepoRootPath"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.invalid_repo_path", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.invalid_repo_path", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,14 +253,14 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1)
|
form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1)
|
||||||
if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil {
|
if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil {
|
||||||
ctx.Data["Err_LogRootPath"] = true
|
ctx.Data["Err_LogRootPath"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.invalid_log_root_path", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.invalid_log_root_path", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
currentUser, match := setting.IsRunUserMatchCurrentUser(form.RunUser)
|
currentUser, match := setting.IsRunUserMatchCurrentUser(form.RunUser)
|
||||||
if !match {
|
if !match {
|
||||||
ctx.Data["Err_RunUser"] = true
|
ctx.Data["Err_RunUser"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.run_user_not_match", form.RunUser, currentUser), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.run_user_not_match", form.RunUser, currentUser), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +268,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
if form.DisableRegistration && len(form.AdminName) == 0 {
|
if form.DisableRegistration && len(form.AdminName) == 0 {
|
||||||
ctx.Data["Err_Services"] = true
|
ctx.Data["Err_Services"] = true
|
||||||
ctx.Data["Err_Admin"] = true
|
ctx.Data["Err_Admin"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.no_admin_and_disable_registration"), INSTALL, form)
|
ctx.RenderWithErr(ctx.Tr("install.no_admin_and_disable_registration"), tplInstall, form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,13 +276,13 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
if len(form.AdminName) > 0 && len(form.AdminPasswd) == 0 {
|
if len(form.AdminName) > 0 && len(form.AdminPasswd) == 0 {
|
||||||
ctx.Data["Err_Admin"] = true
|
ctx.Data["Err_Admin"] = true
|
||||||
ctx.Data["Err_AdminPasswd"] = true
|
ctx.Data["Err_AdminPasswd"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.err_empty_admin_password"), INSTALL, form)
|
ctx.RenderWithErr(ctx.Tr("install.err_empty_admin_password"), tplInstall, form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if form.AdminPasswd != form.AdminConfirmPasswd {
|
if form.AdminPasswd != form.AdminConfirmPasswd {
|
||||||
ctx.Data["Err_Admin"] = true
|
ctx.Data["Err_Admin"] = true
|
||||||
ctx.Data["Err_AdminPasswd"] = true
|
ctx.Data["Err_AdminPasswd"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), INSTALL, form)
|
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), tplInstall, form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,12 +352,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
|
|
||||||
err := os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
|
err := os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cfg.SaveTo(setting.CustomConf); err != nil {
|
if err := cfg.SaveTo(setting.CustomConf); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +377,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
setting.InstallLock = false
|
setting.InstallLock = false
|
||||||
ctx.Data["Err_AdminName"] = true
|
ctx.Data["Err_AdminName"] = true
|
||||||
ctx.Data["Err_AdminEmail"] = true
|
ctx.Data["Err_AdminEmail"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.invalid_admin_setting", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.invalid_admin_setting", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("Admin account already exist")
|
log.Info("Admin account already exist")
|
||||||
|
@ -381,11 +386,11 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
|
|
||||||
// Auto-login for admin
|
// Auto-login for admin
|
||||||
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := ctx.Session.Set("uname", u.Name); err != nil {
|
if err := ctx.Session.Set("uname", u.Name); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MEMBERS base.TplName = "org/member/members"
|
// tplMembers template for organization members page
|
||||||
MEMBER_INVITE base.TplName = "org/member/invite"
|
tplMembers base.TplName = "org/member/members"
|
||||||
|
// tplMemberInvite template for orgnization invite page
|
||||||
|
tplMemberInvite base.TplName = "org/member/invite"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Members render orgnization users page
|
||||||
func Members(ctx *context.Context) {
|
func Members(ctx *context.Context) {
|
||||||
org := ctx.Org.Organization
|
org := ctx.Org.Organization
|
||||||
ctx.Data["Title"] = org.FullName
|
ctx.Data["Title"] = org.FullName
|
||||||
|
@ -30,9 +33,10 @@ func Members(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Members"] = org.Members
|
ctx.Data["Members"] = org.Members
|
||||||
|
|
||||||
ctx.HTML(200, MEMBERS)
|
ctx.HTML(200, tplMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MembersAction response for operation to a member of orgnization
|
||||||
func MembersAction(ctx *context.Context) {
|
func MembersAction(ctx *context.Context) {
|
||||||
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
||||||
if uid == 0 {
|
if uid == 0 {
|
||||||
|
@ -91,6 +95,7 @@ func MembersAction(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Invitation render organization invitation page
|
||||||
func Invitation(ctx *context.Context) {
|
func Invitation(ctx *context.Context) {
|
||||||
org := ctx.Org.Organization
|
org := ctx.Org.Organization
|
||||||
ctx.Data["Title"] = org.FullName
|
ctx.Data["Title"] = org.FullName
|
||||||
|
@ -119,5 +124,5 @@ func Invitation(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, MEMBER_INVITE)
|
ctx.HTML(200, tplMemberInvite)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,19 +14,22 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CREATE base.TplName = "org/create"
|
// tplCreateOrg template path for create organization
|
||||||
|
tplCreateOrg base.TplName = "org/create"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Create render the page for create organization
|
||||||
func Create(ctx *context.Context) {
|
func Create(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("new_org")
|
ctx.Data["Title"] = ctx.Tr("new_org")
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, tplCreateOrg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreatePost response for create organization
|
||||||
func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("new_org")
|
ctx.Data["Title"] = ctx.Tr("new_org")
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, tplCreateOrg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +43,11 @@ func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
||||||
ctx.Data["Err_OrgName"] = true
|
ctx.Data["Err_OrgName"] = true
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrUserAlreadyExist(err):
|
case models.IsErrUserAlreadyExist(err):
|
||||||
ctx.RenderWithErr(ctx.Tr("form.org_name_been_taken"), CREATE, &form)
|
ctx.RenderWithErr(ctx.Tr("form.org_name_been_taken"), tplCreateOrg, &form)
|
||||||
case models.IsErrNameReserved(err):
|
case models.IsErrNameReserved(err):
|
||||||
ctx.RenderWithErr(ctx.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), CREATE, &form)
|
ctx.RenderWithErr(ctx.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), tplCreateOrg, &form)
|
||||||
case models.IsErrNamePatternNotAllowed(err):
|
case models.IsErrNamePatternNotAllowed(err):
|
||||||
ctx.RenderWithErr(ctx.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), CREATE, &form)
|
ctx.RenderWithErr(ctx.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tplCreateOrg, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "CreateOrganization", err)
|
ctx.Handle(500, "CreateOrganization", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,23 +17,28 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SETTINGS_OPTIONS base.TplName = "org/settings/options"
|
// tplSettingsOptions template path for render settings
|
||||||
SETTINGS_DELETE base.TplName = "org/settings/delete"
|
tplSettingsOptions base.TplName = "org/settings/options"
|
||||||
SETTINGS_HOOKS base.TplName = "org/settings/hooks"
|
// tplSettingsDelete template path for render delete repository
|
||||||
|
tplSettingsDelete base.TplName = "org/settings/delete"
|
||||||
|
// tplSettingsHooks template path for render hook settings
|
||||||
|
tplSettingsHooks base.TplName = "org/settings/hooks"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Settings render the main settings page
|
||||||
func Settings(ctx *context.Context) {
|
func Settings(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsOptions"] = true
|
ctx.Data["PageIsSettingsOptions"] = true
|
||||||
ctx.HTML(200, SETTINGS_OPTIONS)
|
ctx.HTML(200, tplSettingsOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsPost response for settings change submited
|
||||||
func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsOptions"] = true
|
ctx.Data["PageIsSettingsOptions"] = true
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_OPTIONS)
|
ctx.HTML(200, tplSettingsOptions)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +52,12 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
return
|
return
|
||||||
} else if isExist {
|
} else if isExist {
|
||||||
ctx.Data["OrgName"] = true
|
ctx.Data["OrgName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), SETTINGS_OPTIONS, &form)
|
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
|
||||||
return
|
return
|
||||||
} else if err = models.ChangeUserName(org, form.Name); err != nil {
|
} else if err = models.ChangeUserName(org, form.Name); err != nil {
|
||||||
if err == models.ErrUserNameIllegal {
|
if err == models.ErrUserNameIllegal {
|
||||||
ctx.Data["OrgName"] = true
|
ctx.Data["OrgName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.illegal_username"), SETTINGS_OPTIONS, &form)
|
ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "ChangeUserName", err)
|
ctx.Handle(500, "ChangeUserName", err)
|
||||||
}
|
}
|
||||||
|
@ -83,6 +88,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsAvatar response for change avatar on settings page
|
||||||
func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) {
|
func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) {
|
||||||
form.Source = auth.AvatarLocal
|
form.Source = auth.AvatarLocal
|
||||||
if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil {
|
if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil {
|
||||||
|
@ -94,6 +100,7 @@ func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsDeleteAvatar response for delete avatar on setings page
|
||||||
func SettingsDeleteAvatar(ctx *context.Context) {
|
func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
if err := ctx.Org.Organization.DeleteAvatar(); err != nil {
|
if err := ctx.Org.Organization.DeleteAvatar(); err != nil {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
|
@ -102,6 +109,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsDelete response for delete repository
|
||||||
func SettingsDelete(ctx *context.Context) {
|
func SettingsDelete(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsDelete"] = true
|
ctx.Data["PageIsSettingsDelete"] = true
|
||||||
|
@ -110,7 +118,7 @@ func SettingsDelete(ctx *context.Context) {
|
||||||
if ctx.Req.Method == "POST" {
|
if ctx.Req.Method == "POST" {
|
||||||
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
|
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsDelete, nil)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "UserSignIn", err)
|
ctx.Handle(500, "UserSignIn", err)
|
||||||
}
|
}
|
||||||
|
@ -131,9 +139,10 @@ func SettingsDelete(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_DELETE)
|
ctx.HTML(200, tplSettingsDelete)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Webhooks render webhook list page
|
||||||
func Webhooks(ctx *context.Context) {
|
func Webhooks(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
|
@ -147,9 +156,10 @@ func Webhooks(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Webhooks"] = ws
|
ctx.Data["Webhooks"] = ws
|
||||||
ctx.HTML(200, SETTINGS_HOOKS)
|
ctx.HTML(200, tplSettingsHooks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteWebhook response for delete webhook
|
||||||
func DeleteWebhook(ctx *context.Context) {
|
func DeleteWebhook(ctx *context.Context) {
|
||||||
if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil {
|
if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil {
|
||||||
ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error())
|
ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error())
|
||||||
|
|
|
@ -17,12 +17,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TEAMS base.TplName = "org/team/teams"
|
// tplTeams template path for teams list page
|
||||||
TEAM_NEW base.TplName = "org/team/new"
|
tplTeams base.TplName = "org/team/teams"
|
||||||
TEAM_MEMBERS base.TplName = "org/team/members"
|
// tplTeamNew template path for create new team page
|
||||||
TEAM_REPOSITORIES base.TplName = "org/team/repositories"
|
tplTeamNew base.TplName = "org/team/new"
|
||||||
|
// tplTeamMembers template path for showing team members page
|
||||||
|
tplTeamMembers base.TplName = "org/team/members"
|
||||||
|
// tplTeamRepositories template path for showing team repositories page
|
||||||
|
tplTeamRepositories base.TplName = "org/team/repositories"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Teams render teams list page
|
||||||
func Teams(ctx *context.Context) {
|
func Teams(ctx *context.Context) {
|
||||||
org := ctx.Org.Organization
|
org := ctx.Org.Organization
|
||||||
ctx.Data["Title"] = org.FullName
|
ctx.Data["Title"] = org.FullName
|
||||||
|
@ -36,9 +41,10 @@ func Teams(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Teams"] = org.Teams
|
ctx.Data["Teams"] = org.Teams
|
||||||
|
|
||||||
ctx.HTML(200, TEAMS)
|
ctx.HTML(200, tplTeams)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TeamsAction response for join, leave, remove, add operations to team
|
||||||
func TeamsAction(ctx *context.Context) {
|
func TeamsAction(ctx *context.Context) {
|
||||||
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
||||||
if uid == 0 {
|
if uid == 0 {
|
||||||
|
@ -107,6 +113,7 @@ func TeamsAction(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TeamsRepoAction operate team's repository
|
||||||
func TeamsRepoAction(ctx *context.Context) {
|
func TeamsRepoAction(ctx *context.Context) {
|
||||||
if !ctx.Org.IsOwner {
|
if !ctx.Org.IsOwner {
|
||||||
ctx.Error(404)
|
ctx.Error(404)
|
||||||
|
@ -141,14 +148,16 @@ func TeamsRepoAction(ctx *context.Context) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
|
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewTeam render create new team page
|
||||||
func NewTeam(ctx *context.Context) {
|
func NewTeam(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||||
ctx.Data["Team"] = &models.Team{}
|
ctx.Data["Team"] = &models.Team{}
|
||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, tplTeamNew)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewTeamPost response for create new team
|
||||||
func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
|
@ -163,7 +172,7 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Team"] = t
|
ctx.Data["Team"] = t
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, tplTeamNew)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +180,7 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Err_TeamName"] = true
|
ctx.Data["Err_TeamName"] = true
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrTeamAlreadyExist(err):
|
case models.IsErrTeamAlreadyExist(err):
|
||||||
ctx.RenderWithErr(ctx.Tr("form.team_name_been_taken"), TEAM_NEW, &form)
|
ctx.RenderWithErr(ctx.Tr("form.team_name_been_taken"), tplTeamNew, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "NewTeam", err)
|
ctx.Handle(500, "NewTeam", err)
|
||||||
}
|
}
|
||||||
|
@ -181,6 +190,7 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TeamMembers render team members page
|
||||||
func TeamMembers(ctx *context.Context) {
|
func TeamMembers(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Org.Team.Name
|
ctx.Data["Title"] = ctx.Org.Team.Name
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
|
@ -188,9 +198,10 @@ func TeamMembers(ctx *context.Context) {
|
||||||
ctx.Handle(500, "GetMembers", err)
|
ctx.Handle(500, "GetMembers", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.HTML(200, TEAM_MEMBERS)
|
ctx.HTML(200, tplTeamMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TeamRepositories show the repositories of team
|
||||||
func TeamRepositories(ctx *context.Context) {
|
func TeamRepositories(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Org.Team.Name
|
ctx.Data["Title"] = ctx.Org.Team.Name
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
|
@ -198,17 +209,19 @@ func TeamRepositories(ctx *context.Context) {
|
||||||
ctx.Handle(500, "GetRepositories", err)
|
ctx.Handle(500, "GetRepositories", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.HTML(200, TEAM_REPOSITORIES)
|
ctx.HTML(200, tplTeamRepositories)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EditTeam render team edit page
|
||||||
func EditTeam(ctx *context.Context) {
|
func EditTeam(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||||
ctx.Data["PageIsOrgTeams"] = true
|
ctx.Data["PageIsOrgTeams"] = true
|
||||||
ctx.Data["team_name"] = ctx.Org.Team.Name
|
ctx.Data["team_name"] = ctx.Org.Team.Name
|
||||||
ctx.Data["desc"] = ctx.Org.Team.Description
|
ctx.Data["desc"] = ctx.Org.Team.Description
|
||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, tplTeamNew)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EditTeamPost response for modify team information
|
||||||
func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
t := ctx.Org.Team
|
t := ctx.Org.Team
|
||||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||||
|
@ -216,7 +229,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Team"] = t
|
ctx.Data["Team"] = t
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, tplTeamNew)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +260,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Data["Err_TeamName"] = true
|
ctx.Data["Err_TeamName"] = true
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrTeamAlreadyExist(err):
|
case models.IsErrTeamAlreadyExist(err):
|
||||||
ctx.RenderWithErr(ctx.Tr("form.team_name_been_taken"), TEAM_NEW, &form)
|
ctx.RenderWithErr(ctx.Tr("form.team_name_been_taken"), tplTeamNew, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "UpdateTeam", err)
|
ctx.Handle(500, "UpdateTeam", err)
|
||||||
}
|
}
|
||||||
|
@ -256,6 +269,7 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteTeam response for the delete team request
|
||||||
func DeleteTeam(ctx *context.Context) {
|
func DeleteTeam(ctx *context.Context) {
|
||||||
if err := models.DeleteTeam(ctx.Org.Team); err != nil {
|
if err := models.DeleteTeam(ctx.Org.Team); err != nil {
|
||||||
ctx.Flash.Error("DeleteTeam: " + err.Error())
|
ctx.Flash.Error("DeleteTeam: " + err.Error())
|
||||||
|
|
|
@ -19,11 +19,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SIGNIN base.TplName = "user/auth/signin"
|
// tplSignIn template for sign in page
|
||||||
SIGNUP base.TplName = "user/auth/signup"
|
tplSignIn base.TplName = "user/auth/signin"
|
||||||
ACTIVATE base.TplName = "user/auth/activate"
|
// tplSignUp template path for sign up page
|
||||||
FORGOT_PASSWORD base.TplName = "user/auth/forgot_passwd"
|
tplSignUp base.TplName = "user/auth/signup"
|
||||||
RESET_PASSWORD base.TplName = "user/auth/reset_passwd"
|
// TplActivate template path for activate user
|
||||||
|
TplActivate base.TplName = "user/auth/activate"
|
||||||
|
tplForgotPassword base.TplName = "user/auth/forgot_passwd"
|
||||||
|
tplResetPassword base.TplName = "user/auth/reset_passwd"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AutoSignIn reads cookie and try to auto-login.
|
// AutoSignIn reads cookie and try to auto-login.
|
||||||
|
@ -66,6 +69,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignIn render sign in page
|
||||||
func SignIn(ctx *context.Context) {
|
func SignIn(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_in")
|
ctx.Data["Title"] = ctx.Tr("sign_in")
|
||||||
|
|
||||||
|
@ -93,21 +97,22 @@ func SignIn(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SIGNIN)
|
ctx.HTML(200, tplSignIn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignInPost response for sign in request
|
||||||
func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_in")
|
ctx.Data["Title"] = ctx.Tr("sign_in")
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SIGNIN)
|
ctx.HTML(200, tplSignIn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.UserSignIn(form.UserName, form.Password)
|
u, err := models.UserSignIn(form.UserName, form.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), SIGNIN, &form)
|
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "UserSignIn", err)
|
ctx.Handle(500, "UserSignIn", err)
|
||||||
}
|
}
|
||||||
|
@ -143,6 +148,7 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubUrl + "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignOut sign out from login status
|
||||||
func SignOut(ctx *context.Context) {
|
func SignOut(ctx *context.Context) {
|
||||||
ctx.Session.Delete("uid")
|
ctx.Session.Delete("uid")
|
||||||
ctx.Session.Delete("uname")
|
ctx.Session.Delete("uname")
|
||||||
|
@ -155,6 +161,7 @@ func SignOut(ctx *context.Context) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/")
|
ctx.Redirect(setting.AppSubUrl + "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignUp render the register page
|
||||||
func SignUp(ctx *context.Context) {
|
func SignUp(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||||
|
|
||||||
|
@ -162,13 +169,14 @@ func SignUp(ctx *context.Context) {
|
||||||
|
|
||||||
if setting.Service.DisableRegistration {
|
if setting.Service.DisableRegistration {
|
||||||
ctx.Data["DisableRegistration"] = true
|
ctx.Data["DisableRegistration"] = true
|
||||||
ctx.HTML(200, SIGNUP)
|
ctx.HTML(200, tplSignUp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SIGNUP)
|
ctx.HTML(200, tplSignUp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignUpPost response for sign up information submission
|
||||||
func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
|
func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||||
|
|
||||||
|
@ -180,19 +188,19 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SIGNUP)
|
ctx.HTML(200, tplSignUp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if setting.Service.EnableCaptcha && !cpt.VerifyReq(ctx.Req) {
|
if setting.Service.EnableCaptcha && !cpt.VerifyReq(ctx.Req) {
|
||||||
ctx.Data["Err_Captcha"] = true
|
ctx.Data["Err_Captcha"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), tplSignUp, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if form.Password != form.Retype {
|
if form.Password != form.Retype {
|
||||||
ctx.Data["Err_Password"] = true
|
ctx.Data["Err_Password"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), tplSignUp, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,16 +214,16 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrUserAlreadyExist(err):
|
case models.IsErrUserAlreadyExist(err):
|
||||||
ctx.Data["Err_UserName"] = true
|
ctx.Data["Err_UserName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSignUp, &form)
|
||||||
case models.IsErrEmailAlreadyUsed(err):
|
case models.IsErrEmailAlreadyUsed(err):
|
||||||
ctx.Data["Err_Email"] = true
|
ctx.Data["Err_Email"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSignUp, &form)
|
||||||
case models.IsErrNameReserved(err):
|
case models.IsErrNameReserved(err):
|
||||||
ctx.Data["Err_UserName"] = true
|
ctx.Data["Err_UserName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), tplSignUp, &form)
|
||||||
case models.IsErrNamePatternNotAllowed(err):
|
case models.IsErrNamePatternNotAllowed(err):
|
||||||
ctx.Data["Err_UserName"] = true
|
ctx.Data["Err_UserName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tplSignUp, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "CreateUser", err)
|
ctx.Handle(500, "CreateUser", err)
|
||||||
}
|
}
|
||||||
|
@ -239,7 +247,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
||||||
ctx.Data["IsSendRegisterMail"] = true
|
ctx.Data["IsSendRegisterMail"] = true
|
||||||
ctx.Data["Email"] = u.Email
|
ctx.Data["Email"] = u.Email
|
||||||
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||||
ctx.HTML(200, ACTIVATE)
|
ctx.HTML(200, TplActivate)
|
||||||
|
|
||||||
if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
|
if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
|
||||||
log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
|
log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
|
||||||
|
@ -250,6 +258,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
ctx.Redirect(setting.AppSubUrl + "/user/login")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Activate render activate user page
|
||||||
func Activate(ctx *context.Context) {
|
func Activate(ctx *context.Context) {
|
||||||
code := ctx.Query("code")
|
code := ctx.Query("code")
|
||||||
if len(code) == 0 {
|
if len(code) == 0 {
|
||||||
|
@ -273,7 +282,7 @@ func Activate(ctx *context.Context) {
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["ServiceNotEnabled"] = true
|
ctx.Data["ServiceNotEnabled"] = true
|
||||||
}
|
}
|
||||||
ctx.HTML(200, ACTIVATE)
|
ctx.HTML(200, TplActivate)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,15 +308,16 @@ func Activate(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["IsActivateFailed"] = true
|
ctx.Data["IsActivateFailed"] = true
|
||||||
ctx.HTML(200, ACTIVATE)
|
ctx.HTML(200, TplActivate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActivateEmail render the activate email page
|
||||||
func ActivateEmail(ctx *context.Context) {
|
func ActivateEmail(ctx *context.Context) {
|
||||||
code := ctx.Query("code")
|
code := ctx.Query("code")
|
||||||
email_string := ctx.Query("email")
|
emailStr := ctx.Query("email")
|
||||||
|
|
||||||
// Verify code.
|
// Verify code.
|
||||||
if email := models.VerifyActiveEmailCode(code, email_string); email != nil {
|
if email := models.VerifyActiveEmailCode(code, emailStr); email != nil {
|
||||||
if err := email.Activate(); err != nil {
|
if err := email.Activate(); err != nil {
|
||||||
ctx.Handle(500, "ActivateEmail", err)
|
ctx.Handle(500, "ActivateEmail", err)
|
||||||
}
|
}
|
||||||
|
@ -320,19 +330,21 @@ func ActivateEmail(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForgotPasswd render the forget pasword page
|
||||||
func ForgotPasswd(ctx *context.Context) {
|
func ForgotPasswd(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
|
ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
|
||||||
|
|
||||||
if setting.MailService == nil {
|
if setting.MailService == nil {
|
||||||
ctx.Data["IsResetDisable"] = true
|
ctx.Data["IsResetDisable"] = true
|
||||||
ctx.HTML(200, FORGOT_PASSWORD)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["IsResetRequest"] = true
|
ctx.Data["IsResetRequest"] = true
|
||||||
ctx.HTML(200, FORGOT_PASSWORD)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForgotPasswdPost response for forget password request
|
||||||
func ForgotPasswdPost(ctx *context.Context) {
|
func ForgotPasswdPost(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
|
ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
|
||||||
|
|
||||||
|
@ -350,23 +362,23 @@ func ForgotPasswdPost(ctx *context.Context) {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||||
ctx.Data["IsResetSent"] = true
|
ctx.Data["IsResetSent"] = true
|
||||||
ctx.HTML(200, FORGOT_PASSWORD)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
ctx.Handle(500, "user.ResetPasswd(check existence)", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.Handle(500, "user.ResetPasswd(check existence)", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !u.IsLocal() {
|
if !u.IsLocal() {
|
||||||
ctx.Data["Err_Email"] = true
|
ctx.Data["Err_Email"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("auth.non_local_account"), FORGOT_PASSWORD, nil)
|
ctx.RenderWithErr(ctx.Tr("auth.non_local_account"), tplForgotPassword, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
|
if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
|
||||||
ctx.Data["ResendLimited"] = true
|
ctx.Data["ResendLimited"] = true
|
||||||
ctx.HTML(200, FORGOT_PASSWORD)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,9 +389,10 @@ func ForgotPasswdPost(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
|
||||||
ctx.Data["IsResetSent"] = true
|
ctx.Data["IsResetSent"] = true
|
||||||
ctx.HTML(200, FORGOT_PASSWORD)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResetPasswd render the reset password page
|
||||||
func ResetPasswd(ctx *context.Context) {
|
func ResetPasswd(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.reset_password")
|
ctx.Data["Title"] = ctx.Tr("auth.reset_password")
|
||||||
|
|
||||||
|
@ -390,9 +403,10 @@ func ResetPasswd(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Code"] = code
|
ctx.Data["Code"] = code
|
||||||
ctx.Data["IsResetForm"] = true
|
ctx.Data["IsResetForm"] = true
|
||||||
ctx.HTML(200, RESET_PASSWORD)
|
ctx.HTML(200, tplResetPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResetPasswdPost response fro reset password request
|
||||||
func ResetPasswdPost(ctx *context.Context) {
|
func ResetPasswdPost(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.reset_password")
|
ctx.Data["Title"] = ctx.Tr("auth.reset_password")
|
||||||
|
|
||||||
|
@ -409,7 +423,7 @@ func ResetPasswdPost(ctx *context.Context) {
|
||||||
if len(passwd) < 6 {
|
if len(passwd) < 6 {
|
||||||
ctx.Data["IsResetForm"] = true
|
ctx.Data["IsResetForm"] = true
|
||||||
ctx.Data["Err_Password"] = true
|
ctx.Data["Err_Password"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("auth.password_too_short"), RESET_PASSWORD, nil)
|
ctx.RenderWithErr(ctx.Tr("auth.password_too_short"), tplResetPassword, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,5 +442,5 @@ func ResetPasswdPost(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["IsResetFailed"] = true
|
ctx.Data["IsResetFailed"] = true
|
||||||
ctx.HTML(200, RESET_PASSWORD)
|
ctx.HTML(200, tplResetPassword)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DASHBOARD base.TplName = "user/dashboard/dashboard"
|
tplDashborad base.TplName = "user/dashboard/dashboard"
|
||||||
ISSUES base.TplName = "user/dashboard/issues"
|
tplIssues base.TplName = "user/dashboard/issues"
|
||||||
PROFILE base.TplName = "user/profile"
|
tplProfile base.TplName = "user/profile"
|
||||||
ORG_HOME base.TplName = "org/home"
|
tplOrgHome base.TplName = "org/home"
|
||||||
)
|
)
|
||||||
|
|
||||||
// getDashboardContextUser finds out dashboard is viewing as which context user.
|
// getDashboardContextUser finds out dashboard is viewing as which context user.
|
||||||
|
@ -86,6 +86,7 @@ func retrieveFeeds(ctx *context.Context, ctxUser *models.User, userID, offset in
|
||||||
ctx.Data["Feeds"] = feeds
|
ctx.Data["Feeds"] = feeds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dashboard render the dashborad page
|
||||||
func Dashboard(ctx *context.Context) {
|
func Dashboard(ctx *context.Context) {
|
||||||
ctxUser := getDashboardContextUser(ctx)
|
ctxUser := getDashboardContextUser(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
@ -150,9 +151,10 @@ func Dashboard(ctx *context.Context) {
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.HTML(200, DASHBOARD)
|
ctx.HTML(200, tplDashborad)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issues render the user issues page
|
||||||
func Issues(ctx *context.Context) {
|
func Issues(ctx *context.Context) {
|
||||||
isPullList := ctx.Params(":type") == "pulls"
|
isPullList := ctx.Params(":type") == "pulls"
|
||||||
if isPullList {
|
if isPullList {
|
||||||
|
@ -308,9 +310,10 @@ func Issues(ctx *context.Context) {
|
||||||
ctx.Data["State"] = "open"
|
ctx.Data["State"] = "open"
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, ISSUES)
|
ctx.HTML(200, tplIssues)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ShowSSHKeys ouput all the ssh keys of user by uid
|
||||||
func ShowSSHKeys(ctx *context.Context, uid int64) {
|
func ShowSSHKeys(ctx *context.Context, uid int64) {
|
||||||
keys, err := models.ListPublicKeys(uid)
|
keys, err := models.ListPublicKeys(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -373,9 +376,10 @@ func showOrgProfile(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Data["Teams"] = org.Teams
|
ctx.Data["Teams"] = org.Teams
|
||||||
|
|
||||||
ctx.HTML(200, ORG_HOME)
|
ctx.HTML(200, tplOrgHome)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Email2User show user page via email
|
||||||
func Email2User(ctx *context.Context) {
|
func Email2User(ctx *context.Context) {
|
||||||
u, err := models.GetUserByEmail(ctx.Query("email"))
|
u, err := models.GetUserByEmail(ctx.Query("email"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -19,10 +19,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FOLLOWERS base.TplName = "user/meta/followers"
|
tplFollowers base.TplName = "user/meta/followers"
|
||||||
STARS base.TplName = "user/meta/stars"
|
tplStars base.TplName = "user/meta/stars"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetUserByName get user by name
|
||||||
func GetUserByName(ctx *context.Context, name string) *models.User {
|
func GetUserByName(ctx *context.Context, name string) *models.User {
|
||||||
user, err := models.GetUserByName(name)
|
user, err := models.GetUserByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -41,6 +42,7 @@ func GetUserByParams(ctx *context.Context) *models.User {
|
||||||
return GetUserByName(ctx, ctx.Params(":username"))
|
return GetUserByName(ctx, ctx.Params(":username"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Profile render user's profile page
|
||||||
func Profile(ctx *context.Context) {
|
func Profile(ctx *context.Context) {
|
||||||
uname := ctx.Params(":username")
|
uname := ctx.Params(":username")
|
||||||
// Special handle for FireFox requests favicon.ico.
|
// Special handle for FireFox requests favicon.ico.
|
||||||
|
@ -107,9 +109,10 @@ func Profile(ctx *context.Context) {
|
||||||
ctx.Data["Page"] = paginater.New(ctxUser.NumRepos, setting.UI.User.RepoPagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(ctxUser.NumRepos, setting.UI.User.RepoPagingNum, page, 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, PROFILE)
|
ctx.HTML(200, tplProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Followers render user's followers page
|
||||||
func Followers(ctx *context.Context) {
|
func Followers(ctx *context.Context) {
|
||||||
u := GetUserByParams(ctx)
|
u := GetUserByParams(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
@ -119,9 +122,10 @@ func Followers(ctx *context.Context) {
|
||||||
ctx.Data["CardsTitle"] = ctx.Tr("user.followers")
|
ctx.Data["CardsTitle"] = ctx.Tr("user.followers")
|
||||||
ctx.Data["PageIsFollowers"] = true
|
ctx.Data["PageIsFollowers"] = true
|
||||||
ctx.Data["Owner"] = u
|
ctx.Data["Owner"] = u
|
||||||
repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, FOLLOWERS)
|
repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, tplFollowers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Following render user's followering page
|
||||||
func Following(ctx *context.Context) {
|
func Following(ctx *context.Context) {
|
||||||
u := GetUserByParams(ctx)
|
u := GetUserByParams(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
@ -131,13 +135,15 @@ func Following(ctx *context.Context) {
|
||||||
ctx.Data["CardsTitle"] = ctx.Tr("user.following")
|
ctx.Data["CardsTitle"] = ctx.Tr("user.following")
|
||||||
ctx.Data["PageIsFollowing"] = true
|
ctx.Data["PageIsFollowing"] = true
|
||||||
ctx.Data["Owner"] = u
|
ctx.Data["Owner"] = u
|
||||||
repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, FOLLOWERS)
|
repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, tplFollowers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stars show repositories user starred
|
||||||
func Stars(ctx *context.Context) {
|
func Stars(ctx *context.Context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Action response for follow/unfollow user request
|
||||||
func Action(ctx *context.Context) {
|
func Action(ctx *context.Context) {
|
||||||
u := GetUserByParams(ctx)
|
u := GetUserByParams(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
|
|
|
@ -21,22 +21,23 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SETTINGS_PROFILE base.TplName = "user/settings/profile"
|
tplSettingsProfile base.TplName = "user/settings/profile"
|
||||||
SETTINGS_AVATAR base.TplName = "user/settings/avatar"
|
tplSettingsAvatar base.TplName = "user/settings/avatar"
|
||||||
SETTINGS_PASSWORD base.TplName = "user/settings/password"
|
tplSettingsPassword base.TplName = "user/settings/password"
|
||||||
SETTINGS_EMAILS base.TplName = "user/settings/email"
|
tplSettingsEmails base.TplName = "user/settings/email"
|
||||||
SETTINGS_SSH_KEYS base.TplName = "user/settings/sshkeys"
|
tplSettingsSSHKeys base.TplName = "user/settings/sshkeys"
|
||||||
SETTINGS_SOCIAL base.TplName = "user/settings/social"
|
tplSettingsSocial base.TplName = "user/settings/social"
|
||||||
SETTINGS_APPLICATIONS base.TplName = "user/settings/applications"
|
tplSettingsApplications base.TplName = "user/settings/applications"
|
||||||
SETTINGS_DELETE base.TplName = "user/settings/delete"
|
tplSettingsDelete base.TplName = "user/settings/delete"
|
||||||
NOTIFICATION base.TplName = "user/notification"
|
tplNotification base.TplName = "user/notification"
|
||||||
SECURITY base.TplName = "user/security"
|
tplSecurity base.TplName = "user/security"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Settings render user's profile page
|
||||||
func Settings(ctx *context.Context) {
|
func Settings(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsProfile"] = true
|
ctx.Data["PageIsSettingsProfile"] = true
|
||||||
ctx.HTML(200, SETTINGS_PROFILE)
|
ctx.HTML(200, tplSettingsProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleUsernameChange(ctx *context.Context, newName string) {
|
func handleUsernameChange(ctx *context.Context, newName string) {
|
||||||
|
@ -74,12 +75,13 @@ func handleUsernameChange(ctx *context.Context, newName string) {
|
||||||
ctx.User.LowerName = strings.ToLower(newName)
|
ctx.User.LowerName = strings.ToLower(newName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsPost response for change user's profile
|
||||||
func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
|
func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsProfile"] = true
|
ctx.Data["PageIsSettingsProfile"] = true
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_PROFILE)
|
ctx.HTML(200, tplSettingsProfile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +104,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateAvatarSetting update user's avatar
|
||||||
// FIXME: limit size.
|
// FIXME: limit size.
|
||||||
func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *models.User) error {
|
func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *models.User) error {
|
||||||
ctxUser.UseCustomAvatar = form.Source == auth.AvatarLocal
|
ctxUser.UseCustomAvatar = form.Source == auth.AvatarLocal
|
||||||
|
@ -144,12 +147,14 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *mo
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsAvatar render user avatar page
|
||||||
func SettingsAvatar(ctx *context.Context) {
|
func SettingsAvatar(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsAvatar"] = true
|
ctx.Data["PageIsSettingsAvatar"] = true
|
||||||
ctx.HTML(200, SETTINGS_AVATAR)
|
ctx.HTML(200, tplSettingsAvatar)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsAvatarPost response for change user's avatar request
|
||||||
func SettingsAvatarPost(ctx *context.Context, form auth.AvatarForm) {
|
func SettingsAvatarPost(ctx *context.Context, form auth.AvatarForm) {
|
||||||
if err := UpdateAvatarSetting(ctx, form, ctx.User); err != nil {
|
if err := UpdateAvatarSetting(ctx, form, ctx.User); err != nil {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
|
@ -160,6 +165,7 @@ func SettingsAvatarPost(ctx *context.Context, form auth.AvatarForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsDeleteAvatar render delete avatar page
|
||||||
func SettingsDeleteAvatar(ctx *context.Context) {
|
func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
if err := ctx.User.DeleteAvatar(); err != nil {
|
if err := ctx.User.DeleteAvatar(); err != nil {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
|
@ -168,18 +174,20 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/avatar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsPassword render change user's password page
|
||||||
func SettingsPassword(ctx *context.Context) {
|
func SettingsPassword(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsPassword"] = true
|
ctx.Data["PageIsSettingsPassword"] = true
|
||||||
ctx.HTML(200, SETTINGS_PASSWORD)
|
ctx.HTML(200, tplSettingsPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsPasswordPost response for change user's password
|
||||||
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsPassword"] = true
|
ctx.Data["PageIsSettingsPassword"] = true
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_PASSWORD)
|
ctx.HTML(200, tplSettingsPassword)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +210,7 @@ func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsEmails render user's emails page
|
||||||
func SettingsEmails(ctx *context.Context) {
|
func SettingsEmails(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsEmails"] = true
|
ctx.Data["PageIsSettingsEmails"] = true
|
||||||
|
@ -213,9 +222,10 @@ func SettingsEmails(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Emails"] = emails
|
ctx.Data["Emails"] = emails
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_EMAILS)
|
ctx.HTML(200, tplSettingsEmails)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsEmailPost response for change user's email
|
||||||
func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsEmails"] = true
|
ctx.Data["PageIsSettingsEmails"] = true
|
||||||
|
@ -241,7 +251,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
||||||
ctx.Data["Emails"] = emails
|
ctx.Data["Emails"] = emails
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_EMAILS)
|
ctx.HTML(200, tplSettingsEmails)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +262,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
||||||
}
|
}
|
||||||
if err := models.AddEmailAddress(email); err != nil {
|
if err := models.AddEmailAddress(email); err != nil {
|
||||||
if models.IsErrEmailAlreadyUsed(err) {
|
if models.IsErrEmailAlreadyUsed(err) {
|
||||||
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SETTINGS_EMAILS, &form)
|
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSettingsEmails, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Handle(500, "AddEmailAddress", err)
|
ctx.Handle(500, "AddEmailAddress", err)
|
||||||
|
@ -275,6 +285,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteEmail reponse for delete user's email
|
||||||
func DeleteEmail(ctx *context.Context) {
|
func DeleteEmail(ctx *context.Context) {
|
||||||
if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
|
if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
|
||||||
ctx.Handle(500, "DeleteEmail", err)
|
ctx.Handle(500, "DeleteEmail", err)
|
||||||
|
@ -288,6 +299,7 @@ func DeleteEmail(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsSSHKeys render user's SSH public keys page
|
||||||
func SettingsSSHKeys(ctx *context.Context) {
|
func SettingsSSHKeys(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsSSHKeys"] = true
|
ctx.Data["PageIsSettingsSSHKeys"] = true
|
||||||
|
@ -299,9 +311,10 @@ func SettingsSSHKeys(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Keys"] = keys
|
ctx.Data["Keys"] = keys
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
ctx.HTML(200, tplSettingsSSHKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsSSHKeysPost response for change user's SSH keys
|
||||||
func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsSSHKeys"] = true
|
ctx.Data["PageIsSettingsSSHKeys"] = true
|
||||||
|
@ -314,7 +327,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
||||||
ctx.Data["Keys"] = keys
|
ctx.Data["Keys"] = keys
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
ctx.HTML(200, tplSettingsSSHKeys)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,10 +347,10 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrKeyAlreadyExist(err):
|
case models.IsErrKeyAlreadyExist(err):
|
||||||
ctx.Data["Err_Content"] = true
|
ctx.Data["Err_Content"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_been_used"), SETTINGS_SSH_KEYS, &form)
|
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_been_used"), tplSettingsSSHKeys, &form)
|
||||||
case models.IsErrKeyNameAlreadyUsed(err):
|
case models.IsErrKeyNameAlreadyUsed(err):
|
||||||
ctx.Data["Err_Title"] = true
|
ctx.Data["Err_Title"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_name_used"), SETTINGS_SSH_KEYS, &form)
|
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_name_used"), tplSettingsSSHKeys, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "AddPublicKey", err)
|
ctx.Handle(500, "AddPublicKey", err)
|
||||||
}
|
}
|
||||||
|
@ -348,6 +361,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteSSHKey response for delete user's SSH key
|
||||||
func DeleteSSHKey(ctx *context.Context) {
|
func DeleteSSHKey(ctx *context.Context) {
|
||||||
if err := models.DeletePublicKey(ctx.User, ctx.QueryInt64("id")); err != nil {
|
if err := models.DeletePublicKey(ctx.User, ctx.QueryInt64("id")); err != nil {
|
||||||
ctx.Flash.Error("DeletePublicKey: " + err.Error())
|
ctx.Flash.Error("DeletePublicKey: " + err.Error())
|
||||||
|
@ -360,6 +374,7 @@ func DeleteSSHKey(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsApplications render user's access tokens page
|
||||||
func SettingsApplications(ctx *context.Context) {
|
func SettingsApplications(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsApplications"] = true
|
ctx.Data["PageIsSettingsApplications"] = true
|
||||||
|
@ -371,9 +386,10 @@ func SettingsApplications(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Data["Tokens"] = tokens
|
ctx.Data["Tokens"] = tokens
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_APPLICATIONS)
|
ctx.HTML(200, tplSettingsApplications)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsApplicationsPost response for add user's access token
|
||||||
func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm) {
|
func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsApplications"] = true
|
ctx.Data["PageIsSettingsApplications"] = true
|
||||||
|
@ -385,7 +401,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["Tokens"] = tokens
|
ctx.Data["Tokens"] = tokens
|
||||||
ctx.HTML(200, SETTINGS_APPLICATIONS)
|
ctx.HTML(200, tplSettingsApplications)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +420,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/applications")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/applications")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsDeleteApplication response for delete user access token
|
||||||
func SettingsDeleteApplication(ctx *context.Context) {
|
func SettingsDeleteApplication(ctx *context.Context) {
|
||||||
if err := models.DeleteAccessTokenByID(ctx.QueryInt64("id")); err != nil {
|
if err := models.DeleteAccessTokenByID(ctx.QueryInt64("id")); err != nil {
|
||||||
ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error())
|
ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error())
|
||||||
|
@ -416,6 +433,7 @@ func SettingsDeleteApplication(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingsDelete render user suicide page and response for delete user himself
|
||||||
func SettingsDelete(ctx *context.Context) {
|
func SettingsDelete(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsDelete"] = true
|
ctx.Data["PageIsSettingsDelete"] = true
|
||||||
|
@ -423,7 +441,7 @@ func SettingsDelete(ctx *context.Context) {
|
||||||
if ctx.Req.Method == "POST" {
|
if ctx.Req.Method == "POST" {
|
||||||
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
|
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsDelete, nil)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "UserSignIn", err)
|
ctx.Handle(500, "UserSignIn", err)
|
||||||
}
|
}
|
||||||
|
@ -448,5 +466,5 @@ func SettingsDelete(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_DELETE)
|
ctx.HTML(200, tplSettingsDelete)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue