diff options
-rw-r--r-- | cmd/web.go | 4 | ||||
-rw-r--r-- | conf/app.ini | 3 | ||||
-rw-r--r-- | models/admin.go | 23 | ||||
-rw-r--r-- | modules/context/context.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 50 | ||||
-rw-r--r-- | modules/util/remove.go | 14 | ||||
-rw-r--r-- | modules/util/remove_windows.go | 16 | ||||
-rw-r--r-- | options/locale/locale_en-US.ini | 2 | ||||
-rw-r--r-- | public/css/index.css | 82 | ||||
-rw-r--r-- | public/less/_repository.less | 42 | ||||
-rw-r--r-- | public/less/_user.less | 17 | ||||
-rw-r--r-- | routers/user/auth_openid.go | 20 | ||||
-rw-r--r-- | templates/admin/config.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/graph.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/settings/deploy_keys.tmpl | 35 | ||||
-rw-r--r-- | templates/user/settings/account_link.tmpl | 12 | ||||
-rw-r--r-- | templates/user/settings/applications.tmpl | 29 | ||||
-rw-r--r-- | templates/user/settings/email.tmpl | 34 | ||||
-rw-r--r-- | templates/user/settings/openid.tmpl | 14 | ||||
-rw-r--r-- | templates/user/settings/sshkeys.tmpl | 35 |
20 files changed, 212 insertions, 228 deletions
diff --git a/cmd/web.go b/cmd/web.go index 3a20191bc5..1f2561ca68 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -200,7 +200,7 @@ func runWeb(ctx *cli.Context) error { m.Group("/user", func() { m.Get("/login", user.SignIn) m.Post("/login", bindIgnErr(auth.SignInForm{}), user.SignInPost) - if setting.EnableOpenIDSignIn { + if setting.Service.EnableOpenIDSignIn { m.Combo("/login/openid"). Get(user.SignInOpenID). Post(bindIgnErr(auth.SignInOpenIDForm{}), user.SignInOpenIDPost) @@ -243,7 +243,7 @@ func runWeb(ctx *cli.Context) error { m.Post("/email/delete", user.DeleteEmail) m.Get("/password", user.SettingsPassword) m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost) - if setting.EnableOpenIDSignIn { + if setting.Service.EnableOpenIDSignIn { m.Group("/openid", func() { m.Combo("").Get(user.SettingsOpenID). Post(bindIgnErr(auth.AddOpenIDForm{}), user.SettingsOpenIDPost) diff --git a/conf/app.ini b/conf/app.ini index 32791ed162..07c3a1d21c 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -203,7 +203,8 @@ IMPORT_LOCAL_PATHS = false ; Whether to allow signin in via OpenID ENABLE_OPENID_SIGNIN = true ; Whether to allow registering via OpenID -ENABLE_OPENID_SIGNUP = true +; Do not include to rely on DISABLE_REGISTRATION setting +;ENABLE_OPENID_SIGNUP = true ; Allowed URI patterns (POSIX regexp). ; Space separated. ; Only these would be allowed if non-blank. diff --git a/models/admin.go b/models/admin.go index e573c9ba79..f8645202d8 100644 --- a/models/admin.go +++ b/models/admin.go @@ -6,16 +6,13 @@ package models import ( "fmt" - "os" - "os/exec" - "strings" "time" + "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/util" + "github.com/Unknwon/com" "github.com/go-xorm/xorm" - - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" ) //NoticeType describes the notice type @@ -79,19 +76,7 @@ func RemoveAllWithNotice(title, path string) { } func removeAllWithNotice(e Engine, title, path string) { - var err error - // workaround for Go not being able to remove read-only files/folders: https://github.com/golang/go/issues/9606 - // this bug should be fixed on Go 1.7, so the workaround should be removed when Gogs don't support Go 1.6 anymore: - // https://github.com/golang/go/commit/2ffb3e5d905b5622204d199128dec06cefd57790 - if setting.IsWindows { - // converting "/" to "\" in path on Windows - path = strings.Replace(path, "/", "\\", -1) - err = exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run() - } else { - err = os.RemoveAll(path) - } - - if err != nil { + if err := util.RemoveAll(path); err != nil { desc := fmt.Sprintf("%s [%s]: %v", title, path, err) log.Warn(desc) if err = createNotice(e, NoticeRepository, desc); err != nil { diff --git a/modules/context/context.go b/modules/context/context.go index 52e50af6a1..e96bf5bd3f 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -197,7 +197,7 @@ func Contexter() macaron.Handler { ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion - ctx.Data["EnableOpenIDSignIn"] = setting.EnableOpenIDSignIn + ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn c.Map(ctx) } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 8c45e61e81..59cc755d03 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -121,12 +121,6 @@ var ( MinPasswordLength int ImportLocalPaths bool - // OpenID settings - EnableOpenIDSignIn bool - EnableOpenIDSignUp bool - OpenIDWhitelist []*regexp.Regexp - OpenIDBlacklist []*regexp.Regexp - // Database settings UseSQLite3 bool UseMySQL bool @@ -758,24 +752,6 @@ please consider changing to GITEA_CUSTOM`) MinPasswordLength = sec.Key("MIN_PASSWORD_LENGTH").MustInt(6) ImportLocalPaths = sec.Key("IMPORT_LOCAL_PATHS").MustBool(false) - sec = Cfg.Section("openid") - EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(true) - EnableOpenIDSignUp = sec.Key("ENABLE_OPENID_SIGNUP").MustBool(true) - pats := sec.Key("WHITELISTED_URIS").Strings(" ") - if len(pats) != 0 { - OpenIDWhitelist = make([]*regexp.Regexp, len(pats)) - for i, p := range pats { - OpenIDWhitelist[i] = regexp.MustCompilePOSIX(p) - } - } - pats = sec.Key("BLACKLISTED_URIS").Strings(" ") - if len(pats) != 0 { - OpenIDBlacklist = make([]*regexp.Regexp, len(pats)) - for i, p := range pats { - OpenIDBlacklist[i] = regexp.MustCompilePOSIX(p) - } - } - sec = Cfg.Section("attachment") AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments")) if !filepath.IsAbs(AttachmentPath) { @@ -939,6 +915,13 @@ var Service struct { EnableCaptcha bool DefaultKeepEmailPrivate bool NoReplyAddress string + + // OpenID settings + EnableOpenIDSignIn bool + EnableOpenIDSignUp bool + OpenIDWhitelist []*regexp.Regexp + OpenIDBlacklist []*regexp.Regexp + } func newService() { @@ -953,6 +936,25 @@ func newService() { Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool() Service.DefaultKeepEmailPrivate = sec.Key("DEFAULT_KEEP_EMAIL_PRIVATE").MustBool() Service.NoReplyAddress = sec.Key("NO_REPLY_ADDRESS").MustString("noreply.example.org") + + sec = Cfg.Section("openid") + Service.EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(true) + Service.EnableOpenIDSignUp = sec.Key("ENABLE_OPENID_SIGNUP").MustBool(!Service.DisableRegistration) + pats := sec.Key("WHITELISTED_URIS").Strings(" ") + if len(pats) != 0 { + Service.OpenIDWhitelist = make([]*regexp.Regexp, len(pats)) + for i, p := range pats { + Service.OpenIDWhitelist[i] = regexp.MustCompilePOSIX(p) + } + } + pats = sec.Key("BLACKLISTED_URIS").Strings(" ") + if len(pats) != 0 { + Service.OpenIDBlacklist = make([]*regexp.Regexp, len(pats)) + for i, p := range pats { + Service.OpenIDBlacklist[i] = regexp.MustCompilePOSIX(p) + } + } + } var logLevels = map[string]string{ diff --git a/modules/util/remove.go b/modules/util/remove.go new file mode 100644 index 0000000000..8bca149914 --- /dev/null +++ b/modules/util/remove.go @@ -0,0 +1,14 @@ +// +build !windows,!go1.7 go1.7 + +// Copyright 2017 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package util + +import "os" + +// RemoveAll files from Go version 1.7 onward +func RemoveAll(path string) error { + return os.RemoveAll(path) +} diff --git a/modules/util/remove_windows.go b/modules/util/remove_windows.go new file mode 100644 index 0000000000..f5891a589c --- /dev/null +++ b/modules/util/remove_windows.go @@ -0,0 +1,16 @@ +// +build windows,!go1.7 + +// Copyright 2017 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package util + +// RemoveAll files from path on windows +// workaround for Go not being able to remove read-only files/folders: https://github.com/golang/go/issues/9606 +// this bug should be fixed on Go 1.7, so the workaround should be removed when Gitea don't support Go 1.6 anymore: +// https://github.com/golang/go/commit/2ffb3e5d905b5622204d199128dec06cefd57790 +func RemoveAll(path string) error { + path = strings.Replace(path, "/", "\\", -1) + return exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run() +} diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 2251075963..80260d4b7d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1211,6 +1211,8 @@ config.db_path_helper = (for "sqlite3" and "tidb") config.service_config = Service Configuration config.register_email_confirm = Require Email Confirmation config.disable_register = Disable Registration +config.enable_openid_signup = Enable Registration via OpenID +config.enable_openid_signin = Enable OpenID Sign In config.show_registration_button = Show Register Button config.require_sign_in_view = Require Sign In View config.mail_notify = Mail Notification diff --git a/public/css/index.css b/public/css/index.css index 01ffd7e928..8409b5128d 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -820,7 +820,7 @@ footer .ui.language .menu { border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; - box-shadow: inset 0 -1px 0 #bbbbbb; + box-shadow: inset 0 -1px 0 #bbb; } .markdown:not(code) input[type="checkbox"] { vertical-align: middle !important; @@ -896,7 +896,7 @@ footer .ui.language .menu { } .install form label { text-align: right; - width: 320px; + width: 320px !important; } .install form input { width: 35% !important; @@ -905,7 +905,7 @@ footer .ui.language .menu { text-align: left; } .install form .field .help { - margin-left: 335px; + margin-left: 335px !important; } .install form .field.optional .title { margin-left: 38%; @@ -940,18 +940,18 @@ footer .ui.language .menu { text-align: center; } #create-page-form form .header { - padding-left: 280px; + padding-left: 280px !important; } #create-page-form form .inline.field > label { text-align: right; - width: 250px; + width: 250px !important; word-wrap: break-word; } #create-page-form form .help { - margin-left: 265px; + margin-left: 265px !important; } #create-page-form form .optional .title { - margin-left: 250px; + margin-left: 250px !important; } #create-page-form form input, #create-page-form form textarea { @@ -994,7 +994,7 @@ footer .ui.language .menu { .user.reset.password form .header, .user.signin form .header, .user.signup form .header { - padding-left: 280px; + padding-left: 280px !important; } .user.activate form .inline.field > label, .user.forgot.password form .inline.field > label, @@ -1002,7 +1002,7 @@ footer .ui.language .menu { .user.signin form .inline.field > label, .user.signup form .inline.field > label { text-align: right; - width: 250px; + width: 250px !important; word-wrap: break-word; } .user.activate form .help, @@ -1010,14 +1010,14 @@ footer .ui.language .menu { .user.reset.password form .help, .user.signin form .help, .user.signup form .help { - margin-left: 265px; + margin-left: 265px !important; } .user.activate form .optional .title, .user.forgot.password form .optional .title, .user.reset.password form .optional .title, .user.signin form .optional .title, .user.signup form .optional .title { - margin-left: 250px; + margin-left: 250px !important; } .user.activate form input, .user.forgot.password form input, @@ -1051,7 +1051,7 @@ footer .ui.language .menu { .user.reset.password form .inline.field > label, .user.signin form .inline.field > label, .user.signup form .inline.field > label { - width: 200px; + width: 200px !important; } .repository.new.repo form, .repository.new.migrate form, @@ -1067,24 +1067,24 @@ footer .ui.language .menu { .repository.new.repo form .header, .repository.new.migrate form .header, .repository.new.fork form .header { - padding-left: 280px; + padding-left: 280px !important; } .repository.new.repo form .inline.field > label, .repository.new.migrate form .inline.field > label, .repository.new.fork form .inline.field > label { text-align: right; - width: 250px; + width: 250px !important; word-wrap: break-word; } .repository.new.repo form .help, .repository.new.migrate form .help, .repository.new.fork form .help { - margin-left: 265px; + margin-left: 265px !important; } .repository.new.repo form .optional .title, .repository.new.migrate form .optional .title, .repository.new.fork form .optional .title { - margin-left: 250px; + margin-left: 250px !important; } .repository.new.repo form input, .repository.new.migrate form input, @@ -1119,7 +1119,7 @@ footer .ui.language .menu { width: 50%!important; } .repository.new.repo .ui.form #auto-init { - margin-left: 265px; + margin-left: 265px !important; } .new.webhook form .help { margin-left: 25px; @@ -2374,25 +2374,25 @@ footer .ui.language .menu { .settings .content .segment { box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15); } -.settings .key.list .item:not(:first-child) { +.settings .list .item .green { + color: #21BA45 !important; +} +.settings .list .item:not(:first-child) { border-top: 1px solid #eaeaea; + padding: 1rem; + margin: 15px -1rem -1rem -1rem; + min-height: 60px; } -.settings .key.list .ssh-key-state-indicator { - float: left; - color: gray; - padding-left: 10px; - padding-top: 10px; +.settings .list .item > .mega-octicon { + display: table-cell; } -.settings .key.list .ssh-key-state-indicator.active { - color: #6cc644; +.settings .list .item > .mega-octicon + .content { + display: table-cell; + padding: 0 0 0 .5em; + vertical-align: top; } -.settings .key.list .meta { +.settings .list.key .meta { padding-top: 5px; -} -.settings .key.list .print { - color: #767676; -} -.settings .key.list .activity { color: #666; } .settings .hook.list > .item:not(:first-child) { @@ -2625,18 +2625,18 @@ footer .ui.language .menu { text-align: center; } .organization.new.org form .header { - padding-left: 280px; + padding-left: 280px !important; } .organization.new.org form .inline.field > label { text-align: right; - width: 250px; + width: 250px !important; word-wrap: break-word; } .organization.new.org form .help { - margin-left: 265px; + margin-left: 265px !important; } .organization.new.org form .optional .title { - margin-left: 250px; + margin-left: 250px !important; } .organization.new.org form input, .organization.new.org form textarea { @@ -2738,18 +2738,6 @@ footer .ui.language .menu { padding-top: 15px; padding-bottom: 80px; } -.user.settings .list .item.ui.grid { - margin-top: 15px; -} -.user.settings .email.list .item:not(:first-child), -.user.settings .openid.list .item:not(:first-child) { - border-top: 1px solid #eaeaea; - height: 50px; -} -.user.settings .email.list .item:not(:first-child) .button, -.user.settings .openid.list .item:not(:first-child) .button { - margin-top: -10px; -} .user.profile .ui.card .username { display: block; } diff --git a/public/less/_repository.less b/public/less/_repository.less index 406dfb2ac8..7fadc21a86 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1362,27 +1362,31 @@ box-shadow: 0 1px 2px 0 rgba(34,36,38,.15); } } - .key.list { - .item:not(:first-child) { - border-top: 1px solid #eaeaea; - } - .ssh-key-state-indicator { - float: left; - color: gray; - padding-left: 10px; - padding-top: 10px; - &.active { - color: #6cc644; + .list { + .item { + .green { + color: #21BA45 !important; + } + &:not(:first-child) { + border-top: 1px solid #eaeaea; + padding:1rem; + margin: 15px -1rem -1rem -1rem; + min-height: 60px; + } + > .mega-octicon { + display: table-cell; + } + > .mega-octicon + .content { + display: table-cell; + padding: 0 0 0 .5em; + vertical-align: top; } } - .meta { - padding-top: 5px; - } - .print { - color: #767676; - } - .activity { - color: #666; + &.key{ + .meta { + padding-top: 5px; + color: #666; + } } } .hook.list { diff --git a/public/less/_user.less b/public/less/_user.less index 51f8c20967..a3e6852994 100644 --- a/public/less/_user.less +++ b/public/less/_user.less @@ -4,23 +4,6 @@ padding-bottom: @footer-margin * 2; } - &.settings { - .list { - .item.ui.grid { - margin-top: 15px; - } - } - .email.list, .openid.list { - .item:not(:first-child) { - border-top: 1px solid #eaeaea; - height: 50px; - .button { - margin-top: -10px; - } - } - } - } - &.profile { .ui.card { .username { diff --git a/routers/user/auth_openid.go b/routers/user/auth_openid.go index c5575814f1..7d4df342e9 100644 --- a/routers/user/auth_openid.go +++ b/routers/user/auth_openid.go @@ -68,8 +68,8 @@ func allowedOpenIDURI(uri string) (err error) { // In case a Whitelist is present, URI must be in it // in order to be accepted - if len(setting.OpenIDWhitelist) != 0 { - for _, pat := range setting.OpenIDWhitelist { + if len(setting.Service.OpenIDWhitelist) != 0 { + for _, pat := range setting.Service.OpenIDWhitelist { if pat.MatchString(uri) { return nil // pass } @@ -79,7 +79,7 @@ func allowedOpenIDURI(uri string) (err error) { } // A blacklist match expliclty forbids - for _, pat := range setting.OpenIDBlacklist { + for _, pat := range setting.Service.OpenIDBlacklist { if pat.MatchString(uri) { return fmt.Errorf("URI forbidden by blacklist") } @@ -231,7 +231,7 @@ func signInOpenIDVerify(ctx *context.Context) { ctx.Session.Set("openid_determined_username", nickname) - if u != nil || !setting.EnableOpenIDSignUp { + if u != nil || !setting.Service.EnableOpenIDSignUp { ctx.Redirect(setting.AppSubURL + "/user/openid/connect") } else { ctx.Redirect(setting.AppSubURL + "/user/openid/register") @@ -248,7 +248,7 @@ func ConnectOpenID(ctx *context.Context) { ctx.Data["Title"] = "OpenID connect" ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsOpenIDConnect"] = true - ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp + ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp ctx.Data["OpenID"] = oid userName, _ := ctx.Session.Get("openid_determined_username").(string) if userName != "" { @@ -267,7 +267,7 @@ func ConnectOpenIDPost(ctx *context.Context, form auth.ConnectOpenIDForm) { ctx.Data["Title"] = "OpenID connect" ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsOpenIDConnect"] = true - ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp + ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp ctx.Data["OpenID"] = oid u, err := models.UserSignIn(form.UserName, form.Password) @@ -300,7 +300,7 @@ func ConnectOpenIDPost(ctx *context.Context, form auth.ConnectOpenIDForm) { // RegisterOpenID shows a form to create a new user authenticated via an OpenID URI func RegisterOpenID(ctx *context.Context) { - if !setting.EnableOpenIDSignUp { + if !setting.Service.EnableOpenIDSignUp { ctx.Error(403) return } @@ -312,7 +312,7 @@ func RegisterOpenID(ctx *context.Context) { ctx.Data["Title"] = "OpenID signup" ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsOpenIDRegister"] = true - ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp + ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha ctx.Data["OpenID"] = oid userName, _ := ctx.Session.Get("openid_determined_username").(string) @@ -328,7 +328,7 @@ func RegisterOpenID(ctx *context.Context) { // RegisterOpenIDPost handles submission of a form to create a new user authenticated via an OpenID URI func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.SignUpOpenIDForm) { - if !setting.EnableOpenIDSignUp { + if !setting.Service.EnableOpenIDSignUp { ctx.Error(403) return } @@ -341,7 +341,7 @@ func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.Si ctx.Data["Title"] = "OpenID signup" ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsOpenIDRegister"] = true - ctx.Data["EnableOpenIDSignUp"] = setting.EnableOpenIDSignUp + ctx.Data["EnableOpenIDSignUp"] = setting.Service.EnableOpenIDSignUp ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha ctx.Data["OpenID"] = oid diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 225c23b97b..7348ab7b9e 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -114,6 +114,10 @@ <dd><i class="fa fa{{if .Service.DisableRegistration}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.show_registration_button"}}</dt> <dd><i class="fa fa{{if .Service.ShowRegistrationButton}}-check{{end}}-square-o"></i></dd> + <dt>{{.i18n.Tr "admin.config.enable_openid_signup"}}</dt> + <dd><i class="fa fa{{if .Service.EnableOpenIDSignUp}}-check{{end}}-square-o"></i></dd> + <dt>{{.i18n.Tr "admin.config.enable_openid_signin"}}</dt> + <dd><i class="fa fa{{if .Service.EnableOpenIDSignIn}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.require_sign_in_view"}}</dt> <dd><i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></dd> <dt>{{.i18n.Tr "admin.config.mail_notify"}}</dt> diff --git a/templates/repo/graph.tmpl b/templates/repo/graph.tmpl index 56bb1d92ed..02ce3df280 100644 --- a/templates/repo/graph.tmpl +++ b/templates/repo/graph.tmpl @@ -26,7 +26,7 @@ <a href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.Rev}}">{{ .ShortRev}}</a> </code> <strong> {{.Branch}}</strong> - <em>{{.Subject}}</em> by + <em>{{RenderCommitMessage false .Subject $.RepoLink $.Repository.ComposeMetas}}</em> by <span class="author"> {{.Author}} </span> diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index cd9dea1dda..f082fde86b 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -14,27 +14,22 @@ {{if .Deploykeys}} <div class="ui key list"> {{range .Deploykeys}} - <div class="item ui grid"> - <div class="one wide column"> - <i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i> - </div> - <div class="one wide column"> - <i class="mega-octicon octicon-key left"></i> - </div> - <div class="eleven wide column"> - <strong>{{.Name}}</strong> - <div class="print meta"> - {{.Fingerprint}} + <div class="item"> + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <i class="mega-octicon octicon-key {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i> + <div class="content"> + <strong>{{.Name}}</strong> + <div class="print meta"> + {{.Fingerprint}} + </div> + <div class="activity meta"> + <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> + </div> </div> - <div class="activity meta"> - <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> - </div> - </div> - <div class="two wide column"> - <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> - {{$.i18n.Tr "settings.delete_key"}} - </button> - </div> </div> {{end}} </div> diff --git a/templates/user/settings/account_link.tmpl b/templates/user/settings/account_link.tmpl index 4b19bea75c..81ddf626e1 100644 --- a/templates/user/settings/account_link.tmpl +++ b/templates/user/settings/account_link.tmpl @@ -13,16 +13,16 @@ </div> {{if .AccountLinks}} {{range $loginSource, $provider := .AccountLinks}} - <div class="item ui grid"> - <div class="column"> - <strong>{{$provider}}</strong> - {{if $loginSource.IsActived}}<span class="text red">{{$.i18n.Tr "settings.active"}}</span>{{end}} - <div class="ui right"> + <div class="item"> + <div class="right floated content"> <button class="ui red tiny button delete-button" data-url="{{$.Link}}" data-id="{{$loginSource.ID}}"> {{$.i18n.Tr "settings.delete_key"}} </button> + </div> + <div class="content"> + <strong>{{$provider}}</strong> + {{if $loginSource.IsActived}}<span class="text red">{{$.i18n.Tr "settings.active"}}</span>{{end}} </div> - </div> </div> {{end}} {{end}} diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index d8ba6d65a7..d4d19dcedf 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -15,24 +15,19 @@ {{.i18n.Tr "settings.tokens_desc"}} </div> {{range .Tokens}} - <div class="item ui grid"> - <div class="one wide column"> - <i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i> - </div> - <div class="one wide column"> - <i class="fa fa-send fa-2x left"></i> - </div> - <div class="eleven wide column"> - <strong>{{.Name}}</strong> - <div class="activity meta"> - <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> + <div class="item"> + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{$.i18n.Tr "settings.delete_token"}} + </button> + </div> + <i class="big send icon {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i> + <div class="content"> + <strong>{{.Name}}</strong> + <div class="activity meta"> + <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> + </div> </div> - </div> - <div class="two wide column"> - <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> - {{$.i18n.Tr "settings.delete_token"}} - </button> - </div> </div> {{end}} </div> diff --git a/templates/user/settings/email.tmpl b/templates/user/settings/email.tmpl index f54a2fc833..88675f0e99 100644 --- a/templates/user/settings/email.tmpl +++ b/templates/user/settings/email.tmpl @@ -12,28 +12,28 @@ {{.i18n.Tr "settings.email_desc"}} </div> {{range .Emails}} - <div class="item ui grid"> - <div class="column"> - <strong>{{.Email}}</strong> - {{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}} + <div class="item"> {{if not .IsPrimary}} - <div class="ui right"> + <div class="right floated content"> <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> {{$.i18n.Tr "settings.delete_key"}} </button> - </div> - {{if .IsActivated}} - <div class="ui right"> - <form action="{{$.Link}}" method="post"> - {{$.CsrfTokenHtml}} - <input name="_method" type="hidden" value="PRIMARY"> - <input name="id" type="hidden" value="{{.ID}}"> - <button class="ui green tiny button">{{$.i18n.Tr "settings.primary_email"}}</button> - </form> - </div> - {{end}} + </div> + {{if .IsActivated}} + <div class="right floated content"> + <form action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="PRIMARY"> + <input name="id" type="hidden" value="{{.ID}}"> + <button class="ui green tiny button">{{$.i18n.Tr "settings.primary_email"}}</button> + </form> + </div> + {{end}} {{end}} - </div> + <div class="content"> + <strong>{{.Email}}</strong> + {{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}} + </div> </div> {{end}} </div> diff --git a/templates/user/settings/openid.tmpl b/templates/user/settings/openid.tmpl index 9da4be4274..1a73bf5545 100644 --- a/templates/user/settings/openid.tmpl +++ b/templates/user/settings/openid.tmpl @@ -12,15 +12,13 @@ {{.i18n.Tr "settings.openid_desc"}} </div> {{range .OpenIDs}} - <div class="item ui grid"> - <div class="column"> - <strong>{{.URI}}</strong> - <div class="ui right"> + <div class="item"> + <div class="right floated content"> <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> {{$.i18n.Tr "settings.delete_key"}} </button> - </div> - <div class="ui right"> + </div> + <div class="right floated content"> <form action="{{$.Link}}/toggle_visibility" method="post"> {{$.CsrfTokenHtml}} <input name="id" type="hidden" value="{{.ID}}"> @@ -38,7 +36,9 @@ </button> </form> </div> - </div> + <div class="content"> + <strong>{{.URI}}</strong> + </div> </div> {{end}} </div> diff --git a/templates/user/settings/sshkeys.tmpl b/templates/user/settings/sshkeys.tmpl index bb4a6c6a83..7942afde41 100644 --- a/templates/user/settings/sshkeys.tmpl +++ b/templates/user/settings/sshkeys.tmpl @@ -15,27 +15,22 @@ {{.i18n.Tr "settings.ssh_desc"}} </div> {{range .Keys}} - <div class="item ui grid"> - <div class="one wide column"> - <i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}></i> - </div> - <div class="one wide column"> - <i class="mega-octicon octicon-key left"></i> - </div> - <div class="eleven wide column"> - <strong>{{.Name}}</strong> - <div class="print meta"> - {{.Fingerprint}} + <div class="item"> + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{$.i18n.Tr "settings.delete_key"}} + </button> + </div> + <i class="mega-octicon octicon-key {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}></i> + <div class="content"> + <strong>{{.Name}}</strong> + <div class="print meta"> + {{.Fingerprint}} + </div> + <div class="activity meta"> + <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> + </div> </div> - <div class="activity meta"> - <i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> - </div> - </div> - <div class="two wide column"> - <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> - {{$.i18n.Tr "settings.delete_key"}} - </button> - </div> </div> {{end}} </div> |