[3.2][RC] Random Password Generator

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Sun Apr 14, 2019 9:22 am

John connor wrote:
Sun Apr 14, 2019 8:31 am
<snip>
Okay, I'm code stupid, but I can understand that the characters used have to be between brackets [ ] How would I add those to the symbols that the script can pick from? Would there be any kind of mess up, or does it even matter so long as the symbols fall between brackets?
Yes we cross posted, I'll have a look at the styling error later.

If you want to add a new 'special character' just paste it at the end of the other special characters before the closing ] so for example you want to add a > to the string, the code would look like this

Code: Select all

	_pattern: /[a-zA-Z0-9!£$%^&*?>]/,
(I have not tested to see if > will work by the way, I just used it as an example)

Whatever you do, DO NOT break up the a-zA-Z0-9 part of the code

User avatar
John connor
Registered User
Posts: 2179
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: [3.2][RC] Random Password Generator

Post by John connor » Mon Apr 15, 2019 4:28 am

Okay. But my question was more on whether you could actually use a ] as an added symbol in the formation of a random password without it messing around with the open and close brackets that the letters and symbols are used in.

So would this work? [a-zA-Z0-9!£$%^[]&*?>]

User avatar
mrgoldy
Jr. Extension Validator
Posts: 1051
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy » Mon Apr 15, 2019 6:53 am

You’ll have to escape the closing bracket.
[a-zA-Z0-9!£$%^[\]&*?>]
phpBB Studio / ''Proud member of the Studio"

User avatar
John connor
Registered User
Posts: 2179
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: [3.2][RC] Random Password Generator

Post by John connor » Mon Apr 15, 2019 7:45 am

Bear with me, I'm code stupid and don't understand what it means by escaping. It looks like you have to format it like what you indicated in this way? [\] so the \ escapes it? What does escape really mean?

Actually, is that a fancy way of saying separation?

Now why wouldn't the \ become used?

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Mon Apr 15, 2019 8:27 am

To expand on what MrGoldy said. As the he code is starting with a [ it must also end with a ] so will 'see' the first one in comes across

ie

[a-zA-Z0-9!£$%^[]&*?>]

will be seen as

[a-zA-Z0-9!£$%^[]

adding the \ before the additional ] tells the JS coding that it is not a closing tag but a symbol to be used. Accordingly you can not use \ as a character in this password generator unless you also escape it. So to have a \ you need to have \\

In fact several of the characters already in the generator should have been escaped, and I forgot :oops: New version avaliable within the next 15 min or so.

For reference 9and in case you want to add any characters yourself) the following

Code: Select all

\ ^ $ * + ? . ( ) | { } [ ]")
should appear in the js file as

Code: Select all

\\ \^ \$ \* \+ \? \. \( \) \| \{ \} \[ \]

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Mon Apr 15, 2019 9:22 am

3.2.0-RC3 now available.

Bug Fix

Update from previous version:
  • Download the latest release and unzip it.
  • Disable Password Generator in the ACP
  • Delete password folder from the server
  • Upload the folder hifikabin to root/ext/
  • Enable it in the ACP

User avatar
Meis2M
Translator
Posts: 874
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: [3.2][RC] Random Password Generator

Post by Meis2M » Mon Apr 15, 2019 12:13 pm

very nice extension this is has potential to add in phpBB core.
phpBB persian international support
Ultimate SEO Friendly URL - Extension
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM

User avatar
mrgoldy
Jr. Extension Validator
Posts: 1051
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy » Mon Apr 15, 2019 6:20 pm

@Hifi
Nothing needs escaping inside a character set [], except the actual ] sign. All characters inside a character set are taken as literals. Apart from the closing bracket and the dash between a-z, A-Z and 0-9.

I personally always use https://regexr.com/
phpBB Studio / ''Proud member of the Studio"

jemiNii
Registered User
Posts: 76
Joined: Mon Oct 05, 2015 3:46 am
Location: Los Angeles
Contact:

Re: [3.2][RC] Random Password Generator

Post by jemiNii » Tue Apr 16, 2019 3:00 am

I noticed that if you have special characters as a requirement in PHPBB then not all of the codes generated are valid - it only adds a special character sometimes. Maybe add option to always include one for those of us with that requirement.

Thanks for the extensions - great idea!


- jemiNii

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Tue Apr 16, 2019 9:29 am

mrgoldy wrote:
Mon Apr 15, 2019 6:20 pm
@Hifi
Nothing needs escaping inside a character set [], except the actual ] sign. All characters inside a character set are taken as literals. Apart from the closing bracket and the dash between a-z, A-Z and 0-9.

I personally always use https://regexr.com/
Thanks. I always get totally confused with JS :oops:

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Tue Apr 16, 2019 9:32 am

jemiNii wrote:
Tue Apr 16, 2019 3:00 am
I noticed that if you have special characters as a requirement in PHPBB then not all of the codes generated are valid - it only adds a special character sometimes. Maybe add option to always include one for those of us with that requirement.

Thanks for the extensions - great idea!


- jemiNii
I am not sure how easy (or not) that would be to implement. I will investigate further

User avatar
mrgoldy
Jr. Extension Validator
Posts: 1051
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy » Tue Apr 16, 2019 12:41 pm

You can check if any of the characters is in the generated password, if not, generate a new one.

Code: Select all

do 
{ 
    $password = generate_pass();
} 
while (strpbrk($password, ‘^*+=%’) === false);
Or something of the sorts. Or see how the core checks if a password meets the rquirements.
Perhaps make a build in escape that it can only run a maximum of 5-10 times or something like that.

Good luck :+1:
phpBB Studio / ''Proud member of the Studio"

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Tue Apr 16, 2019 3:14 pm

Thanks for that. I'll look into that but I think I have found a better code to start from (yes, I tend to 'borrow' other peoples good ideas)

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 3998
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin » Fri Apr 19, 2019 6:55 am

3.2.0-RC4 now available.

The generated password is now created from at least one each of the following:-
  • Upper Case Letters.
  • Lower Case Letters.
  • Numbers 0-9
  • 18 "special characters"
Update from previous version:
  • Download the latest release and unzip it.
  • Disable Password Generator in the ACP
  • Delete password folder from the server
  • Upload the folder hifikabin to root/ext/
  • Enable it in the ACP

User avatar
3Di
Former Team Member
Posts: 13905
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][RC] Random Password Generator

Post by 3Di » Fri Apr 19, 2019 6:54 pm

Hi James.
It makes me think, not having read the code, if and how the generated passwords obey the roles assigned in ACP?

I guess there's no problem if these are "No requirements".
See: ACP / User registration settings / Password complexity and Password length
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Post Reply

Return to “Extensions in Development”