1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| {% import ( "{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/lib/auth" "{{{ .Package }}}/app/util" ) %}
{% func SigninTable(prvs auth.Providers, referrer string, as *app.State, ps *cutil.PageState) %} {%- if len(prvs) > 0 -%} <div class="card"> <h3>Sign in to {%s util.AppName %}</h3> <ul class="mt"> {%- for _, prv := range prvs -%} <li> {%- if referrer == "" -%} <a href="/auth/{%u prv.ID %}">{%s prv.Title %}</a> {%- else -%} <a href="/auth/{%u prv.ID %}?refer={%u referrer %}">{%s prv.Title %}</a> {%- endif -%} {%- code as := ps.Accounts.GetByProvider(prv.ID) -%} {%- if len(as) > 0 -%} <ul> {%- for _, a := range as -%} <li> {%- if a.Picture != "" -%} <img style="width: 16px; height: 16px; margin-bottom: -2px;" src="{%s a.Picture %}" /> {%- endif -%} {%s a.Email %} (<a href="/auth/logout/{%u a.Provider %}?email={%u a.Email %}">sign out</a>) </li> {%- endfor -%} </ul> {%- endif -%} </li> {%- endfor -%} </ul> </div> {%- endif -%} {% endfunc %}
|