oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "net/http"
5
6 "amadan.net/oficina/equipo/internal/equipo/identity"
7 "amadan.net/oficina/equipo/internal/equipo/oficinaid"
8 "amadan.net/rastrillo/rastrillo/auth"
9)
10
11func (a *application) sessionFrom(r *http.Request) (auth.Identity, bool) {
12 if a.home != nil {
13 return a.home.Session(r)
14 }
15 return a.auth.SessionFrom(r)
16}
17func (a *application) renderID(w http.ResponseWriter, r *http.Request, view oficinaid.View, status int) {
18 w.Header().Set("Cache-Control", "no-store")
19 if view.State == "signed-out" {
20 signinLook.SignedOut(w, r, true, view.HomeSignout)
21 return
22 }
23 if view.State == "settings" || view.State == "confirm" || view.State == "unlink" {
24 id, ok := a.sessionFrom(r)
25 if !ok {
26 ErrorPage(w, r, 403, "")
27 return
28 }
29 data, e := a.settingsPage(identity.With(r, id), "oficina-id", false)
30 if e != nil {
31 ErrorPage(w, r, 503, "")
32 return
33 }
34 data.ID = view
35 renderStatus(w, status, "oficina_id", data)
36 return
37 }
38 renderStatus(w, status, "id_public", map[string]any{"ID": view, "Brand": map[string]string{"Name": copyBrand}})
39}
40