add login name for auth type

This commit is contained in:
Lunny Xiao 2014-05-11 11:56:04 +08:00
parent 43ffacd05b
commit 4d6de6c7b9
5 changed files with 48 additions and 1 deletions

View File

@ -58,7 +58,7 @@ func CreateRelease(repoPath string, rel *Release, gitRepo *git.Repository) error
return ErrReleaseAlreadyExist 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) _, stderr, err := com.ExecCmdDir(repoPath, "git", "tag", rel.TagName, "-m", rel.Title)
if err != nil { if err != nil {
return err return err

View File

@ -44,6 +44,7 @@ type User struct {
Passwd string `xorm:"not null"` Passwd string `xorm:"not null"`
LoginType int LoginType int
LoginSource int64 `xorm:"not null default 0"` LoginSource int64 `xorm:"not null default 0"`
LoginName string
Type int Type int
NumFollowers int NumFollowers int
NumFollowings int NumFollowings int

View File

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

View File

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

View File

@ -24,6 +24,13 @@
</select> </select>
</div> </div>
</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}}"> <div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
<label class="col-md-3 control-label">Username: </label> <label class="col-md-3 control-label">Username: </label>