mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 09:57:45 +01:00
add login name for auth type
This commit is contained in:
parent
43ffacd05b
commit
4d6de6c7b9
5 changed files with 48 additions and 1 deletions
|
@ -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
|
||||
|
|
32
modules/auth/ldap/ldap_test.go
Normal file
32
modules/auth/ldap/ldap_test.go
Normal 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)
|
||||
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -25,6 +25,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 {{if .Err_UserName}}has-error has-feedback{{end}}">
|
||||
<label class="col-md-3 control-label">Username: </label>
|
||||
<div class="col-md-7">
|
||||
|
|
Loading…
Reference in a new issue