mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 18:04:14 +01:00
Fix type in unused constant name (#111)
* Write LDAP, SMTP, PAM, DLDAP back to all uppercase * Fix type in unused constant name * Other MixCased fixes * Complete MixerCasing of template constants * Re uppercase LTS and LDAPS suffixes * Uppercase JSON suffix in constant names * Proper case LoginNoType * Prefix unexported template path constants with "tpl"
This commit is contained in:
parent
c8c748aea6
commit
864d1b1f9f
10 changed files with 99 additions and 99 deletions
|
@ -32,7 +32,7 @@ const (
|
|||
// Reference from a commit (not part of a pull request)
|
||||
CommentTypeCommitRef
|
||||
// Reference from a comment
|
||||
CommentTypeComment_REF
|
||||
CommentTypeCommentRef
|
||||
// Reference from a pull request
|
||||
CommentTypePullRef
|
||||
)
|
||||
|
|
|
@ -28,25 +28,25 @@ type LoginType int
|
|||
|
||||
// Note: new type must append to the end of list to maintain compatibility.
|
||||
const (
|
||||
LoginNotype LoginType = iota
|
||||
LoginNoType LoginType = iota
|
||||
LoginPlain // 1
|
||||
LoginLdap // 2
|
||||
LoginSmtp // 3
|
||||
LoginPam // 4
|
||||
LoginDldap // 5
|
||||
LoginLDAP // 2
|
||||
LoginSMTP // 3
|
||||
LoginPAM // 4
|
||||
LoginDLDAP // 5
|
||||
)
|
||||
|
||||
var LoginNames = map[LoginType]string{
|
||||
LoginLdap: "LDAP (via BindDN)",
|
||||
LoginDldap: "LDAP (simple auth)", // Via direct bind
|
||||
LoginSmtp: "SMTP",
|
||||
LoginPam: "PAM",
|
||||
LoginLDAP: "LDAP (via BindDN)",
|
||||
LoginDLDAP: "LDAP (simple auth)", // Via direct bind
|
||||
LoginSMTP: "SMTP",
|
||||
LoginPAM: "PAM",
|
||||
}
|
||||
|
||||
var SecurityProtocolNames = map[ldap.SecurityProtocol]string{
|
||||
ldap.SecurityProtocolUnencrypted: "Unencrypted",
|
||||
ldap.SecurityProtocolLdaps: "LDAPS",
|
||||
ldap.SecurityProtocolStartTls: "StartTLS",
|
||||
ldap.SecurityProtocolLDAPS: "LDAPS",
|
||||
ldap.SecurityProtocolStartTLS: "StartTLS",
|
||||
}
|
||||
|
||||
// Ensure structs implemented interface.
|
||||
|
@ -139,11 +139,11 @@ func (source *LoginSource) BeforeSet(colName string, val xorm.Cell) {
|
|||
switch colName {
|
||||
case "type":
|
||||
switch LoginType(Cell2Int64(val)) {
|
||||
case LoginLdap, LoginDldap:
|
||||
case LoginLDAP, LoginDLDAP:
|
||||
source.Cfg = new(LDAPConfig)
|
||||
case LoginSmtp:
|
||||
case LoginSMTP:
|
||||
source.Cfg = new(SMTPConfig)
|
||||
case LoginPam:
|
||||
case LoginPAM:
|
||||
source.Cfg = new(PAMConfig)
|
||||
default:
|
||||
panic("unrecognized login source type: " + com.ToStr(*val))
|
||||
|
@ -165,19 +165,19 @@ func (source *LoginSource) TypeName() string {
|
|||
}
|
||||
|
||||
func (source *LoginSource) IsLDAP() bool {
|
||||
return source.Type == LoginLdap
|
||||
return source.Type == LoginLDAP
|
||||
}
|
||||
|
||||
func (source *LoginSource) IsDLDAP() bool {
|
||||
return source.Type == LoginDldap
|
||||
return source.Type == LoginDLDAP
|
||||
}
|
||||
|
||||
func (source *LoginSource) IsSMTP() bool {
|
||||
return source.Type == LoginSmtp
|
||||
return source.Type == LoginSMTP
|
||||
}
|
||||
|
||||
func (source *LoginSource) IsPAM() bool {
|
||||
return source.Type == LoginPam
|
||||
return source.Type == LoginPAM
|
||||
}
|
||||
|
||||
func (source *LoginSource) HasTLS() bool {
|
||||
|
@ -188,9 +188,9 @@ func (source *LoginSource) HasTLS() bool {
|
|||
|
||||
func (source *LoginSource) UseTLS() bool {
|
||||
switch source.Type {
|
||||
case LoginLdap, LoginDldap:
|
||||
case LoginLDAP, LoginDLDAP:
|
||||
return source.LDAP().SecurityProtocol != ldap.SecurityProtocolUnencrypted
|
||||
case LoginSmtp:
|
||||
case LoginSMTP:
|
||||
return source.SMTP().TLS
|
||||
}
|
||||
|
||||
|
@ -199,9 +199,9 @@ func (source *LoginSource) UseTLS() bool {
|
|||
|
||||
func (source *LoginSource) SkipVerify() bool {
|
||||
switch source.Type {
|
||||
case LoginLdap, LoginDldap:
|
||||
case LoginLDAP, LoginDLDAP:
|
||||
return source.LDAP().SkipVerify
|
||||
case LoginSmtp:
|
||||
case LoginSMTP:
|
||||
return source.SMTP().SkipVerify
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ func composeFullName(firstname, surname, username string) string {
|
|||
// LoginViaLDAP queries if login/password is valid against the LDAP directory pool,
|
||||
// and create a local user if success when enabled.
|
||||
func LoginViaLDAP(user *User, login, passowrd string, source *LoginSource, autoRegister bool) (*User, error) {
|
||||
username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, passowrd, source.Type == LoginDldap)
|
||||
username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, passowrd, source.Type == LoginDLDAP)
|
||||
if !succeed {
|
||||
// User not in LDAP, do nothing
|
||||
return nil, ErrUserNotExist{0, login}
|
||||
|
@ -358,11 +358,11 @@ func (auth *smtpLoginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
|||
}
|
||||
|
||||
const (
|
||||
SmtpPlain = "PLAIN"
|
||||
SmtpLogin = "LOGIN"
|
||||
SMTPPlain = "PLAIN"
|
||||
SMTPLogin = "LOGIN"
|
||||
)
|
||||
|
||||
var SMTPAuths = []string{SmtpPlain, SmtpLogin}
|
||||
var SMTPAuths = []string{SMTPPlain, SMTPLogin}
|
||||
|
||||
func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error {
|
||||
c, err := smtp.Dial(fmt.Sprintf("%s:%d", cfg.Host, cfg.Port))
|
||||
|
@ -411,9 +411,9 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC
|
|||
}
|
||||
|
||||
var auth smtp.Auth
|
||||
if cfg.Auth == SmtpPlain {
|
||||
if cfg.Auth == SMTPPlain {
|
||||
auth = smtp.PlainAuth("", login, password, cfg.Host)
|
||||
} else if cfg.Auth == SmtpLogin {
|
||||
} else if cfg.Auth == SMTPLogin {
|
||||
auth = &smtpLoginAuth{login, password}
|
||||
} else {
|
||||
return nil, errors.New("Unsupported SMTP auth type")
|
||||
|
@ -445,7 +445,7 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC
|
|||
Name: strings.ToLower(username),
|
||||
Email: login,
|
||||
Passwd: password,
|
||||
LoginType: LoginSmtp,
|
||||
LoginType: LoginSMTP,
|
||||
LoginSource: sourceID,
|
||||
LoginName: login,
|
||||
IsActive: true,
|
||||
|
@ -479,7 +479,7 @@ func LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMCon
|
|||
Name: login,
|
||||
Email: login,
|
||||
Passwd: password,
|
||||
LoginType: LoginPam,
|
||||
LoginType: LoginPAM,
|
||||
LoginSource: sourceID,
|
||||
LoginName: login,
|
||||
IsActive: true,
|
||||
|
@ -493,11 +493,11 @@ func ExternalUserLogin(user *User, login, password string, source *LoginSource,
|
|||
}
|
||||
|
||||
switch source.Type {
|
||||
case LoginLdap, LoginDldap:
|
||||
case LoginLDAP, LoginDLDAP:
|
||||
return LoginViaLDAP(user, login, password, source, autoRegister)
|
||||
case LoginSmtp:
|
||||
case LoginSMTP:
|
||||
return LoginViaSMTP(user, login, password, source.ID, source.Cfg.(*SMTPConfig), autoRegister)
|
||||
case LoginPam:
|
||||
case LoginPAM:
|
||||
return LoginViaPAM(user, login, password, source.ID, source.Cfg.(*PAMConfig), autoRegister)
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ func UserSignIn(username, passowrd string) (*User, error) {
|
|||
|
||||
if hasUser {
|
||||
switch user.LoginType {
|
||||
case LoginNotype, LoginPlain:
|
||||
case LoginNoType, LoginPlain:
|
||||
if user.ValidatePassword(passowrd) {
|
||||
return user, nil
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
|
|||
type HookContentType int
|
||||
|
||||
const (
|
||||
ContentTypeJson HookContentType = iota + 1
|
||||
ContentTypeJSON HookContentType = iota + 1
|
||||
ContentTypeForm
|
||||
)
|
||||
|
||||
var hookContentTypes = map[string]HookContentType{
|
||||
"json": ContentTypeJson,
|
||||
"json": ContentTypeJSON,
|
||||
"form": ContentTypeForm,
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func ToHookContentType(name string) HookContentType {
|
|||
|
||||
func (t HookContentType) Name() string {
|
||||
switch t {
|
||||
case ContentTypeJson:
|
||||
case ContentTypeJSON:
|
||||
return "json"
|
||||
case ContentTypeForm:
|
||||
return "form"
|
||||
|
@ -511,7 +511,7 @@ func (t *HookTask) deliver() {
|
|||
SetTLSClientConfig(&tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify})
|
||||
|
||||
switch t.ContentType {
|
||||
case ContentTypeJson:
|
||||
case ContentTypeJSON:
|
||||
req = req.Header("Content-Type", "application/json").Body(t.PayloadContent)
|
||||
case ContentTypeForm:
|
||||
req.Param("payload", t.PayloadContent)
|
||||
|
|
|
@ -21,8 +21,8 @@ type SecurityProtocol int
|
|||
// Note: new type must be added at the end of list to maintain compatibility.
|
||||
const (
|
||||
SecurityProtocolUnencrypted SecurityProtocol = iota
|
||||
SecurityProtocolLdaps
|
||||
SecurityProtocolStartTls
|
||||
SecurityProtocolLDAPS
|
||||
SecurityProtocolStartTLS
|
||||
)
|
||||
|
||||
// Basic LDAP authentication service
|
||||
|
@ -118,7 +118,7 @@ func dial(ls *Source) (*ldap.Conn, error) {
|
|||
ServerName: ls.Host,
|
||||
InsecureSkipVerify: ls.SkipVerify,
|
||||
}
|
||||
if ls.SecurityProtocol == SecurityProtocolLdaps {
|
||||
if ls.SecurityProtocol == SecurityProtocolLDAPS {
|
||||
return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), tlsCfg)
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ func dial(ls *Source) (*ldap.Conn, error) {
|
|||
return nil, fmt.Errorf("Dial: %v", err)
|
||||
}
|
||||
|
||||
if ls.SecurityProtocol == SecurityProtocolStartTls {
|
||||
if ls.SecurityProtocol == SecurityProtocolStartTLS {
|
||||
if err = conn.StartTLS(tlsCfg); err != nil {
|
||||
conn.Close()
|
||||
return nil, fmt.Errorf("StartTLS: %v", err)
|
||||
|
|
|
@ -17,7 +17,7 @@ const (
|
|||
)
|
||||
|
||||
// smtpWriter implements LoggerInterface and is used to send emails via given SMTP-server.
|
||||
type SmtpWriter struct {
|
||||
type SMTPWriter struct {
|
||||
Username string `json:"Username"`
|
||||
Password string `json:"password"`
|
||||
Host string `json:"Host"`
|
||||
|
@ -27,8 +27,8 @@ type SmtpWriter struct {
|
|||
}
|
||||
|
||||
// create smtp writer.
|
||||
func NewSmtpWriter() LoggerInterface {
|
||||
return &SmtpWriter{Level: TRACE}
|
||||
func NewSMTPWriter() LoggerInterface {
|
||||
return &SMTPWriter{Level: TRACE}
|
||||
}
|
||||
|
||||
// init smtp writer with json config.
|
||||
|
@ -41,13 +41,13 @@ func NewSmtpWriter() LoggerInterface {
|
|||
// "sendTos":["email1","email2"],
|
||||
// "level":LevelError
|
||||
// }
|
||||
func (sw *SmtpWriter) Init(jsonconfig string) error {
|
||||
func (sw *SMTPWriter) Init(jsonconfig string) error {
|
||||
return json.Unmarshal([]byte(jsonconfig), sw)
|
||||
}
|
||||
|
||||
// write message in smtp writer.
|
||||
// it will send an email with subject and only this message.
|
||||
func (s *SmtpWriter) WriteMsg(msg string, skip, level int) error {
|
||||
func (s *SMTPWriter) WriteMsg(msg string, skip, level int) error {
|
||||
if level < s.Level {
|
||||
return nil
|
||||
}
|
||||
|
@ -76,12 +76,12 @@ func (s *SmtpWriter) WriteMsg(msg string, skip, level int) error {
|
|||
)
|
||||
}
|
||||
|
||||
func (_ *SmtpWriter) Flush() {
|
||||
func (_ *SMTPWriter) Flush() {
|
||||
}
|
||||
|
||||
func (_ *SmtpWriter) Destroy() {
|
||||
func (_ *SMTPWriter) Destroy() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register("smtp", NewSmtpWriter)
|
||||
Register("smtp", NewSMTPWriter)
|
||||
}
|
||||
|
|
2
public/css/semantic-2.2.1.min.css
vendored
2
public/css/semantic-2.2.1.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -48,15 +48,15 @@ type dropdownItem struct {
|
|||
|
||||
var (
|
||||
authSources = []dropdownItem{
|
||||
{models.LoginNames[models.LoginLdap], models.LoginLdap},
|
||||
{models.LoginNames[models.LoginDldap], models.LoginDldap},
|
||||
{models.LoginNames[models.LoginSmtp], models.LoginSmtp},
|
||||
{models.LoginNames[models.LoginPam], models.LoginPam},
|
||||
{models.LoginNames[models.LoginLDAP], models.LoginLDAP},
|
||||
{models.LoginNames[models.LoginDLDAP], models.LoginDLDAP},
|
||||
{models.LoginNames[models.LoginSMTP], models.LoginSMTP},
|
||||
{models.LoginNames[models.LoginPAM], models.LoginPAM},
|
||||
}
|
||||
securityProtocols = []dropdownItem{
|
||||
{models.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted], ldap.SecurityProtocolUnencrypted},
|
||||
{models.SecurityProtocolNames[ldap.SecurityProtocolLdaps], ldap.SecurityProtocolLdaps},
|
||||
{models.SecurityProtocolNames[ldap.SecurityProtocolStartTls], ldap.SecurityProtocolStartTls},
|
||||
{models.SecurityProtocolNames[ldap.SecurityProtocolLDAPS], ldap.SecurityProtocolLDAPS},
|
||||
{models.SecurityProtocolNames[ldap.SecurityProtocolStartTLS], ldap.SecurityProtocolStartTLS},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -65,8 +65,8 @@ func NewAuthSource(ctx *context.Context) {
|
|||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
|
||||
ctx.Data["type"] = models.LoginLdap
|
||||
ctx.Data["CurrentTypeName"] = models.LoginNames[models.LoginLdap]
|
||||
ctx.Data["type"] = models.LoginLDAP
|
||||
ctx.Data["CurrentTypeName"] = models.LoginNames[models.LoginLDAP]
|
||||
ctx.Data["CurrentSecurityProtocol"] = models.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted]
|
||||
ctx.Data["smtp_auth"] = "PLAIN"
|
||||
ctx.Data["is_active"] = true
|
||||
|
@ -125,13 +125,13 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
|||
hasTLS := false
|
||||
var config core.Conversion
|
||||
switch models.LoginType(form.Type) {
|
||||
case models.LoginLdap, models.LoginDldap:
|
||||
case models.LoginLDAP, models.LoginDLDAP:
|
||||
config = parseLDAPConfig(form)
|
||||
hasTLS = ldap.SecurityProtocol(form.SecurityProtocol) > ldap.SecurityProtocolUnencrypted
|
||||
case models.LoginSmtp:
|
||||
case models.LoginSMTP:
|
||||
config = parseSMTPConfig(form)
|
||||
hasTLS = true
|
||||
case models.LoginPam:
|
||||
case models.LoginPAM:
|
||||
config = &models.PAMConfig{
|
||||
ServiceName: form.PAMServiceName,
|
||||
}
|
||||
|
@ -208,11 +208,11 @@ func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
|||
|
||||
var config core.Conversion
|
||||
switch models.LoginType(form.Type) {
|
||||
case models.LoginLdap, models.LoginDldap:
|
||||
case models.LoginLDAP, models.LoginDLDAP:
|
||||
config = parseLDAPConfig(form)
|
||||
case models.LoginSmtp:
|
||||
case models.LoginSMTP:
|
||||
config = parseSMTPConfig(form)
|
||||
case models.LoginPam:
|
||||
case models.LoginPAM:
|
||||
config = &models.PAMConfig{
|
||||
ServiceName: form.PAMServiceName,
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
SETTINGS_OPTIONS base.TplName = "repo/settings/options"
|
||||
COLLABORATION base.TplName = "repo/settings/collaboration"
|
||||
GITHOOKS base.TplName = "repo/settings/githooks"
|
||||
GithookEdit base.TplName = "repo/settings/githook_edit"
|
||||
DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys"
|
||||
tplSettingsOptions base.TplName = "repo/settings/options"
|
||||
tplCollaboration base.TplName = "repo/settings/collaboration"
|
||||
tplGithooks base.TplName = "repo/settings/githooks"
|
||||
tplGithookEdit base.TplName = "repo/settings/githook_edit"
|
||||
tplDeployKeys base.TplName = "repo/settings/deploy_keys"
|
||||
)
|
||||
|
||||
func Settings(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsOptions"] = true
|
||||
ctx.HTML(200, SETTINGS_OPTIONS)
|
||||
ctx.HTML(200, tplSettingsOptions)
|
||||
}
|
||||
|
||||
func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
||||
|
@ -41,7 +41,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
switch ctx.Query("action") {
|
||||
case "update":
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, SETTINGS_OPTIONS)
|
||||
ctx.HTML(200, tplSettingsOptions)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
ctx.Data["Err_RepoName"] = true
|
||||
switch {
|
||||
case models.IsErrRepoAlreadyExist(err):
|
||||
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), SETTINGS_OPTIONS, &form)
|
||||
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tplSettingsOptions, &form)
|
||||
case models.IsErrNameReserved(err):
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), SETTINGS_OPTIONS, &form)
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), tplSettingsOptions, &form)
|
||||
case models.IsErrNamePatternNotAllowed(err):
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SETTINGS_OPTIONS, &form)
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tplSettingsOptions, &form)
|
||||
default:
|
||||
ctx.Handle(500, "ChangeRepositoryName", err)
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
return
|
||||
}
|
||||
if repo.Name != form.RepoName {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
return
|
||||
}
|
||||
if repo.Name != form.RepoName {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -217,13 +217,13 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
ctx.Handle(500, "IsUserExist", err)
|
||||
return
|
||||
} else if !isExist {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), tplSettingsOptions, nil)
|
||||
return
|
||||
}
|
||||
|
||||
if err = models.TransferOwnership(ctx.User, newOwner, repo); err != nil {
|
||||
if models.IsErrRepoAlreadyExist(err) {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), tplSettingsOptions, nil)
|
||||
} else {
|
||||
ctx.Handle(500, "TransferOwnership", err)
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
return
|
||||
}
|
||||
if repo.Name != form.RepoName {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
|||
return
|
||||
}
|
||||
if repo.Name != form.RepoName {
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
||||
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ func Collaboration(ctx *context.Context) {
|
|||
}
|
||||
ctx.Data["Collaborators"] = users
|
||||
|
||||
ctx.HTML(200, COLLABORATION)
|
||||
ctx.HTML(200, tplCollaboration)
|
||||
}
|
||||
|
||||
func CollaborationPost(ctx *context.Context) {
|
||||
|
@ -407,7 +407,7 @@ func GitHooks(ctx *context.Context) {
|
|||
}
|
||||
ctx.Data["Hooks"] = hooks
|
||||
|
||||
ctx.HTML(200, GITHOOKS)
|
||||
ctx.HTML(200, tplGithooks)
|
||||
}
|
||||
|
||||
func GitHooksEdit(ctx *context.Context) {
|
||||
|
@ -425,7 +425,7 @@ func GitHooksEdit(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
ctx.Data["Hook"] = hook
|
||||
ctx.HTML(200, GithookEdit)
|
||||
ctx.HTML(200, tplGithookEdit)
|
||||
}
|
||||
|
||||
func GitHooksEditPost(ctx *context.Context) {
|
||||
|
@ -458,7 +458,7 @@ func DeployKeys(ctx *context.Context) {
|
|||
}
|
||||
ctx.Data["Deploykeys"] = keys
|
||||
|
||||
ctx.HTML(200, DEPLOY_KEYS)
|
||||
ctx.HTML(200, tplDeployKeys)
|
||||
}
|
||||
|
||||
func DeployKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
||||
|
@ -473,7 +473,7 @@ func DeployKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
|||
ctx.Data["Deploykeys"] = keys
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, DEPLOY_KEYS)
|
||||
ctx.HTML(200, tplDeployKeys)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -496,10 +496,10 @@ func DeployKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
|
|||
switch {
|
||||
case models.IsErrKeyAlreadyExist(err):
|
||||
ctx.Data["Err_Content"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.key_been_used"), DEPLOY_KEYS, &form)
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.key_been_used"), tplDeployKeys, &form)
|
||||
case models.IsErrKeyNameAlreadyUsed(err):
|
||||
ctx.Data["Err_Title"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.key_name_used"), DEPLOY_KEYS, &form)
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.key_name_used"), tplDeployKeys, &form)
|
||||
default:
|
||||
ctx.Handle(500, "AddDeployKey", err)
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
HOOKS base.TplName = "repo/settings/hooks"
|
||||
HookNew base.TplName = "repo/settings/hook_new"
|
||||
ORG_HookNew base.TplName = "org/settings/hook_new"
|
||||
tplHooks base.TplName = "repo/settings/hooks"
|
||||
tplHookNew base.TplName = "repo/settings/hook_new"
|
||||
tplOrgHookNew base.TplName = "org/settings/hook_new"
|
||||
)
|
||||
|
||||
func Webhooks(ctx *context.Context) {
|
||||
|
@ -41,7 +41,7 @@ func Webhooks(ctx *context.Context) {
|
|||
}
|
||||
ctx.Data["Webhooks"] = ws
|
||||
|
||||
ctx.HTML(200, HOOKS)
|
||||
ctx.HTML(200, tplHooks)
|
||||
}
|
||||
|
||||
type OrgRepoCtx struct {
|
||||
|
@ -57,7 +57,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) {
|
|||
return &OrgRepoCtx{
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
Link: ctx.Repo.RepoLink,
|
||||
NewTemplate: HookNew,
|
||||
NewTemplate: tplHookNew,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) {
|
|||
return &OrgRepoCtx{
|
||||
OrgID: ctx.Org.Organization.ID,
|
||||
Link: ctx.Org.OrgLink,
|
||||
NewTemplate: ORG_HookNew,
|
||||
NewTemplate: tplOrgHookNew,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ func WebHooksNewPost(ctx *context.Context, form auth.NewWebhookForm) {
|
|||
return
|
||||
}
|
||||
|
||||
contentType := models.ContentTypeJson
|
||||
contentType := models.ContentTypeJSON
|
||||
if models.HookContentType(form.ContentType) == models.ContentTypeForm {
|
||||
contentType = models.ContentTypeForm
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ func SlackHooksNewPost(ctx *context.Context, form auth.NewSlackHookForm) {
|
|||
w := &models.Webhook{
|
||||
RepoID: orCtx.RepoID,
|
||||
URL: form.PayloadURL,
|
||||
ContentType: models.ContentTypeJson,
|
||||
ContentType: models.ContentTypeJSON,
|
||||
HookEvent: ParseHookEvent(form.WebhookForm),
|
||||
IsActive: form.Active,
|
||||
HookTaskType: models.SLACK,
|
||||
|
@ -281,7 +281,7 @@ func WebHooksEditPost(ctx *context.Context, form auth.NewWebhookForm) {
|
|||
return
|
||||
}
|
||||
|
||||
contentType := models.ContentTypeJson
|
||||
contentType := models.ContentTypeJSON
|
||||
if models.HookContentType(form.ContentType) == models.ContentTypeForm {
|
||||
contentType = models.ContentTypeForm
|
||||
}
|
||||
|
|
2
vendor/gopkg.in/ldap.v2/ldap.go
generated
vendored
2
vendor/gopkg.in/ldap.v2/ldap.go
generated
vendored
|
@ -60,7 +60,7 @@ var ApplicationMap = map[uint8]string{
|
|||
ApplicationExtendedResponse: "Extended Response",
|
||||
}
|
||||
|
||||
// Ldap Behera Password Policy Draft 10 (https://tools.ietf.org/html/draft-behera-ldap-password-policy-10)
|
||||
// LDAP Behera Password Policy Draft 10 (https://tools.ietf.org/html/draft-behera-ldap-password-policy-10)
|
||||
const (
|
||||
BeheraPasswordExpired = 0
|
||||
BeheraAccountLocked = 1
|
||||
|
|
Loading…
Reference in a new issue