diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e369ee8b30..00b374835f 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -298,6 +298,7 @@ orgs = Organizations delete = Delete Account twofa = Two-Factor Authentication account_link = External Accounts +organization = Organization uid = Uid public_profile = Public Profile @@ -431,6 +432,8 @@ remove_account_link = Remove linked account remove_account_link_desc = Removing this linked account will revoke all related access using this account. Do you want to continue? remove_account_link_success = Account link has been removed successfully! +orgs_none = You are not a member of any organizations. + delete_account = Delete Your Account delete_prompt = The operation will delete your account permanently, and CANNOT be undone! confirm_delete_account = Confirm Deletion diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 0781aef89d..ecb95e3785 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -223,6 +223,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/applications/delete", user.SettingsDeleteApplication) m.Route("/delete", "GET,POST", user.SettingsDelete) m.Combo("/account_link").Get(user.SettingsAccountLinks).Post(user.SettingsDeleteAccountLink) + m.Get("/organization", user.SettingsOrganization) m.Group("/two_factor", func() { m.Get("", user.SettingsTwoFactor) m.Post("/regenerate_scratch", user.SettingsTwoFactorRegenerateScratch) diff --git a/routers/user/setting.go b/routers/user/setting.go index 8fa9834167..f0cb9e7843 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -38,6 +38,7 @@ const ( tplSettingsTwofa base.TplName = "user/settings/twofa" tplSettingsTwofaEnroll base.TplName = "user/settings/twofa_enroll" tplSettingsAccountLink base.TplName = "user/settings/account_link" + tplSettingsOrganization base.TplName = "user/settings/organization" tplSettingsDelete base.TplName = "user/settings/delete" tplSecurity base.TplName = "user/security" ) @@ -771,3 +772,16 @@ func SettingsDelete(ctx *context.Context) { ctx.HTML(200, tplSettingsDelete) } + +// SettingsOrganization render all the organization of the user +func SettingsOrganization(ctx *context.Context) { + ctx.Data["Title"] = ctx.Tr("settings") + ctx.Data["PageIsSettingsOrganization"] = true + orgs, err := models.GetOrgsByUserID(ctx.User.ID, ctx.IsSigned) + if err != nil { + ctx.Handle(500, "GetOrgsByUserID", err) + return + } + ctx.Data["Orgs"] = orgs + ctx.HTML(200, tplSettingsOrganization) +} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 4aac9effb5..ab9b41666d 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -28,6 +28,9 @@ {{.i18n.Tr "settings.account_link"}} + + {{.i18n.Tr "settings.organization"}} + {{.i18n.Tr "settings.delete"}} diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl new file mode 100644 index 0000000000..2d357cb3b5 --- /dev/null +++ b/templates/user/settings/organization.tmpl @@ -0,0 +1,35 @@ +{{template "base/head" .}} +