]> git.cworth.org Git - lmno-server/commit
Add a simple /stats endpoint to get a count of current games in progress
authorCarl Worth <cworth@cworth.org>
Thu, 21 May 2020 16:13:11 +0000 (09:13 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 21 May 2020 16:13:11 +0000 (09:13 -0700)
commit733fd82de5d0448649f769af5850ad6cc528f0d5
tree968e1ed88016d08bd8926e3efe9cd05f6aa0936e
parente26d357ee7d6e689d098889de66d1c8c40482544
Add a simple /stats endpoint to get a count of current games in progress

This view is particularly spartan so far, (just two lines of next, not
even HTML).

Most of the work in this commit is actually setting up the
authentication mechanism, since /stats is the first page we have that
requires a user to be authenticated (and to also have the "admin"
role).

We have a nice-looking "/login" page with proper styling and clean
messages for login failure. If an unauthenticated user goes to /stats
they will be sent to /login?next=/stats and after successfully
authenticating, will be sent back to /stats (this time getting the
spartan view of the game statistics).

There is another set of pages that is more minmal than we really
want. This is all in the area of user that successfully authenticates
but doesn't have the "admin" role. I'm ignoring all of these issues
for now because I'm not going to actually configure any such
users. But here are the issues:

  * If a user without the admin role hits /stats they they will get a
    correct 401 status, but a very spartan page (just the word
    "Unauthorized" as plain text).

  * In that case, if the user wants to logout there are no links
    provided to do that.

  * There _is_ a page at /logout which does do a correct logout, but
    again returns a very spartan, plain-text message that you are
    logged out.
lmno.js
login.html [new file with mode: 0644]