Fully support auth in Web UI; persist users in localStorage (for now); add ugly ?auth=... param
This commit is contained in:
parent
6d343c0f1a
commit
530f55c234
16 changed files with 237 additions and 72 deletions
|
@ -14,12 +14,24 @@ func readBoolParam(r *http.Request, defaultValue bool, names ...string) bool {
|
|||
}
|
||||
|
||||
func readParam(r *http.Request, names ...string) string {
|
||||
value := readHeaderParam(r, names...)
|
||||
if value != "" {
|
||||
return value
|
||||
}
|
||||
return readQueryParam(r, names...)
|
||||
}
|
||||
|
||||
func readHeaderParam(r *http.Request, names ...string) string {
|
||||
for _, name := range names {
|
||||
value := r.Header.Get(name)
|
||||
if value != "" {
|
||||
return strings.TrimSpace(value)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func readQueryParam(r *http.Request, names ...string) string {
|
||||
for _, name := range names {
|
||||
value := r.URL.Query().Get(strings.ToLower(name))
|
||||
if value != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue