fixing login err

This commit is contained in:
afeiszli 2021-08-09 13:30:40 -04:00
parent 382901b124
commit f8df4b571b
2 changed files with 12 additions and 6 deletions

View file

@ -61,7 +61,7 @@ services:
container_name: coredns container_name: coredns
restart: always restart: always
ports: ports:
- "5353:53/udp" - "53:53/udp"
volumes: volumes:
- dnsconfig:/root/dnsconfig - dnsconfig:/root/dnsconfig
volumes: volumes:

View file

@ -183,9 +183,13 @@ func HasAdmin() (bool, error) {
collection, err := database.FetchRecords(database.USERS_TABLE_NAME) collection, err := database.FetchRecords(database.USERS_TABLE_NAME)
if err != nil { if err != nil {
return true, err if database.IsEmptyRecord(err) {
} return false, nil
} else {
return true, err
}
}
for _, value := range collection { // filter for isadmin true for _, value := range collection { // filter for isadmin true
var user models.User var user models.User
err = json.Unmarshal([]byte(value), &user) err = json.Unmarshal([]byte(value), &user)
@ -204,9 +208,11 @@ func hasAdmin(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
hasadmin, _ := HasAdmin() hasadmin, err := HasAdmin()
if err != nil {
//Returns all the nodes in JSON format returnErrorResponse(w, r, formatError(err, "internal"))
return
}
json.NewEncoder(w).Encode(hasadmin) json.NewEncoder(w).Encode(hasadmin)