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

Bugfix: set username to random string if missing in RestWrite #341

Merged
merged 3 commits into from
Feb 11, 2016
Merged

Bugfix: set username to random string if missing in RestWrite #341

merged 3 commits into from
Feb 11, 2016

Conversation

steven-supersolid
Copy link
Contributor

No description provided.

@gfosco
Copy link
Contributor

gfosco commented Feb 11, 2016

Can you add a test which checks this and makes 2 anon users?

@facebook-github-bot
Copy link

@steven-supersolid updated the pull request.

@steven-supersolid
Copy link
Contributor Author

I added a test but have a couple of questions on this:

  • User signup tests seem to be in RestCreate.spec but call rest js so not following the same name convention - is this the convention?
  • Merely creating two anonymous users would not fail the test in the original code, also need to check username uniqueness - so should this be tested somewhere else?

@drew-gross
Copy link
Contributor

Most of the existing tests are ported from older code, and while their location might have made sense at the time, they aren't necessarily using great conventions right now, so please don't feel obliged to stick to the existing convention.

There was a bug where creating a second anonymous user would fail due the unique username check and them both having a username of '' but this diff should fix that. The test is to make sure that it is fixed.

@facebook-github-bot
Copy link

@steven-supersolid updated the pull request.

drew-gross added a commit that referenced this pull request Feb 11, 2016
Bugfix: set username to random string if missing in RestWrite
@drew-gross drew-gross merged commit c66cc8d into parse-community:master Feb 11, 2016
var chars = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz' +
'0123456789');
var objectId = '';
var bytes = crypto.randomBytes(10);
var bytes = crypto.randomBytes(size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the modulo bias, we could chars+chars+chars+chars + 8 random.

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

Successfully merging this pull request may close these issues.

5 participants