Skip to content
Permalink
Browse files
fix linter errors
  • Loading branch information
czarniek committed Dec 2, 2019
1 parent 5089f9a commit 9d00ba2dc6781938bf163a6598a07bf21f1422a2
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 8 deletions.
@@ -189,15 +189,15 @@ router.post('/registeremail', koaBody, async ctx => {
// extract the data from the request
const body = ctx.request.body
// call the functions in the module
email = new User(dbName)
await email.registeremail(body.email, body.pass)
user = new User(dbName)
await user.registeremail(body.email, body.pass)
// await user.uploadPicture(path, type)
// redirect to the home page
ctx.redirect(`/?msg=new user "${body.email}" added`)
} catch(err) {
await ctx.render('error', {message: err.message})
} finally {
email.tearDown()
user.tearDown()
}
})

@@ -335,4 +335,4 @@ module.exports = app.listen(port, async() => console.log(`listening on port ${po

router.get('/registeremail', async ctx => {
await ctx.render('registeremail')
})
})
@@ -34,7 +34,7 @@ module.exports = class User {
return true
} catch(err) {
throw err
}
}
}

async registeremail(email, pass) {
@@ -43,15 +43,15 @@ module.exports = class User {
if(pass.length === 0) throw new Error('missing password')
let sql = `SELECT COUNT(id) as records FROM users WHERE emailaddress="${email}";`
const data = await this.db.get(sql)
if(data.records !== 0) throw new Error(`email "${user}" already in use`)
if(data.records !== 0) throw new Error(`email "${email}" already in use`)
pass = await bcrypt.hash(pass, saltRounds)
const userHash = Mailer.createHash(email)
sql = `INSERT INTO users(emailaddress, userHash, pass) VALUES("${email}","${userHash}", "${pass}")`
await this.db.run(sql)
return true
} catch(err) {
throw err
}
}
}

// async uploadPicture(path, mimeType) {
BIN +58.5 KB (1400%) public/images/excel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN +61.3 KB (2500%) public/images/pdf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN +18.7 KB (530%) public/images/powerpoint.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN -56.7 KB public/images/word.jpg
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -155,7 +155,7 @@
switch(fileType)
{
case "docx":
document.getElementById(fileName).src = '/images/word.jpg'
document.getElementById(fileName).src = '/images/word.svg'
break;
case "xlsx":
document.getElementById(fileName).src = '/images/excel.png'

0 comments on commit 9d00ba2

Please sign in to comment.