Rework invitation UI a bit, document API changes
parent
67de11e66b
commit
eba53c3732
|
@ -91,7 +91,9 @@ Register a new user.
|
||||||
|
|
||||||
**Authentication**: no
|
**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"}`
|
**Response**: If successful, returns a json object with the users stream key. Otherwise returns `{error: "error reason"}`
|
||||||
|
|
||||||
|
|
|
@ -507,12 +507,6 @@ async function initSite(openReg) {
|
||||||
}
|
}
|
||||||
else res.render('invite.njk',Object.assign({icode: req.params.code}, njkconf));
|
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) => {
|
app.get('/register', (req, res) => {
|
||||||
if(tryDecode(req.cookies.Authorization) || !openReg) {
|
if(tryDecode(req.cookies.Authorization) || !openReg) {
|
||||||
res.redirect(njkconf.rootredirect);
|
res.redirect(njkconf.rootredirect);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<form action="/api/register" method="POST" target="responseFrame">
|
<form action="/api/register" method="POST" target="responseFrame">
|
||||||
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
|
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>
|
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
|
||||||
Confirm: </br><input type="password" name="confirm" style="min-width: 300px"/></br>
|
Confirm: </br><input type="password" name="confirm" style="min-width: 300px"/></br></br>
|
||||||
Invite Code: </br><input type="text" name="invite" style="min-width: 300px" value="{{icode}}"/></br></br>
|
<input type="hidden" name="invite" style="min-width: 300px" value="{{icode}}"/>
|
||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</form></br>
|
</form></br>
|
||||||
|
|
||||||
|
|
Reference in New Issue