aboutsummaryrefslogtreecommitdiff
path: root/models/login_source.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/login_source.go')
-rw-r--r--models/login_source.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/models/login_source.go b/models/login_source.go
index 3a1162ec..88ad42dc 100644
--- a/models/login_source.go
+++ b/models/login_source.go
@@ -6,7 +6,6 @@ package models
import (
"crypto/tls"
- "encoding/json"
"fmt"
"net/smtp"
"net/textproto"
@@ -20,13 +19,14 @@ import (
"github.com/go-macaron/binding"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
+ "github.com/json-iterator/go"
log "gopkg.in/clog.v1"
"gopkg.in/ini.v1"
- "github.com/gogits/gogs/models/errors"
- "github.com/gogits/gogs/pkg/auth/ldap"
- "github.com/gogits/gogs/pkg/auth/pam"
- "github.com/gogits/gogs/pkg/setting"
+ "github.com/gogs/gogs/models/errors"
+ "github.com/gogs/gogs/pkg/auth/ldap"
+ "github.com/gogs/gogs/pkg/auth/pam"
+ "github.com/gogs/gogs/pkg/setting"
)
type LoginType int
@@ -66,11 +66,11 @@ type LDAPConfig struct {
}
func (cfg *LDAPConfig) FromDB(bs []byte) error {
- return json.Unmarshal(bs, &cfg)
+ return jsoniter.Unmarshal(bs, &cfg)
}
func (cfg *LDAPConfig) ToDB() ([]byte, error) {
- return json.Marshal(cfg)
+ return jsoniter.Marshal(cfg)
}
func (cfg *LDAPConfig) SecurityProtocolName() string {
@@ -87,11 +87,11 @@ type SMTPConfig struct {
}
func (cfg *SMTPConfig) FromDB(bs []byte) error {
- return json.Unmarshal(bs, cfg)
+ return jsoniter.Unmarshal(bs, cfg)
}
func (cfg *SMTPConfig) ToDB() ([]byte, error) {
- return json.Marshal(cfg)
+ return jsoniter.Marshal(cfg)
}
type PAMConfig struct {
@@ -99,11 +99,11 @@ type PAMConfig struct {
}
func (cfg *PAMConfig) FromDB(bs []byte) error {
- return json.Unmarshal(bs, &cfg)
+ return jsoniter.Unmarshal(bs, &cfg)
}
func (cfg *PAMConfig) ToDB() ([]byte, error) {
- return json.Marshal(cfg)
+ return jsoniter.Marshal(cfg)
}
// AuthSourceFile contains information of an authentication source file.
@@ -135,12 +135,12 @@ type LoginSource struct {
IsActived bool `xorm:"NOT NULL DEFAULT false"`
Cfg core.Conversion `xorm:"TEXT"`
- Created time.Time `xorm:"-"`
+ Created time.Time `xorm:"-" json:"-"`
CreatedUnix int64
- Updated time.Time `xorm:"-"`
+ Updated time.Time `xorm:"-" json:"-"`
UpdatedUnix int64
- LocalFile *AuthSourceFile `xorm:"-"`
+ LocalFile *AuthSourceFile `xorm:"-" json:"-"`
}
func (s *LoginSource) BeforeInsert() {