username and E-Mail should be unique
Opened this issue · 2 comments
pmuens commented
Right now two users with the same username and E-Mail can co-exists. This should not be possible!
bartonhammond commented
Any update on this? I've tried reading through the Cloudformation docs and can't figure out why it's not working the way it is defined now.
Is it possible to update the resolve.js
method signUp
to first call perform the query:
return db('query', {
TableName: usersTable,
IndexName: 'emailIndex',
KeyConditionExpression: 'email = :email',
ProjectionExpression: 'id, username, email, password, createdAt, updatedAt',
ExpressionAttributeValues: {
':email': email
}
to determine if the email already exists?
pmuens commented
Yes. We could try to look for an existing user before the actual signUp
request. But this would mean that we have two queries which have to be performed whenever a user wants to sign up.
Not sure if SecondaryIndexes could also be used to do a ConditionExpression
. This way we could get rid of the two queries approach.