Skip to content
Permalink
Browse files
minor updates
  • Loading branch information
aa7401 committed Jul 18, 2019
1 parent a472bf2 commit 0f21dc66b35a7b12c12d0c28bf7c54ee9d168b44
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
@@ -60,7 +60,12 @@ router.get('/', async ctx => {
* @name Register Page
* @route {GET} /register
*/
router.get('/register', async ctx => await ctx.render('register'))
router.get('/register', async ctx => {
const data = {}
if(ctx.query.msg) data.msg = ctx.query.msg
data.countries = ['UK', 'Europe', 'World']
await ctx.render('register', data)
})

/**
* The script to process new user registrations.
@@ -144,4 +149,4 @@ module.exports = app.listen(port, async() => {
await db.run('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, user TEXT, pass TEXT);')
await db.close()
console.log(`listening on port ${port}`)
})
})
@@ -14,6 +14,11 @@
<form action="/register" enctype="multipart/form-data" method="post">
<p>Username:<br /><input type="text" name="user" placeholder="your preferred username (no spaces)" value=""></p>
<p>Password:<br /><input type="password" name="pass" placeholder="your chosen password" value=""></p>
<p>Nationality:<br /><select name="country">
{{#each countries}}
<option value="{{this}}">{{this}}</option>
{{/each}}
</select></p>
<p>Profile Picture:<br /><input type="file" name="avatar"></p>
<p><input type="submit" value="Create"></p>
</form>
@@ -0,0 +1,26 @@

<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>Create an Account</title>
<meta name="description" content="form to add new books">
<meta name="author" content="Mark Tyers">
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<h1>Create an Account</h1>
<form action="/register" enctype="multipart/form-data" method="post">
<p>Username:<br /><input type="text" name="user" placeholder="your preferred username (no spaces)" value=""></p>
<p>Password:<br /><input type="password" name="pass" placeholder="your chosen password" value=""></p>
<p>Nationality:<br /><select name="country">
{{#each countries}}
<option value="{{this}}">{{this}}</option>
{{/each}}
</select></p>
<p>Profile Picture:<br /><input type="file" name="avatar"></p>
<p><input type="submit" value="Create"></p>
</form>
</body>
</html>

0 comments on commit 0f21dc6

Please sign in to comment.