diff --git a/index.js b/index.js index 925f2cd..acfb59d 100644 --- a/index.js +++ b/index.js @@ -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') -}) \ No newline at end of file +}) diff --git a/modules/user.js b/modules/user.js index 3903c0d..92f2273 100644 --- a/modules/user.js +++ b/modules/user.js @@ -34,7 +34,7 @@ module.exports = class User { return true } catch(err) { throw err - } + } } async registeremail(email, pass) { @@ -43,7 +43,7 @@ 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}")` @@ -51,7 +51,7 @@ module.exports = class User { return true } catch(err) { throw err - } + } } // async uploadPicture(path, mimeType) { diff --git a/public/images/excel.png b/public/images/excel.png index 558a12d..314df47 100644 Binary files a/public/images/excel.png and b/public/images/excel.png differ diff --git a/public/images/pdf.png b/public/images/pdf.png index 061960c..c166efc 100644 Binary files a/public/images/pdf.png and b/public/images/pdf.png differ diff --git a/public/images/powerpoint.png b/public/images/powerpoint.png index 42e5832..4afe883 100644 Binary files a/public/images/powerpoint.png and b/public/images/powerpoint.png differ diff --git a/public/images/word.jpg b/public/images/word.jpg deleted file mode 100644 index d87f7c5..0000000 Binary files a/public/images/word.jpg and /dev/null differ diff --git a/public/images/word.svg b/public/images/word.svg new file mode 100644 index 0000000..87bc09b --- /dev/null +++ b/public/images/word.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/views/myfiles.handlebars b/views/myfiles.handlebars index 69e79e3..eebda81 100644 --- a/views/myfiles.handlebars +++ b/views/myfiles.handlebars @@ -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'