discuss icon indicating copy to clipboard operation
discuss copied to clipboard

username and E-Mail should be unique

Open pmuens opened this issue 9 years ago • 2 comments

Right now two users with the same username and E-Mail can co-exists. This should not be possible!

pmuens avatar May 09 '16 16:05 pmuens

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?

bartonhammond avatar Jun 27 '16 22:06 bartonhammond

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.

pmuens avatar Jun 28 '16 04:06 pmuens