Browse Source

Merge pull request #246 from Bwko/fix/typo

Fix typos
tags/v1.0.0
Thomas Boerger 7 years ago
parent
commit
e9c6053b86
3 changed files with 8 additions and 8 deletions
  1. 1
    1
      models/issue.go
  2. 6
    6
      models/login_source.go
  3. 1
    1
      modules/auth/repo_form.go

+ 1
- 1
models/issue.go View File

} }


if len(opts.LableIDs) > 0 { if len(opts.LableIDs) > 0 {
// During the session, SQLite3 dirver cannot handle retrieve objects after update something.
// During the session, SQLite3 driver cannot handle retrieve objects after update something.
// So we have to get all needed labels first. // So we have to get all needed labels first.
labels := make([]*Label, 0, len(opts.LableIDs)) labels := make([]*Label, 0, len(opts.LableIDs))
if err = e.In("id", opts.LableIDs).Find(&labels); err != nil { if err = e.In("id", opts.LableIDs).Find(&labels); err != nil {

+ 6
- 6
models/login_source.go View File



// LoginViaLDAP queries if login/password is valid against the LDAP directory pool, // LoginViaLDAP queries if login/password is valid against the LDAP directory pool,
// and create a local user if success when enabled. // 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)
func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error) {
username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, password, source.Type == LoginDLDAP)
if !succeed { if !succeed {
// User not in LDAP, do nothing // User not in LDAP, do nothing
return nil, ErrUserNotExist{0, login, 0} return nil, ErrUserNotExist{0, login, 0}
} }


// UserSignIn validates user name and password. // UserSignIn validates user name and password.
func UserSignIn(username, passowrd string) (*User, error) {
func UserSignIn(username, password string) (*User, error) {
var user *User var user *User
if strings.Contains(username, "@") { if strings.Contains(username, "@") {
user = &User{Email: strings.ToLower(username)} user = &User{Email: strings.ToLower(username)}
if hasUser { if hasUser {
switch user.LoginType { switch user.LoginType {
case LoginNoType, LoginPlain: case LoginNoType, LoginPlain:
if user.ValidatePassword(passowrd) {
if user.ValidatePassword(password) {
return user, nil return user, nil
} }


return nil, ErrLoginSourceNotExist{user.LoginSource} return nil, ErrLoginSourceNotExist{user.LoginSource}
} }


return ExternalUserLogin(user, user.LoginName, passowrd, &source, false)
return ExternalUserLogin(user, user.LoginName, password, &source, false)
} }
} }


} }


for _, source := range sources { for _, source := range sources {
authUser, err := ExternalUserLogin(nil, username, passowrd, source, true)
authUser, err := ExternalUserLogin(nil, username, password, source, true)
if err == nil { if err == nil {
return authUser, nil return authUser, nil
} }

+ 1
- 1
modules/auth/repo_form.go View File

} }


// ParseRemoteAddr checks if given remote address is valid, // ParseRemoteAddr checks if given remote address is valid,
// and returns composed URL with needed username and passowrd.
// and returns composed URL with needed username and password.
// It also checks if given user has permission when remote address // It also checks if given user has permission when remote address
// is actually a local path. // is actually a local path.
func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) { func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) {

Loading…
Cancel
Save