func (ui *GUI) adminLogin(w http.ResponseWriter, r *http.Request) {
	session := r.Context().Value(sessionKey).(*sessions.Session)
	pass := r.FormValue("password")
	if ui.cfg.AdminPass != pass {
		log.Warn("Unauthorized access")
		http.Error(w, "Incorrect password", http.StatusUnauthorized)
		return
	}
	session.Values["IsAdmin"] = true
	err := session.Save(r, w)
	if err != nil {
		log.Errorf("unable to save session: %v", err)
		return
	}
	w.WriteHeader(http.StatusOK)
}
adminLogin is the handler for "POST /admin". If proper admin credentials are
supplied, the session is authenticated and a "200 OK" response is returned,
otherwise a "401 Unauthorized" response is returned.
package gui
import (
	"net/http"
	"github.com/decred/dcrpool/pool"
	"github.com/gorilla/csrf"
	"github.com/gorilla/sessions"
)
type adminPageData struct {
	HeaderData            headerData
	PoolStatsData         poolStatsData
	ConnectedClients      map[string][]*client
	ArchivedPaymentsTotal string
	ArchivedPayments      []*archivedPayment
	PendingPaymentsTotal  string
	PendingPayments       []*pendingPayment
	BackupAvailable       bool
}
func (ui *GUI) adminPage(w http.ResponseWriter, r *http.Request) {
	session := r.Context().Value(sessionKey).(*sessions.Session)
	if session.Values["IsAdmin"] != true {
		http.Redirect(w, r, "/", http.StatusSeeOther)
		return
	}
	clients := ui.cache.getClients()
	totalPending := ui.cache.getPendingPaymentsTotal(pool.PoolFeesK)
	totalArchived := ui.cache.getArchivedPaymentsTotal(pool.PoolFeesK)
	_, pendingPmts, _ := ui.cache.getPendingPayments(0, 9, pool.PoolFeesK)
	_, archivedPmts, _ := ui.cache.getArchivedPayments(0, 9, pool.PoolFeesK)
	lastPaymentHeight, _, _ := ui.cache.getLastPaymentInfo()
	pageData := adminPageData{
		HeaderData: headerData{
			CSRF:        csrf.TemplateField(r),
			Designation: ui.cfg.Designation,
			ShowMenu:    false,
			SoloPool:    ui.cfg.SoloPool,
		},
		PoolStatsData: poolStatsData{
			LastWorkHeight:    ui.cfg.FetchLastWorkHeight(),
			LastPaymentHeight: lastPaymentHeight,
			PoolHashRate:      ui.cache.getPoolHash(),
			PaymentMethod:     ui.cfg.PaymentMethod,
			Network:           ui.cfg.ActiveNetName,
			PoolFee:           ui.cfg.PoolFee,
			SoloPool:          ui.cfg.SoloPool,
		},
		ConnectedClients:      clients,
		PendingPaymentsTotal:  totalPending,
		PendingPayments:       pendingPmts,
		ArchivedPaymentsTotal: totalArchived,
		ArchivedPayments:      archivedPmts,
		BackupAvailable:       ui.cfg.HTTPBackupDB != nil,
	}
	ui.renderTemplate(w, "admin", pageData)
}