#3515 use alert instead 500 for duplicated login source name

This commit is contained in:
Unknwon committed 2016-08-31 00:56:10 -07:00
1 parent cd9b926af7
commit 99c2ae7b35
7 files changed
+47 -23

No files matched your search

+1
View File
@@ -1028,6 +1028,7 @@ auths.delete_auth_title = Authentication Deletion
auths.delete_auth_desc = This authentication is going to be deleted, do you want to continue?
auths.still_in_used = This authentication is still used by some users, please delete or convert these users to another login type first.
auths.deletion_success = Authentication has been deleted successfully!
auths.login_source_exist = Login source '%s' already exists.
config.server_config = Server Configuration
config.app_name = Application Name
+24 -11
View File
@@ -602,24 +602,37 @@ func (err ErrAttachmentNotExist) Error() string {
return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
}
// _____ __ .__ __ .__ __ .__
// / _ \ __ ___/ |_| |__ ____ _____/ |_|__| ____ _____ _/ |_|__| ____ ____
// / /_\ \| | \ __\ | \_/ __ \ / \ __\ |/ ___\\__ \\ __\ |/ _ \ / \
// / | \ | /| | | Y \ ___/| | \ | | \ \___ / __ \| | | ( <_> ) | \
// \____|__ /____/ |__| |___| /\___ >___| /__| |__|\___ >____ /__| |__|\____/|___| /
// \/ \/ \/ \/ \/ \/ \/
// .____ .__ _________
// | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
// | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
// | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
// |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
// \/ /_____/ \/ \/ \/ \/
type ErrAuthenticationNotExist struct {
type ErrLoginSourceNotExist struct {
ID int64
}
func IsErrAuthenticationNotExist(err error) bool {
_, ok := err.(ErrAuthenticationNotExist)
func IsErrLoginSourceNotExist(err error) bool {
_, ok := err.(ErrLoginSourceNotExist)
return ok
}
func (err ErrAuthenticationNotExist) Error() string {
return fmt.Sprintf("authentication does not exist [id: %d]", err.ID)
func (err ErrLoginSourceNotExist) Error() string {
return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
}
type ErrLoginSourceAlreadyExist struct {
Name string
}
func IsErrLoginSourceAlreadyExist(err error) bool {
_, ok := err.(ErrLoginSourceAlreadyExist)
return ok
}
func (err ErrLoginSourceAlreadyExist) Error() string {
return fmt.Sprintf("login source already exists [name: %s]", err.Name)
}
// ___________
+12 -6
View File
@@ -25,8 +25,7 @@ import (
)
var (
ErrAuthenticationAlreadyExist = errors.New("Authentication already exist")
ErrAuthenticationUserUsed = errors.New("Authentication has been used by some users")
ErrAuthenticationUserUsed = errors.New("Authentication has been used by some users")
)
type LoginType int
@@ -230,8 +229,15 @@ func CountLoginSources() int64 {
return count
}
func CreateSource(source *LoginSource) error {
_, err := x.Insert(source)
func CreateLoginSource(source *LoginSource) error {
has, err := x.Get(&LoginSource{Name: source.Name})
if err != nil {
return err
} else if has {
return ErrLoginSourceAlreadyExist{source.Name}
}
_, err = x.Insert(source)
return err
}
@@ -247,7 +253,7 @@ func GetLoginSourceByID(id int64) (*LoginSource, error) {
if err != nil {
return nil, err
} else if !has {
return nil, ErrAuthenticationNotExist{id}
return nil, ErrLoginSourceNotExist{id}
}
return source, nil
}
@@ -542,7 +548,7 @@ func UserSignIn(uname, passwd string) (*User, error) {
if err != nil {
return nil, err
} else if !hasSource {
return nil, ErrLoginSourceNotExist
return nil, ErrLoginSourceNotExist{u.LoginSource}
}
return ExternalUserLogin(u, u.LoginName, passwd, &source, false)
-1
View File
@@ -46,7 +46,6 @@ var (
ErrEmailNotExist = errors.New("E-mail does not exist")
ErrEmailNotActivated = errors.New("E-mail address has not been activated")
ErrUserNameIllegal = errors.New("User name contains illegal characters")
ErrLoginSourceNotExist = errors.New("Login source does not exist")
ErrLoginSourceNotActived = errors.New("Login source is not actived")
ErrUnsupportedLoginType = errors.New("Login source is unknown")
)
+2 -2
View File
@@ -4367,7 +4367,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
return a, nil
}
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xac\xbd\xeb\x72\xdb\x48\xb2\x27\xfe\x1d\x4f\x81\xf6\x84\xc3\x76\x84\x4c\x47\xcf\x9c\xff\x25\x3a\xfa\xb2\x6a\xb9\xdd\xf6\x39\x96\xad\x63\xa9\x67\x76\xb6\xc3\xc1\x06\x49\x88\xc4\x31\x09\x70\x00\xd0\xb2\x66\x62\x22\xf6\x01\xf6\x01\x76\x5f\xef\x3c\xc9\x66\xfe\x32\xb3\x2a\x0b\x00\x25\x7b\xe6\xf8\x83\x45\x54\x65\xdd\xb3\xb2\xf2\x56\x59\xc5\x7e\x3f\x5f\x95\xdd\x32\xff\x2e\x3f\xcd\xf7\x45\x55\x6f\xcb\xae\xcb\xbb\x72\x7b\xfd\x74\xd3\x74\x7d\xb9\xca\x7f\xae\x7a\xfa\x6e\x3f\x56\xcb\x32\xcb\x36\xcd\xae\x24\xd0\x97\xf4\x27\x5b\x15\xdd\x66\xd1\x14\xed\x8a\x12\x9e\xdb\xef\xac\xfc\xb4\xdf\x36\x2d\x03\xfd\x24\xbf\xb2\x4d\xb9\xdd\x73\x19\xfa\x93\x75\xd5\xba\x9e\x57\x35\x7d\x5e\xd2\xaf\xfc\x55\x2d\x29\xcd\xa1\xb7\xa4\xb7\x87\x5e\xd2\x0e\x7b\x4b\xfa\x65\x9f\xb5\xe5\xba\xa2\xde\xb4\x94\xf4\x4e\x7f\x66\x37\xe5\xa2\xab\x7a\x6e\xe9\x4f\xf2\x2b\xfb\x58\xb6\x5d\xd5\x70\xed\x7f\x94\x5f\xd9\xbe\x58\x33\xc0\x05\xfd\xc9\xfa\x72\xb7\xdf\x16\x28\x70\xa5\x3f\xb3\x6d\x51\xaf\x0f\x02\xf3\x5a\x7f\x66\xcb\xb6\xa4\xac\x79\x5d\xde\x50\xea\x19\x3e\x66\xb3\x59\x76\xa0\x49\x98\xef\xdb\xe6\xba\xda\x96\xf3\xa2\x5e\xcd\x77\x32\xcc\x5f\x28\x3d\xd7\xf4\x9c\xd2\x73\x4e\xc7\x10\xca\x15\x0d\x75\x5e\x74\x3a\x0e\x9a\x4b\x1a\x79\xd1\x65\xa8\xaa\x2e\x76\x56\x9a\x7f\x66\xe5\xae\xa8\xb6\x3c\x6b\xfc\x97\xfa\xdd\x75\x37\x0d\xa6\xf6\x42\x7f\xd2\x1c\xcc\xfb\xdb\x7d\x89\x29\x78\x7a\x45\xbf\xb2\x65\xb1\xef\x97\x9b\x82\xbb\x29\xbf\x32\x02\xda\x37\x34\x17\x4d\x7b\x0b\x38\xfb\xc8\x9a\x76\x5d\xd4\xd5\x5f\x8b\x5e\xe6\xe7\xad\xfb\xcc\x76\x55\xdb\x36\x3c\xb5\xe7\xf8\x91\xd1\xc8\xe7\x5c\x0f\xa5\xbc\xa1\x49\x70\xb5\x70\xce\xae\x5a\xb7\x32\x8b\x9c\x79\x8e\x2f\xae\x45\xf2\xb4\x26\xc9\x0a\xb5\x5d\x37\xed\x07\x4d\x7d\xc1\x3f\x07\x55\x52\xe7\x34\x37\xed\x57\x51\xd3\x7a\x68\xee\x39\x3e\x12\x80\x2e\x2b\x56\x3b\x9a\xe1\x7d\x51\x97\x3c\x75\xa7\xfc\x45\xf3\x45\x5f\x59\xb1\x5c\x36\x87\xba\x9f\x77\x65\xdf\x57\xf5\x9a\xd7\xe0\x54\x92\xf2\x4b\x4d\xca\x5c\x5e\x48\xbb\x6d\x0e\x61\x95\x29\xfd\xcf\xf4\x99\x5f\xc8\xa7\xe4\xb9\x42\xc8\x0c\x25\xa9\xc9\xbe\xfa\x58\xf5\x55\x29\x8d\xd9\x47\xb6\x3f\x6c\xb7\x34\x9f\x7f\x39\x94\x5d\xcf\x59\x17\xf4\x4d\x33\x20\xdf\x59\xd5\x75\x07\x94\x78\x85\x1f\x19\x2d\x6a\xbd\xc4\x70\xce\xf0\x23\xcb\x7e\xad\xea\xae\x2f\xb6\xdb\xf7\x99\xfe\x60\x60\xf9\x25\xf3\xd4\x57\x3d\x3a\xab\x89\xf9\x65\x5f\xee\x3b\x9e\xe8\xfc\x45\xd5\x76\xfd\xd3\xbe\x22\x54\x7b\x77\xa8\xb3\x55\xb3\xfc\x40\x48\xcc\x1b\x12\x5b\xe9\xd5\x75\x4e\x63\x7a\x44\x68\xdc\x1e\xea\x9a\x46\x91\xff\xdc\xd0\xc8\xa8\x99\x6a\x55\xe6\xcf\x01\x7d\x92\xef\xb7\x65\xd1\x11\x48\x59\xac\xf2\x6f\x8b\xbc\x2f\xda\x75\xd9\x7f\xf7\x60\xbe\xa0\xcd\xf3\xe1\x41\xbe\x69\xcb\xeb\xef\x1e\x3c\xec\x1e\x7c\xff\xf3\x81\x8a\x6d\xab\xba\xec\xbe\x7d\x56\x7c\x9f\x2f\x0b\xca\xa1\xb1\xde\xe6\x8b\xf2\x9a\xf7\x0a\xb5\x95\x13\x92\xd6\x6b\xde\x27\xb7\xfd\x86\x1b\xa4\x05\xa3\x1f\x5d\xce\x1b\xf5\xab\x8c\x67\x89\x36\xf2\x7c\xb5\x30\xa2\x84\x0e\x21\xb9\xa5\x59\x3a\xbf\xbd\xfc\xf7\xd7\x27\xf9\x05\x51\xa6\x75\x5b\xe2\x37\xfd\x47\x25\xfe\x90\xd3\x68\xaf\xaa\xe7\x3f\xce\x32\x2a\x6b\x13\xf2\xbc\xe8\x8b\x05\xf7\x3d\x2c\x12\x67\xca\x1e\x0a\x79\xd8\x49\x4c\xeb\x40\xd7\xba\x1e\xbb\x53\x77\xe6\xe4\x3e\xa4\x3a\x74\xf3\x86\x3a\xde\xf0\x0e\xa6\xf4\x30\xb3\x17\x32\x67\x54\x55\xfe\xea\xcd\x9b\xb7\xcf\x7f\xcc\xcb\x7a\x4d\x33\x93\xdf\x54\xfd\x26\x3f\xf4\xd7\xff\xff\x7c\x5d\xd6\x65\x5b\x6c\xe7\xcb\x8a\x27\xa5\x25\xbc\xca\x69\x96\x64\x88\xb3\xac\xeb\xb6\x44\x60\x56\xdc\xca\xe5\xe5\xeb\xfc\x9c\x7e\x52\x67\xa8\x2c\x77\xa4\xdf\x64\xdd\x5f\xb6\x3c\x51\xa1\xc1\xab\x4d\x99\x03\x67\x01\xd4\x5c\x0f\xe7\x25\x5f\x69\x5f\x67\xf9\xb7\x8b\xf6\x7b\xd7\xbf\x62\xd1\x35\xdb\x43\xaf\x25\x6f\x36\x65\x8d\x85\x22\x54\x6a\x7b\xa2\x56\x46\xfb\x67\x59\xd9\xb6\x73\xa2\x9b\xfd\x2d\x2f\x8f\xf6\xe5\x58\x2b\x52\x19\xa1\x72\xdd\xf4\xb4\xfc\x39\xca\x49\x15\x55\xfd\xb1\xd8\x56\x2b\x5a\xa4\x38\x91\x69\x59\x24\xae\x1a\x5a\x6f\x2e\x4d\x18\xdd\xdc\x60\x8a\x68\x83\x11\x59\xcf\x1f\xcc\x1e\x80\xce\x3e\x78\xfa\x60\x96\xd5\xcd\x5c\x88\x00\x53\xe4\x55\xd5\x15\x0b\xa2\xce\x72\x5a\xb4\x46\xec\xfe\xcc\x78\x27\x5d\x51\x88\x3c\x81\xe0\x35\xe1\x13\x08\x84\x9f\x91\xb2\x20\x32\x0d\x5a\xa2\x54\xc4\x8f\xdd\x48\x4e\xc0\x0b\xa1\x3a\x21\x61\x34\xe6\xcc\x16\xda\xb0\xf2\x74\xbf\xdf\x56\x4b\x69\xfa\x67\xc9\x8b\x08\xca\xe7\xb1\x4e\x8a\x87\x03\x82\x59\x9e\x43\x33\xea\x35\x53\xa5\x3c\x21\xef\x28\xbf\x29\x69\xc7\x6d\x0e\x6b\x39\x93\xb6\xcd\x61\xf5\x15\x0e\x07\x5b\xb9\x48\x82\xf3\x77\x0d\x75\x18\x58\x15\x00\x62\x13\xa7\x44\x50\x98\x05\x68\xcb\x5d\xd3\xf3\xc4\x69\x31\x26\x73\x37\x15\x65\xd2\x48\xbb\xe2\x23\x1d\x6e\x7d\x23\x5b\x79\x45\x5b\x75\xc9\x15\xcf\x32\x22\x2b\x73\xdd\x4e\x44\x7f\x64\x4b\x59\x5a\x8a\xbb\x80\xda\x1d\x68\x17\x6e\xa8\x32\x9e\x78\xe6\x43\xa8\xca\xa9\x7e\x62\x48\x54\x0f\xa8\x03\xed\xf8\x86\xce\x4c\x5e\xe8\xe7\xf8\xa1\xdf\xbe\x7e\xea\x55\x71\x7d\x4d\xbd\xea\x68\x37\xbd\xcc\x97\xdb\x86\xb6\xe2\x2f\xef\x5e\x77\xbc\xd1\x36\xf3\x7d\xd3\x82\xff\xa0\xac\x0b\xfa\x19\xd2\xdc\x44\x33\x44\x7d\xd8\x2d\xe8\xeb\x66\x53\x2d\x37\x32\xed\x5c\x82\xf7\x0Line truncated
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xac\xbd\xeb\x72\xdb\x48\xb2\x27\xfe\x1d\x4f\x81\xf6\x84\xc3\x76\x84\x4c\x47\xcf\x9c\xff\x25\x3a\xfa\xb2\x6a\xb9\xdd\xf6\x39\x96\xad\x63\xa9\x67\x76\xb6\xc3\xc1\x06\x49\x88\xc4\x31\x09\x70\x00\xd0\xb2\x66\x62\x22\xf6\x01\xf6\x01\x76\x5f\xef\x3c\xc9\x66\xfe\x32\xb3\x2a\x0b\x00\x25\x7b\xe6\xf8\x83\x45\x54\x65\xdd\xb3\xb2\xf2\x56\x59\xc5\x7e\x3f\x5f\x95\xdd\x32\xff\x2e\x3f\xcd\xf7\x45\x55\x6f\xcb\xae\xcb\xbb\x72\x7b\xfd\x74\xd3\x74\x7d\xb9\xca\x7f\xae\x7a\xfa\x6e\x3f\x56\xcb\x32\xcb\x36\xcd\xae\x24\xd0\x97\xf4\x27\x5b\x15\xdd\x66\xd1\x14\xed\x8a\x12\x9e\xdb\xef\xac\xfc\xb4\xdf\x36\x2d\x03\xfd\x24\xbf\xb2\x4d\xb9\xdd\x73\x19\xfa\x93\x75\xd5\xba\x9e\x57\x35\x7d\x5e\xd2\xaf\xfc\x55\x2d\x29\xcd\xa1\xb7\xa4\xb7\x87\x5e\xd2\x0e\x7b\x4b\xfa\x65\x9f\xb5\xe5\xba\xa2\xde\xb4\x94\xf4\x4e\x7f\x66\x37\xe5\xa2\xab\x7a\x6e\xe9\x4f\xf2\x2b\xfb\x58\xb6\x5d\xd5\x70\xed\x7f\x94\x5f\xd9\xbe\x58\x33\xc0\x05\xfd\xc9\xfa\x72\xb7\xdf\x16\x28\x70\xa5\x3f\xb3\x6d\x51\xaf\x0f\x02\xf3\x5a\x7f\x66\xcb\xb6\xa4\xac\x79\x5d\xde\x50\xea\x19\x3e\x66\xb3\x59\x76\xa0\x49\x98\xef\xdb\xe6\xba\xda\x96\xf3\xa2\x5e\xcd\x77\x32\xcc\x5f\x28\x3d\xd7\xf4\x9c\xd2\x73\x4e\xc7\x10\xca\x15\x0d\x75\x5e\x74\x3a\x0e\x9a\x4b\x1a\x79\xd1\x65\xa8\xaa\x2e\x76\x56\x9a\x7f\x66\xe5\xae\xa8\xb6\x3c\x6b\xfc\x97\xfa\xdd\x75\x37\x0d\xa6\xf6\x42\x7f\xd2\x1c\xcc\xfb\xdb\x7d\x89\x29\x78\x7a\x45\xbf\xb2\x65\xb1\xef\x97\x9b\x82\xbb\x29\xbf\x32\x02\xda\x37\x34\x17\x4d\x7b\x0b\x38\xfb\xc8\x9a\x76\x5d\xd4\xd5\x5f\x8b\x5e\xe6\xe7\xad\xfb\xcc\x76\x55\xdb\x36\x3c\xb5\xe7\xf8\x91\xd1\xc8\xe7\x5c\x0f\xa5\xbc\xa1\x49\x70\xb5\x70\xce\xae\x5a\xb7\x32\x8b\x9c\x79\x8e\x2f\xae\x45\xf2\xb4\x26\xc9\x0a\xb5\x5d\x37\xed\x07\x4d\x7d\xc1\x3f\x07\x55\x52\xe7\x34\x37\xed\x57\x51\xd3\x7a\x68\xee\x39\x3e\x12\x80\x2e\x2b\x56\x3b\x9a\xe1\x7d\x51\x97\x3c\x75\xa7\xfc\x45\xf3\x45\x5f\x59\xb1\x5c\x36\x87\xba\x9f\x77\x65\xdf\x57\xf5\x9a\xd7\xe0\x54\x92\xf2\x4b\x4d\xca\x5c\x5e\x48\xbb\x6d\x0e\x61\x95\x29\xfd\xcf\xf4\x99\x5f\xc8\xa7\xe4\xb9\x42\xc8\x0c\x25\xa9\xc9\xbe\xfa\x58\xf5\x55\x29\x8d\xd9\x47\xb6\x3f\x6c\xb7\x34\x9f\x7f\x39\x94\x5d\xcf\x59\x17\xf4\x4d\x33\x20\xdf\x59\xd5\x75\x07\x94\x78\x85\x1f\x19\x2d\x6a\xbd\xc4\x70\xce\xf0\x23\xcb\x7e\xad\xea\xae\x2f\xb6\xdb\xf7\x99\xfe\x60\x60\xf9\x25\xf3\xd4\x57\x3d\x3a\xab\x89\xf9\x65\x5f\xee\x3b\x9e\xe8\xfc\x45\xd5\x76\xfd\xd3\xbe\x22\x54\x7b\x77\xa8\xb3\x55\xb3\xfc\x40\x48\xcc\x1b\x12\x5b\xe9\xd5\x75\x4e\x63\x7a\x44\x68\xdc\x1e\xea\x9a\x46\x91\xff\xdc\xd0\xc8\xa8\x99\x6a\x55\xe6\xcf\x01\x7d\x92\xef\xb7\x65\xd1\x11\x48\x59\xac\xf2\x6f\x8b\xbc\x2f\xda\x75\xd9\x7f\xf7\x60\xbe\xa0\xcd\xf3\xe1\x41\xbe\x69\xcb\xeb\xef\x1e\x3c\xec\x1e\x7c\xff\xf3\x81\x8a\x6d\xab\xba\xec\xbe\x7d\x56\x7c\x9f\x2f\x0b\xca\xa1\xb1\xde\xe6\x8b\xf2\x9a\xf7\x0a\xb5\x95\x13\x92\xd6\x6b\xde\x27\xb7\xfd\x86\x1b\xa4\x05\xa3\x1f\x5d\xce\x1b\xf5\xab\x8c\x67\x89\x36\xf2\x7c\xb5\x30\xa2\x84\x0e\x21\xb9\xa5\x59\x3a\xbf\xbd\xfc\xf7\xd7\x27\xf9\x05\x51\xa6\x75\x5b\xe2\x37\xfd\x47\x25\xfe\x90\xd3\x68\xaf\xaa\xe7\x3f\xce\x32\x2a\x6b\x13\xf2\xbc\xe8\x8b\x05\xf7\x3d\x2c\x12\x67\xca\x1e\x0a\x79\xd8\x49\x4c\xeb\x40\xd7\xba\x1e\xbb\x53\x77\xe6\xe4\x3e\xa4\x3a\x74\xf3\x86\x3a\xde\xf0\x0e\xa6\xf4\x30\xb3\x17\x32\x67\x54\x55\xfe\xea\xcd\x9b\xb7\xcf\x7f\xcc\xcb\x7a\x4d\x33\x93\xdf\x54\xfd\x26\x3f\xf4\xd7\xff\xff\x7c\x5d\xd6\x65\x5b\x6c\xe7\xcb\x8a\x27\xa5\x25\xbc\xca\x69\x96\x64\x88\xb3\xac\xeb\xb6\x44\x60\x56\xdc\xca\xe5\xe5\xeb\xfc\x9c\x7e\x52\x67\xa8\x2c\x77\xa4\xdf\x64\xdd\x5f\xb6\x3c\x51\xa1\xc1\xab\x4d\x99\x03\x67\x01\xd4\x5c\x0f\xe7\x25\x5f\x69\x5f\x67\xf9\xb7\x8b\xf6\x7b\xd7\xbf\x62\xd1\x35\xdb\x43\xaf\x25\x6f\x36\x65\x8d\x85\x22\x54\x6a\x7b\xa2\x56\x46\xfb\x67\x59\xd9\xb6\x73\xa2\x9b\xfd\x2d\x2f\x8f\xf6\xe5\x58\x2b\x52\x19\xa1\x72\xdd\xf4\xb4\xfc\x39\xca\x49\x15\x55\xfd\xb1\xd8\x56\x2b\x5a\xa4\x38\x91\x69\x59\x24\xae\x1a\x5a\x6f\x2e\x4d\x18\xdd\xdc\x60\x8a\x68\x83\x11\x59\xcf\x1f\xcc\x1e\x80\xce\x3e\x78\xfa\x60\x96\xd5\xcd\x5c\x88\x00\x53\xe4\x55\xd5\x15\x0b\xa2\xce\x72\x5a\xb4\x46\xec\xfe\xcc\x78\x27\x5d\x51\x88\x3c\x81\xe0\x35\xe1\x13\x08\x84\x9f\x91\xb2\x20\x32\x0d\x5a\xa2\x54\xc4\x8f\xdd\x48\x4e\xc0\x0b\xa1\x3a\x21\x61\x34\xe6\xcc\x16\xda\xb0\xf2\x74\xbf\xdf\x56\x4b\x69\xfa\x67\xc9\x8b\x08\xca\xe7\xb1\x4e\x8a\x87\x03\x82\x59\x9e\x43\x33\xea\x35\x53\xa5\x3c\x21\xef\x28\xbf\x29\x69\xc7\x6d\x0e\x6b\x39\x93\xb6\xcd\x61\xf5\x15\x0e\x07\x5b\xb9\x48\x82\xf3\x77\x0d\x75\x18\x58\x15\x00\x62\x13\xa7\x44\x50\x98\x05\x68\xcb\x5d\xd3\xf3\xc4\x69\x31\x26\x73\x37\x15\x65\xd2\x48\xbb\xe2\x23\x1d\x6e\x7d\x23\x5b\x79\x45\x5b\x75\xc9\x15\xcf\x32\x22\x2b\x73\xdd\x4e\x44\x7f\x64\x4b\x59\x5a\x8a\xbb\x80\xda\x1d\x68\x17\x6e\xa8\x32\x9e\x78\xe6\x43\xa8\xca\xa9\x7e\x62\x48\x54\x0f\xa8\x03\xed\xf8\x86\xce\x4c\x5e\xe8\xe7\xf8\xa1\xdf\xbe\x7e\xea\x55\x71\x7d\x4d\xbd\xea\x68\x37\xbd\xcc\x97\xdb\x86\xb6\xe2\x2f\xef\x5e\x77\xbc\xd1\x36\xf3\x7d\xd3\x82\xff\xa0\xac\x0b\xfa\x19\xd2\xdc\x44\x33\x44\x7d\xd8\x2d\xe8\xeb\x66\x53\x2d\x37\x32\xed\x5c\x82\xf7\x0Line truncated
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
return bindataRead(
@@ -4382,7 +4382,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 55979, mode: os.FileMode(420), modTime: time.Unix(1472598262, 0)}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 56040, mode: os.FileMode(420), modTime: time.Unix(1472629974, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
+7 -2
View File
@@ -146,13 +146,18 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
return
}
if err := models.CreateSource(&models.LoginSource{
if err := models.CreateLoginSource(&models.LoginSource{
Type: models.LoginType(form.Type),
Name: form.Name,
IsActived: form.IsActive,
Cfg: config,
}); err != nil {
ctx.Handle(500, "CreateSource", err)
if models.IsErrLoginSourceAlreadyExist(err) {
ctx.Data["Err_Name"] = true
ctx.RenderWithErr(ctx.Tr("admin.auths.login_source_exist", err.(models.ErrLoginSourceAlreadyExist).Name), AUTH_NEW, form)
} else {
ctx.Handle(500, "CreateSource", err)
}
return
}
+1 -1
View File
@@ -21,7 +21,7 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
source, err := models.GetLoginSourceByID(sourceID)
if err != nil {
if models.IsErrAuthenticationNotExist(err) {
if models.IsErrLoginSourceNotExist(err) {
ctx.Error(422, "", err)
} else {
ctx.Error(500, "GetLoginSourceByID", err)