Browse Source

Make the UI for user invites a bit better

Getty Ritter 1 year ago
parent
commit
d6ea3233ea
4 changed files with 64 additions and 35 deletions
  1. 3 1
      lc/app.py
  2. 16 0
      lc/static/main.css
  3. 6 1
      templates/add_user.mustache
  4. 39 33
      templates/config.mustache

+ 3 - 1
lc/app.py

@@ -78,7 +78,9 @@ class CreateUser(Endpoint):
 
     def api_post(self):
         token = flask.request.args["token"]
-        u = m.User.from_invite(self.request_data(r.NewUser).to_user_request(), token)
+        req = self.request_data(r.NewUser).to_user_request()
+        u = m.User.from_invite(req, token)
+        flask.session["auth"] = req.to_token()
         raise e.LCRedirect(u.base_url())
 
 

+ 16 - 0
lc/static/main.css

@@ -107,6 +107,22 @@ a {
     justify-content: center;
 }
 
+.config-pane {
+    display: flex;
+    justify-content: center;
+}
+
+.config {
+    margin: 2em;
+    padding: 2em;
+    border: solid black 1px;
+}
+
+.invite {
+    font-size: small;
+    color: #444;
+}
+
 label {
     display: inline-block;
     width: 6em;

+ 6 - 1
templates/add_user.mustache

@@ -1,5 +1,9 @@
 <div class="config-pane">
-  Sign up using invite code {{token}}.
+  <div class="config">
+    <div>
+      Sign up for Lament Configuration.<br/>
+      <span class="invite">(invite token: {{token}}).</token>
+      </span>
   <form name="new-user" method="POST">
     <div>
       <label for="username">Username</label>
@@ -17,4 +21,5 @@
       <input type="submit" value="Sign up" />
     </div>
   </form>
+  </div>
 </div>

+ 39 - 33
templates/config.mustache

@@ -1,40 +1,46 @@
 <div class="config-pane">
-  Change password:
-  <form name="password-change" action="/u/{{username}}/password" method="POST">
-    <div>
-      <label for="old">Old password</label>
-      <input name="old" type="password" />
-    </div>
-    <div>
-      <label for="n1">New password</label>
-      <input name="n1" type="password" />
-    </div>
-    <div>
-      <label for="n2">Retype password</label>
-      <input name="n2" type="password" />
-    </div>
-    <div>
-      <input type="submit" value="Change Password" />
-    </div>
-  </form>
+  <div class="config">
+    Change password:
+    <form name="password-change" action="/u/{{username}}/password" method="POST">
+      <div>
+        <label for="old">Old:</label>
+        <input name="old" type="password" />
+      </div>
+      <div>
+        <label for="n1">New:</label>
+        <input name="n1" type="password" />
+      </div>
+      <div>
+        <label for="n2">New:</label>
+        <input name="n2" type="password" />
+      </div>
+      <div>
+        <input type="submit" value="Change Password" />
+      </div>
+    </form>
+  </div>
 </div>
 {{#admin_pane}}
   <div class="config-pane">
-    User Invites:
-    <ul>
-      {{#invites}}
-        {{#claimed}}
-          <li>Token {{token}} claimed by <a href="/u/{{claimant}}">{{claimant}}</a></li>
-        {{/claimed}}
-        {{^claimed}}
-          <li>Token <a href="/u?token={{token}}">{{token}}</a></li>
-        {{/claimed}}
-      {{/invites}}
-    </ul>
-    <form name="new-invite" action="/u/{{username}}/invite" method="POST">
-      <div>
-        <input type="submit" value="Create invite link" />
+    <div class="config">
+      User Invites:
+      <ul>
+        {{#invites}}
+          {{#claimed}}
+            <li><span class="invite">{{token}}</span> claimed: <span class="user"><a href="/u/{{claimant}}">@{{claimant}}</a></span></li>
+          {{/claimed}}
+          {{^claimed}}
+            <li>Token <span class="invite"><a href="/u?token={{token}}">{{token}}</a></invite></li>
+          {{/claimed}}
+        {{/invites}}
+      </ul>
+      <div class="add-new">
+        <form name="new-invite" action="/u/{{username}}/invite" method="POST">
+          <div>
+            <input type="submit" value="Create invite link" />
+          </div>
+        </form>
       </div>
-    </form>
+    </div>
   </div>
 {{/admin_pane}}