diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-05-11 11:56:04 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-05-11 11:56:04 +0800 |
commit | 4d6de6c7b9715a6ccce3f09249b47b984b9a1295 (patch) | |
tree | 9c0d588a94b5c9fea4b7bc35c8f65672fc7b7dfd | |
parent | 43ffacd05b7b5c9d7b4966f4404a7dc53f2229aa (diff) | |
download | gitea-4d6de6c7b9715a6ccce3f09249b47b984b9a1295.tar.gz gitea-4d6de6c7b9715a6ccce3f09249b47b984b9a1295.zip |
add login name for auth type
-rw-r--r-- | models/release.go | 2 | ||||
-rw-r--r-- | models/user.go | 1 | ||||
-rw-r--r-- | modules/auth/ldap/ldap_test.go | 32 | ||||
-rw-r--r-- | templates/admin/users/edit.tmpl | 7 | ||||
-rw-r--r-- | templates/admin/users/new.tmpl | 7 |
5 files changed, 48 insertions, 1 deletions
diff --git a/models/release.go b/models/release.go index 1df6272029..1fee56105f 100644 --- a/models/release.go +++ b/models/release.go @@ -58,7 +58,7 @@ func CreateRelease(repoPath string, rel *Release, gitRepo *git.Repository) error return ErrReleaseAlreadyExist } - if !git.IsTagExist(repoPath, rel.TagName) { + if !gitRepo.IsTagExist(rel.TagName) { _, stderr, err := com.ExecCmdDir(repoPath, "git", "tag", rel.TagName, "-m", rel.Title) if err != nil { return err diff --git a/models/user.go b/models/user.go index b2b16f1136..397094920b 100644 --- a/models/user.go +++ b/models/user.go @@ -44,6 +44,7 @@ type User struct { Passwd string `xorm:"not null"` LoginType int LoginSource int64 `xorm:"not null default 0"` + LoginName string Type int NumFollowers int NumFollowings int diff --git a/modules/auth/ldap/ldap_test.go b/modules/auth/ldap/ldap_test.go new file mode 100644 index 0000000000..8096573782 --- /dev/null +++ b/modules/auth/ldap/ldap_test.go @@ -0,0 +1,32 @@ +package ldap + +import ( + "fmt" + "testing" +) + +var ldapServer = "ldap.itd.umich.edu" +var ldapPort = uint16(389) +var baseDN = "dc=umich,dc=edu" +var filter = []string{ + "(cn=cis-fac)", + "(&(objectclass=rfc822mailgroup)(cn=*Computer*))", + "(&(objectclass=rfc822mailgroup)(cn=*Mathematics*))"} +var attributes = []string{ + "cn", + "description"} +var msadsaformat = "" + +func TestLDAP(t *testing.T) { + AddSource("test", ldapServer, ldapPort, + basedn, attributes, filter, + msadsaformat) + user, err := LoginUserLdap("xiaolunwen", "") + if err != nil { + t.Error(err) + return + } + + fmt.Println(user) + +} diff --git a/templates/admin/users/edit.tmpl b/templates/admin/users/edit.tmpl index 1fb29234ed..4995856768 100644 --- a/templates/admin/users/edit.tmpl +++ b/templates/admin/users/edit.tmpl @@ -27,6 +27,13 @@ </div> <div class="form-group"> + <label class="col-md-3 control-label">Auth Login Name: </label> + <div class="col-md-7"> + <input name="loginname" class="form-control" placeholder="Type auth login's username" value="{{.loginname}}"> + </div> + </div> + + <div class="form-group"> <label class="col-md-3 control-label">Username: </label> <label class="control-label">{{.User.Name}}</label> </div> diff --git a/templates/admin/users/new.tmpl b/templates/admin/users/new.tmpl index 88da16aa4e..b4843a99ca 100644 --- a/templates/admin/users/new.tmpl +++ b/templates/admin/users/new.tmpl @@ -24,6 +24,13 @@ </select> </div> </div> + + <div class="form-group"> + <label class="col-md-3 control-label">Auth Login Name: </label> + <div class="col-md-7"> + <input name="loginname" class="form-control" placeholder="Type auth login's username" value="{{.loginname}}"> + </div> + </div> <div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}"> <label class="col-md-3 control-label">Username: </label> |