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

better code creation #17

Closed
boynet opened this issue Apr 25, 2017 · 10 comments
Closed

better code creation #17

boynet opened this issue Apr 25, 2017 · 10 comments

Comments

@boynet
Copy link

boynet commented Apr 25, 2017

Right now the code generator just uses Str::random(5) so there is a big chance of duplication

A lot of threads around the web about randomness also this one for laravel laravel/ideas#161

I think a good compromise would be to extract the code generator process into its own class, and give the user an option to override code generator, so if someone is looking for some more secure way can easily use something like uniqueid or some uuid library and add some more options like checking for existence (there is no simple way of generating random string in multiple machines and to make sure there is no duplication without checking the db first)

@m1guelpf
Copy link
Contributor

m1guelpf commented Apr 25, 2017

Maybe that could be temporally fixed by checking if a model already exists.

@clarkeash
Copy link
Owner

I am happy to add this, I am away at the moment but will get to it soon.

@necrogami
Copy link

I'd suggest a config type (string, uuid, etc) and a code length.

@m1guelpf
Copy link
Contributor

m1guelpf commented May 1, 2017

@necrogami Added an option to customize the code length in #19

@vaughany
Copy link

I'd be interested in helping with this. I'm keen to have a variable-length (or, at least, longer) invite code, but also (perhaps, and this is personal preference) codes generated along the lines of:

  • LLL-LLL (where L is a letter)
  • LLLL-LLLL
  • LLLN-LLLN (where L is a letter and N is a number)
  • LLNN-LLNN
  • LLLNNN
  • lowercasewordNNN (where N is a number)
  • lowercaseword-lowercaseword

I know these won't be to everyone's tastes but with the 'driver' system you mentioned, they could be potential choices.

@clarkeash
Copy link
Owner

I have a uuid implementation, have a few other things to do on doorman, but hoping to get this to you soon

@m1guelpf
Copy link
Contributor

@clarkeash Ping me if you need help!

@vesper8
Copy link

vesper8 commented Sep 5, 2017

looking forward to an update!

@clarkeash
Copy link
Owner

Hey Guys,

I have been holding off on this as I wanted to get a few other features into doorman, but that doesnt look like I am gonna be able to get those in just yet.

There is a UUID implementation committed, just go into config/doorman.php and set the driver to 'uuid', and thats it everything should work as normal.

I have not tagged a release yet, so it would be great if a few of you could pull in dev-master and give this a try before I tag 2.0.0

Sorry this has taken so long.

@clarkeash
Copy link
Owner

Hey, this is fixed. Sorry it took so long I havent had much time to work on open source lately.
I should be tagging 2.0 later today with this fix in (will require laravel 5.6 and php 7.1)

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

No branches or pull requests

6 participants