Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

username and E-Mail should be unique #1

Open
pmuens opened this issue May 9, 2016 · 2 comments
Open

username and E-Mail should be unique #1

pmuens opened this issue May 9, 2016 · 2 comments

Comments

@pmuens
Copy link
Owner

pmuens commented May 9, 2016

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

@bartonhammond
Copy link
Contributor

bartonhammond commented Jun 27, 2016

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
Copy link
Owner Author

pmuens commented Jun 28, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants