aboutsummaryrefslogtreecommitdiff
path: root/routers/admin
diff options
context:
space:
mode:
Diffstat (limited to 'routers/admin')
-rw-r--r--routers/admin/admin.go3
-rw-r--r--routers/admin/auths.go18
-rw-r--r--routers/admin/user.go5
3 files changed, 15 insertions, 11 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go
index 6f8868a6..56eba88a 100644
--- a/routers/admin/admin.go
+++ b/routers/admin/admin.go
@@ -193,6 +193,9 @@ func Config(ctx *middleware.Context) {
ctx.Data["DbCfg"] = models.DbCfg
+ ctx.Data["WebhookTaskInterval"] = setting.WebhookTaskInterval
+ ctx.Data["WebhookDeliverTimeout"] = setting.WebhookDeliverTimeout
+
ctx.Data["MailerEnabled"] = false
if setting.MailService != nil {
ctx.Data["MailerEnabled"] = true
diff --git a/routers/admin/auths.go b/routers/admin/auths.go
index c4702afc..e0b99714 100644
--- a/routers/admin/auths.go
+++ b/routers/admin/auths.go
@@ -38,8 +38,8 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
var u core.Conversion
- switch form.Type {
- case models.LT_LDAP:
+ switch models.LoginType(form.Type) {
+ case models.LDAP:
u = &models.LDAPConfig{
Ldapsource: ldap.Ldapsource{
Host: form.Host,
@@ -53,7 +53,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
Name: form.AuthName,
},
}
- case models.LT_SMTP:
+ case models.SMTP:
u = &models.SMTPConfig{
Auth: form.SmtpAuth,
Host: form.SmtpHost,
@@ -66,14 +66,14 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
var source = &models.LoginSource{
- Type: form.Type,
+ Type: models.LoginType(form.Type),
Name: form.AuthName,
IsActived: true,
AllowAutoRegister: form.AllowAutoRegister,
Cfg: u,
}
- if err := models.AddSource(source); err != nil {
+ if err := models.CreateSource(source); err != nil {
ctx.Handle(500, "admin.auths.NewAuth", err)
return
}
@@ -116,8 +116,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
var config core.Conversion
- switch form.Type {
- case models.LT_LDAP:
+ switch models.LoginType(form.Type) {
+ case models.LDAP:
config = &models.LDAPConfig{
Ldapsource: ldap.Ldapsource{
Host: form.Host,
@@ -131,7 +131,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
Name: form.AuthName,
},
}
- case models.LT_SMTP:
+ case models.SMTP:
config = &models.SMTPConfig{
Auth: form.SmtpAuth,
Host: form.SmtpHost,
@@ -147,7 +147,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
Id: form.Id,
Name: form.AuthName,
IsActived: form.IsActived,
- Type: form.Type,
+ Type: models.LoginType(form.Type),
AllowAutoRegister: form.AllowAutoRegister,
Cfg: config,
}
diff --git a/routers/admin/user.go b/routers/admin/user.go
index fa98bd32..596fe7b1 100644
--- a/routers/admin/user.go
+++ b/routers/admin/user.go
@@ -51,12 +51,13 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
Email: form.Email,
Passwd: form.Password,
IsActive: true,
- LoginType: models.LT_PLAIN,
+ LoginType: models.PLAIN,
}
if len(form.LoginType) > 0 {
fields := strings.Split(form.LoginType, "-")
- u.LoginType, _ = strconv.Atoi(fields[0])
+ tp, _ := strconv.Atoi(fields[0])
+ u.LoginType = models.LoginType(tp)
u.LoginSource, _ = strconv.ParseInt(fields[1], 10, 64)
u.LoginName = form.LoginName
fmt.Println(u.LoginType, u.LoginSource, u.LoginName)