aboutsummaryrefslogtreecommitdiff
path: root/modules/auth
diff options
context:
space:
mode:
Diffstat (limited to 'modules/auth')
-rw-r--r--modules/auth/ldap/ldap.go12
-rw-r--r--modules/auth/repo_form.go32
-rw-r--r--modules/auth/user_form.go21
3 files changed, 40 insertions, 25 deletions
diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go
index e27e5133..79b59519 100644
--- a/modules/auth/ldap/ldap.go
+++ b/modules/auth/ldap/ldap.go
@@ -9,8 +9,8 @@ package ldap
import (
"fmt"
+ "github.com/gogits/gogs/modules/ldap"
"github.com/gogits/gogs/modules/log"
- goldap "github.com/juju2013/goldap"
)
// Basic LDAP authentication service
@@ -68,9 +68,9 @@ func (ls Ldapsource) SearchEntry(name, passwd string) (string, bool) {
return "", false
}
- search := goldap.NewSearchRequest(
+ search := ldap.NewSearchRequest(
ls.BaseDN,
- goldap.ScopeWholeSubtree, goldap.NeverDerefAliases, 0, 0, false,
+ ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf(ls.Filter, name),
[]string{ls.Attributes},
nil)
@@ -87,10 +87,10 @@ func (ls Ldapsource) SearchEntry(name, passwd string) (string, bool) {
return "", true
}
-func ldapDial(ls Ldapsource) (*goldap.Conn, error) {
+func ldapDial(ls Ldapsource) (*ldap.Conn, error) {
if ls.UseSSL {
- return goldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), nil)
+ return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), nil)
} else {
- return goldap.Dial("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port))
+ return ldap.Dial("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port))
}
}
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 3eb0cbc5..233f7b10 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -20,7 +20,7 @@ import (
type CreateRepoForm struct {
Uid int64 `form:"uid" binding:"Required"`
- RepoName string `form:"repo_name" binding:"Required;AlphaDash;MaxSize(100)"`
+ RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
Private bool `form:"private"`
Description string `form:"desc" binding:"MaxSize(255)"`
Gitignore string `form:"gitignore"`
@@ -33,11 +33,11 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l
}
type MigrateRepoForm struct {
- HttpsUrl string `form:"url" binding:"Url"`
+ HttpsUrl string `form:"url" binding:"Required;Url"`
AuthUserName string `form:"auth_username"`
AuthPasswd string `form:"auth_password"`
Uid int64 `form:"uid" binding:"Required"`
- RepoName string `form:"repo_name" binding:"Required;AlphaDash;MaxSize(100)"`
+ RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
Mirror bool `form:"mirror"`
Private bool `form:"private"`
Description string `form:"desc" binding:"MaxSize(255)"`
@@ -48,7 +48,7 @@ func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l
}
type RepoSettingForm struct {
- RepoName string `form:"repo_name" binding:"Required;AlphaDash;MaxSize(100)"`
+ RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `form:"desc" binding:"MaxSize(255)"`
Website string `form:"site" binding:"Url;MaxSize(100)"`
Branch string `form:"branch"`
@@ -69,17 +69,31 @@ func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l
// \/ \/ \/ \/ \/ \/
type NewWebhookForm struct {
- PayloadUrl string `form:"payload_url" binding:"Required;Url"`
- ContentType string `form:"content_type" binding:"Required"`
- Secret string `form:"secret"`
- PushOnly bool `form:"push_only"`
- Active bool `form:"active"`
+ HookTaskType string `form:"hook_type" binding:"Required"`
+ PayloadUrl string `form:"payload_url" binding:"Required;Url"`
+ ContentType string `form:"content_type" binding:"Required"`
+ Secret string `form:"secret"`
+ PushOnly bool `form:"push_only"`
+ Active bool `form:"active"`
}
func (f *NewWebhookForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
validate(errs, ctx.Data, f, l)
}
+type NewSlackHookForm struct {
+ HookTaskType string `form:"hook_type" binding:"Required"`
+ Domain string `form:"domain" binding:"Required`
+ Token string `form:"token" binding:"Required"`
+ Channel string `form:"channel" binding:"Required"`
+ PushOnly bool `form:"push_only"`
+ Active bool `form:"active"`
+}
+
+func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
+ validate(errs, ctx.Data, f, l)
+}
+
// .___
// | | ______ ________ __ ____
// | |/ ___// ___/ | \_/ __ \
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go
index 51a07b91..93bd01a9 100644
--- a/modules/auth/user_form.go
+++ b/modules/auth/user_form.go
@@ -13,24 +13,25 @@ import (
type InstallForm struct {
Database string `form:"database" binding:"Required"`
- Host string `form:"host"`
- User string `form:"user"`
- Passwd string `form:"passwd"`
+ DbHost string `form:"host"`
+ DbUser string `form:"user"`
+ DbPasswd string `form:"passwd"`
DatabaseName string `form:"database_name"`
SslMode string `form:"ssl_mode"`
DatabasePath string `form:"database_path"`
- RepoRootPath string `form:"repo_path"`
- RunUser string `form:"run_user"`
- Domain string `form:"domain"`
- AppUrl string `form:"app_url"`
- AdminName string `form:"admin_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
- AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(255)"`
- AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
+ RepoRootPath string `form:"repo_path" binding:"Required"`
+ RunUser string `form:"run_user" binding:"Required"`
+ Domain string `form:"domain" binding:"Required"`
+ AppUrl string `form:"app_url" binding:"Required"`
SmtpHost string `form:"smtp_host"`
SmtpEmail string `form:"mailer_user"`
SmtpPasswd string `form:"mailer_pwd"`
RegisterConfirm string `form:"register_confirm"`
MailNotify string `form:"mail_notify"`
+ AdminName string `form:"admin_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
+ AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(255)"`
+ ConfirmPasswd string `form:"confirm_passwd" binding:"Required;MinSize(6);MaxSize(255)"`
+ AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
}
func (f *InstallForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {