Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.

Commit

Permalink
make cookie login finally work.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Nov 22, 2020
1 parent 14e83be commit c5c81a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func defaultAuth(r *http.Request) error {
if r.URL.Query().Get("access-key") == accessKey {
return nil
}
if cookie, err := r.Cookie("user"); err == nil {
var value string
if err = scookie.Decode("user", cookie.Value, &value); err == nil && strings.HasPrefix(login+":", value) {
return nil
}
}

// try to get basic auth
v := r.Header.Get("Authorization")
Expand Down

0 comments on commit c5c81a7

Please sign in to comment.