email fix

This commit is contained in:
xfarrow 2024-02-21 14:49:03 +01:00
parent b1e41237a4
commit 81dc61fd1f
2 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ const bcrypt = require('bcrypt');
*/ */
function createPerson(email, password, display_name, date_of_birth, available, enabled, place_of_living) { function createPerson(email, password, display_name, date_of_birth, available, enabled, place_of_living) {
const person = { const person = {
email: email, email: email.toLowerCase(),
password: password, password: password,
display_name: display_name, display_name: display_name,
date_of_birth: date_of_birth, date_of_birth: date_of_birth,
@ -45,7 +45,7 @@ function createPerson(email, password, display_name, date_of_birth, available, e
*/ */
async function getPersonByEmail(email){ async function getPersonByEmail(email){
return await knex('Person') return await knex('Person')
.where('email', email) .where('email', email.toLowerCase())
.first(); .first();
} }
@ -73,7 +73,7 @@ async function registerPerson(person, activationLink){
await knex.transaction(async (tr) => { await knex.transaction(async (tr) => {
const personIdResult = await tr('Person') const personIdResult = await tr('Person')
.insert({ .insert({
email: person.email, email: person.email.toLowerCase(),
password: person.password, password: person.password,
display_name: person.display_name, display_name: person.display_name,
date_of_birth: person.date_of_birth, date_of_birth: person.date_of_birth,
@ -99,7 +99,7 @@ async function registerPerson(person, activationLink){
*/ */
async function getPersonByEmailAndPassword(email, password){ async function getPersonByEmailAndPassword(email, password){
const person = await knex('Person') const person = await knex('Person')
.where('email', email) .where('email', email.toLowerCase())
.where('enabled', true) .where('enabled', true)
.select('*') .select('*')
.first(); .first();