Rework invitation UI a bit, document API changes

merge-requests/26/head
knotteye 2020-10-13 16:16:37 -05:00
parent 67de11e66b
commit eba53c3732
3 changed files with 5 additions and 9 deletions

View File

@ -91,7 +91,9 @@ Register a new user.
**Authentication**: no
**Parameters**: Username, password, confirm
**Parameters**: Username, password, confirm, invite(optional)
Invite is an optional invite code to bypass disabled registration.
**Response**: If successful, returns a json object with the users stream key. Otherwise returns `{error: "error reason"}`

View File

@ -507,12 +507,6 @@ async function initSite(openReg) {
}
else res.render('invite.njk',Object.assign({icode: req.params.code}, njkconf));
});
app.get('/invite', (req, res) => {
if(tryDecode(req.cookies.Authorization)) {
res.redirect('/profile');
}
else res.render('invite.njk',Object.assign({icode: ""}, njkconf));
});
app.get('/register', (req, res) => {
if(tryDecode(req.cookies.Authorization) || !openReg) {
res.redirect(njkconf.rootredirect);

View File

@ -6,8 +6,8 @@
<form action="/api/register" method="POST" target="responseFrame">
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
Confirm: </br><input type="password" name="confirm" style="min-width: 300px"/></br>
Invite Code: </br><input type="text" name="invite" style="min-width: 300px" value="{{icode}}"/></br></br>
Confirm: </br><input type="password" name="confirm" style="min-width: 300px"/></br></br>
<input type="hidden" name="invite" style="min-width: 300px" value="{{icode}}"/>
<input type="submit" value="Submit">
</form></br>