[3.2][3.3][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!
Anti-Spam Guide
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: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [3.2][RC] Random Password Generator

Post by 2600 »

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!£$%^[]&*?>]
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy »

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

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
User avatar
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [3.2][RC] Random Password Generator

Post by 2600 »

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?
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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: 1012
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری

Re: [3.2][RC] Random Password Generator

Post by Meis2M »

very nice extension this is has potential to add in phpBB core.
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy »

@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 / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
jemiNii
Registered User
Posts: 77
Joined: Mon Oct 05, 2015 3:46 am
Location: Los Angeles

Re: [3.2][RC] Random Password Generator

Post by jemiNii »

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: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: [3.2][RC] Random Password Generator

Post by mrgoldy »

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 / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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: 6767
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [3.2][RC] Random Password Generator

Post by HiFiKabin »

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
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][RC] Random Password Generator

Post by 3Di »

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
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades

Return to “Extensions in Development”