forked from NYANDEV/forgejo
work on #616 and update locales
This commit is contained in:
parent
ff8578082e
commit
e0de6cb5ad
18 changed files with 230 additions and 189 deletions
|
@ -174,26 +174,6 @@ func Contexter() macaron.Handler {
|
|||
// Get user from session if logined.
|
||||
ctx.User = auth.SignedInUser(ctx.Req.Header, ctx.Session)
|
||||
|
||||
// Check with basic auth again.
|
||||
if ctx.User == nil {
|
||||
baHead := ctx.Req.Header.Get("Authorization")
|
||||
auths := strings.Fields(baHead)
|
||||
if len(auths) == 2 && auths[0] == "Basic" {
|
||||
uname, passwd, _ := base.BasicAuthDecode(auths[1])
|
||||
u, err := models.GetUserByName(uname)
|
||||
if err != nil {
|
||||
if err != models.ErrUserNotExist {
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if u.ValidtePassword(passwd) {
|
||||
ctx.User = u
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.User != nil {
|
||||
ctx.IsSigned = true
|
||||
ctx.Data["IsSigned"] = ctx.IsSigned
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue