| 1 | {{define "cli_approve"}}{{template "top" .}} |
| 2 | <h1>Approve a terminal</h1> |
| 3 | {{if .Error}}<p class="error">{{.Error}}</p>{{end}} |
| 4 | {{if .Request}} |
| 5 | <p class="lede">A command line asked to sign in as you.</p> |
| 6 | <div class="banner"> |
| 7 | <p><strong>Code</strong> <code>{{.Request.UserCode}}</code></p> |
| 8 | <p><strong>Terminal</strong> {{emptyOrDash .Request.Label}} |
| 9 | <span class="small">— this name was supplied by the machine asking. Trust |
| 10 | it only if it matches the machine in front of you.</span></p> |
| 11 | <p><strong>From</strong> {{emptyOrDash .Request.RemoteAddr}}</p> |
| 12 | <p class="small">Expires {{fmtTime .Request.ExpiresAt}}</p> |
| 13 | </div> |
| 14 | <p>Approving gives that terminal your identity — every account you belong to — |
| 15 | for {{.Days}} days. You can revoke it at any time from |
| 16 | <a href="/settings">command-line access</a>, and a note goes to your |
| 17 | Keymail inbox the moment it is issued.</p> |
| 18 | <form class="signin" method="post" action="/auth/cli/approve"> |
| 19 | <input type="hidden" name="csrf" value="{{.CSRF}}"> |
| 20 | <input type="hidden" name="code" value="{{.Request.UserCode}}"> |
| 21 | <button type="submit" name="action" value="approve">Approve</button> |
| 22 | <button class="linkish" type="submit" name="action" value="deny">That wasn't me</button> |
| 23 | </form> |
| 24 | {{else}} |
| 25 | <p class="lede">Type the code your terminal printed.</p> |
| 26 | {{if .LinkCode}} |
| 27 | <div class="banner"> |
| 28 | <p>The link you followed carries the code <code>{{.LinkCode}}</code>.</p> |
| 29 | <p class="small"><strong>Check it against your own screen before typing it.</strong> |
| 30 | If you did not just run <code>carlos auth login</code> yourself, or that is not |
| 31 | the code your terminal printed, close this page: somebody else is asking to |
| 32 | become you, and typing their code is what would let them.</p> |
| 33 | </div> |
| 34 | {{end}} |
| 35 | <form class="signin" method="post" action="/auth/cli/approve"> |
| 36 | <input type="text" name="code" value="" placeholder="XXXX-XXXX" autocomplete="off" spellcheck="false"> |
| 37 | <input type="hidden" name="csrf" value="{{.CSRF}}"> |
| 38 | <button type="submit" name="action" value="continue">Continue</button> |
| 39 | </form> |
| 40 | <p class="small">Codes look like <code>WXYZ-4823</code> and last ten minutes. |
| 41 | Nothing here is ever approved by following a link — the code has to be typed, |
| 42 | which means it has to be on a screen in front of you.</p> |
| 43 | {{end}} |
| 44 | {{template "bottom" .}}{{end}} |
| 45 | |
| 46 | {{define "cli_decided"}}{{template "top" .}} |
| 47 | <h1>{{.Title}}</h1> |
| 48 | {{if eq .Title "Approved"}} |
| 49 | <p>Your terminal has the credential — it should say so within a couple of |
| 50 | seconds. It expires in {{.Days}} days, and a note is on its way to your Keymail |
| 51 | inbox.</p> |
| 52 | <p><a href="/settings">See every terminal signed in as you</a>, and |
| 53 | revoke any you don't recognise.</p> |
| 54 | {{else}} |
| 55 | <p>Nothing was issued. That login attempt is dead and cannot be approved |
| 56 | afterwards; if it wasn't yours, whoever started it got nothing.</p> |
| 57 | {{end}} |
| 58 | <p class="small"><a href="/">Back to the console</a></p> |
| 59 | {{template "bottom" .}}{{end}} |
| 60 | |