add login name for auth type

tokarchuk/v1.17
Lunny Xiao 11 years ago
parent 43ffacd05b
commit 4d6de6c7b9
  1. 2
      models/release.go
  2. 1
      models/user.go
  3. 32
      modules/auth/ldap/ldap_test.go
  4. 7
      templates/admin/users/edit.tmpl
  5. 7
      templates/admin/users/new.tmpl

@ -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

@ -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

@ -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)
}

@ -26,6 +26,13 @@
</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">
<label class="col-md-3 control-label">Username: </label>
<label class="control-label">{{.User.Name}}</label>

@ -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>

Loading…
Cancel
Save