[RC2] Password Generator JS

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
Locked
User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

My file ucp_profile_pwd_generator.html now looks like this:

Code: Select all

<!-- v1.0.0 13:00 22/01/2012 Geolim4 Exp $ -->

		
<div class="rules" id="ucppwdgenpopup">
<div class="inner"><span class="corners-top"><span></span></span>
<center> 
	<script type="text/javascript">
// <![CDATA[
	function GiveRandomNum(Minimum, Maximum){return (Math.floor(Math.random() * (Maximum - Minimum)) + Minimum)}
	var Ajaxtimeout = 600; 
	/*Var Temp for avoid possible overload request to server with some Mods like "Breizh Ajax Check",
	increase it if you have some difficulty with them, avoid more 1000 because this number will be doubled pending the AjaxTemp function
	Default 600 (fine for normal server), set 800 for low server ;) */
	function GenerateRandChar(Numbers, CharsMin, CharsMax, Others){
		var TheNumbers = "0123456789", TheMinChars = "abcdefghijklmnopqrstuvwxyz", TheMaxChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", TheOthers = "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?", StringChars = "";
		if (Numbers == true)	  	StringChars += TheNumbers;
		if (CharsMin == true) 		StringChars += TheMinChars;
		if (CharsMax == true) 		StringChars += TheMaxChars;
		if (Others == true)     	StringChars += TheOthers;
		return StringChars.charAt(GiveRandomNum(0, StringChars.length));
	}
	function GenPassword(GPlenght,GPnextNumbers,GPnextMinChars,GPnextMaxChars, GPnextOthers){
		document.getElementById('formgenerator').longpswd.value	= GPlenght;
		if (GPlenght < {S_MIN_PASS_CHARS}){
			GPlenght = {S_MID_PASS_CHARS}; //Respect the board configuration please ;)
			document.getElementById('formgenerator').longpswd.value = {S_MID_PASS_CHARS}; //And force to use the board configuration too :D
		}
		if (GPlenght > {S_MAX_PASS_CHARS}){
			GPlenght = {S_MID_PASS_CHARS}; //Respect the board configuration please ;)
			document.getElementById('formgenerator').longpswd.value = {S_MID_PASS_CHARS}; //And force to use the board configuration again :D
		}		
		var GPresults = "";
		if (GPlenght > 0) GPresults = GenerateRandChar(GPnextNumbers,GPnextMinChars,GPnextMaxChars,GPnextOthers);
		for (var i = 1; i < GPlenght; ++i){GPresults = GPresults + GenerateRandChar(GPnextNumbers,GPnextMinChars,GPnextMaxChars,GPnextOthers)}
		if (check_required_chars(GPresults, false) ){
			return GPresults;
		}else{
			return GenPassword(document.getElementById('formgenerator').longpswd.value,document.getElementById('formgenerator').GPnextNumbers.checked,document.getElementById('formgenerator').GPnextMinChars.checked,document.getElementById('formgenerator').GPnextMaxChars.checked,document.getElementById('formgenerator').GPnextOthers.checked);
		}
	}

	function Generate(){
		if (document.getElementById('formgenerator').GPnextNumbers.checked == false && document.getElementById('formgenerator').GPnextMinChars.checked == false && document.getElementById('formgenerator').GPnextMaxChars.checked == false && document.getElementById('formgenerator').GPnextOthers.checked == false){
			alert('{L_UCP_GENERATE_PWD_CHECKBOX}'); //Hello kitty i'm empty!! *sad_face*!!
			return false; //Empty? Die !!
		}	
		document.getElementById('formgenerator').pwdgenerated.value = GenPassword(document.getElementById('formgenerator').longpswd.value,document.getElementById('formgenerator').GPnextNumbers.checked,document.getElementById('formgenerator').GPnextMinChars.checked,document.getElementById('formgenerator').GPnextMaxChars.checked,document.getElementById('formgenerator').GPnextOthers.checked);
	}
	function SendInForm1(password){
		if(password == ''){
			alert('{L_UCP_GENERATE_PWD_EMPTYPWD}'); //Hello kitty i'm empty!! *sad_face*!!
			return false; //Empty? Die !!
		}if(password.length < {S_MIN_PASS_CHARS}){
			alert('{L_UCP_GENERATE_PWD_SHORTPWD}'); //Hello kitty i'm too short!! *sad_face*!!
			return false; //Empty? Die !!
		}if(password.length > {S_MAX_PASS_CHARS}){
			alert('{L_UCP_GENERATE_PWD_BIGPWD}'); //Hello kitty i'm too big!! *sad_face*!!
			return false; //Empty? Die !!
		}if ( check_required_chars(password, true) ){
			if ( confirm('{LA_UCP_GENERATE_PWD_SAVED}') ){
             /*setTimeout(function (){
               if (typeof jQuery == 'undefined'){
                  dE('ucppwdgenpopup',1,'none');
               }else{
                  $('#ucppwdgenpopup').hide('slow');
               }
            }, 100);*/
				document.getElementsByName('new_password')[0].value = password;
				document.getElementsByName('password_confirm')[0].value = password;
				/* /!\ Now we will start a fast compatibility trick for Breizh Ajax Check */
				if(typeof(sndReq) == 'function'){
					sndReq('passwordcur','password1',document.getElementsByName('new_password')[0].value,'ignore','ignore');
					setTimeout(function(){
						sndReq('passwordcheck','password1',document.getElementsByName('new_password')[0].value,'password2',document.getElementsByName('password_confirm')[0].value); 
						setTimeout(function(){
							sndReq('strength','password1',document.getElementsByName('new_password')[0].value,'ignore','ignore')
						}, Ajaxtimeout);
					}, Ajaxtimeout);
				}	document.getElementById('pwdgenerated').value = '';//reset temp field...
			}
		}
	}
	function check_required_chars(data, user_alert){
		<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ANY' -->
		return true;
		<!-- ELSE -->
		var regA = /[0-9]+/, regB = /[a-z]+/, regC = /[A-Z]+/, regD = /[!@#$%`'<\-()_=,:;.>\/\[\]?+\\"{}|~^&*]+/;
		if (<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' -->regA.test(data) && regB.test(data)<!-- ENDIF --><!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --> && regC.test(data)<!-- ENDIF --><!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --> && regD.test(data)<!-- ENDIF -->){
			return true;
		}else{
			user_alert ? alert(data + '{LA_UCP_GENERATE_PWD_BAD}') : '';
			return false;
		}
	<!-- ENDIF -->
	}
// ]]>
	</script>
	<span id="dragme"></span><!-- drag party :D-->
	<span id="closepwngen"></span><!-- close enought :D-->
	<span class="close_genpopup" onclick="dE('ucppwdgenpopup',1,'none');">[X]</span>
	<form id="formgenerator" action="javascript:void(0);">
		<fieldset>
			<h4 class="pwdgenerator">{L_UCP_GENERATE_GENRATOR}</h4>
			<h4 class="pwdgenerator">{L_UCP_GENERATE_PWD_CAN}:</h4>
				<input type="checkbox" name="GPnextNumbers"<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --> disabled="disabled" checked="checked"<!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ANY' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' --> checked="checked"<!-- ENDIF -->/><span class="bd_is_separator"></span>{L_UCP_GENERATE_PWD_NUMBERS}<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' --><span id="gpnextnumbers"> {L_UCP_GENERATE_PWD_REQUIRED}</span><!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --><span id="gpnextnumbers"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ENDIF --><br />
				<input type="checkbox" name="GPnextMinChars"<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --> disabled="disabled" checked="checked"<!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ANY' --> checked="checked"<!-- ENDIF -->/><span class="bd_is_separator"></span>{L_UCP_GENERATE_PWD_MINC}<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' --><span id="gpnextminchars"> {L_UCP_GENERATE_PWD_REQUIRED}</span><!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' --><span id="gpnextminchars"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --><span id="gpnextminchars"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ENDIF --><br />
				<input type="checkbox" name="GPnextMaxChars"<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' --> disabled="disabled" checked="checked"<!-- ENDIF -->/><span class="bd_is_separator"></span>{L_UCP_GENERATE_PWD_MAXC}<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_CASE' or PWDGEN_PASS_COMPLEX == 'PASS_TYPE_ALPHA' --><span id="gpnextmaxchars"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ELSEIF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --><span id="gpnextmaxchars"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ENDIF --><br />
				<input type="checkbox" name="GPnextOthers"<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --> disabled="disabled" checked="checked"<!-- ENDIF -->/><span class="bd_is_separator"></span>{L_UCP_GENERATE_PWD_SPEC}<!-- IF PWDGEN_PASS_COMPLEX == 'PASS_TYPE_SYMBOL' --><span id="gpnextothers"> ({L_UCP_GENERATE_PWD_REQUIRED})</span><!-- ENDIF --><br />

			<h4 class="pwdgenerator">{L_UCP_GENERATE_PWD_CHARSNUMB}:</h4>
				<input type="text" class="inputbox" value="{S_MID_PASS_CHARS}" name="longpswd"/>
				<p id="cssgeneratepwd"><!-- IF S_USER_LOGGED_IN -->{L_CHANGE_PASSWORD_EXPLAIN}<!-- ELSE -->{L_PASSWORD_EXPLAIN}<!-- ENDIF --></p>
				<input type="button" class="button1" onclick="Generate()" value="{L_UCP_GENERATE_PWD_GENERATE}" />&nbsp;
				<input type="button" class="button1" onclick="SendInForm1(document.getElementById('pwdgenerated').value);" value="{L_UCP_GENERATE_PWD_SENDINFORM}" id="sendinform" /><br />
				<hr class="dashed"/>
				<p>{L_UCP_GENERATE_PWD_GENERATED}:<span class="bd_is_separator"></span><span id="pwddblclick"> ({L_UCP_GENERATE_PWD_DBLCLICK})</span></p>
				<input type="text" class="inputbox" id="pwdgenerated" name="pwdpassword" ondblclick="this.select()"/>
		</fieldset>
	</form>
</center> 
<span class="corners-bottom"><span></span></span></div>
</div> 



User avatar
Geolim4
Former Team Member
Posts: 1965
Joined: Sat Sep 11, 2010 3:28 pm
Location: Nantes, France
Name: Georges
Contact:

Re: [RC1] Password Generator JS

Post by Geolim4 »

Sry, i really does not understand what you mean :roll:
I'll work on the new version of an other MOD..
phpBB-fr Former MOD Team Leader / Website Team Member

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Image
Last edited by Pthelovod on Wed Jan 30, 2013 12:41 pm, edited 1 time in total.

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Image


Image


Image

User avatar
Geolim4
Former Team Member
Posts: 1965
Joined: Sat Sep 11, 2010 3:28 pm
Location: Nantes, France
Name: Georges
Contact:

Re: [RC1] Password Generator JS

Post by Geolim4 »

I don't know how you can have this result :shock: :shock:

That is the normal result:
Image
phpBB-fr Former MOD Team Leader / Website Team Member

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Oh! I put your file and earned! I was stupid and that would have earned me the modified file ucp_profile_pwd_generator.html
I did show up.
Sorry to bother you.

User avatar
Geolim4
Former Team Member
Posts: 1965
Joined: Sat Sep 11, 2010 3:28 pm
Location: Nantes, France
Name: Georges
Contact:

Re: [RC1] Password Generator JS

Post by Geolim4 »

^$""~²~^@$** nuuub :!: :|
Anyway i'm very sick since yesterday so i'll probably wont be active for few day :evil:











:mrgreen:
phpBB-fr Former MOD Team Leader / Website Team Member

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Sorry, but the unit does not appear on the screen. What to do?
Image

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Fixed!

User avatar
Geolim4
Former Team Member
Posts: 1965
Joined: Sat Sep 11, 2010 3:28 pm
Location: Nantes, France
Name: Georges
Contact:

Re: [RC1] Password Generator JS

Post by Geolim4 »

I'm tired...
I'll go sleep...
Use the Opera's debugger/Firebug for Firefox and try to play with the CSS attribute "position" :cry:
No other idea for now sorry...
Sweet night
phpBB-fr Former MOD Team Leader / Website Team Member

User avatar
Pthelovod
Registered User
Posts: 106
Joined: Mon Feb 22, 2010 1:32 am
Location: Россия
Name: Alexs Pthelovod
Contact:

Re: [RC1] Password Generator JS

Post by Pthelovod »

Good night! Sweet dreams! I like your changes! :D

User avatar
mladiucitelj
Registered User
Posts: 586
Joined: Sun Dec 12, 2010 12:33 am
Location: Slovenia, Europe

Re: [RC1] Password Generator JS

Post by mladiucitelj »

geolim4 wrote:
mladiucitelj wrote:One more thing:

Forbidden Passwords (Addon for Breizh Ajax Check 1.3.0) is not working now!

One of my forbidden password is abc123, but I have to confirm form to get notice it's a forbidden password. So addon is not working, I guess.
It's probably a missing config entry in your board...
Do you have access to phpmyadmin ?
Yes, I have.
Don't forget to clear cache, refresh template, theme and imageset, double check all files :)

My mod: [MODDB] Menu System

User avatar
martin123456
I've Been Banned!
Posts: 726
Joined: Sat Mar 05, 2011 7:44 pm

Re: [RC1] Password Generator JS

Post by martin123456 »

Works perfect ;)

Code: Select all

<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->

User avatar
keith10456
Registered User
Posts: 2315
Joined: Thu Feb 24, 2005 6:55 pm
Contact:

Re: [RC1] Password Generator JS

Post by keith10456 »

Very good and useful mod ;)

User avatar
Geolim4
Former Team Member
Posts: 1965
Joined: Sat Sep 11, 2010 3:28 pm
Location: Nantes, France
Name: Georges
Contact:

Re: [RC1] Password Generator JS

Post by Geolim4 »

mladiucitelj wrote:
geolim4 wrote:
mladiucitelj wrote:One more thing:

Forbidden Passwords (Addon for Breizh Ajax Check 1.3.0) is not working now!

One of my forbidden password is abc123, but I have to confirm form to get notice it's a forbidden password. So addon is not working, I guess.
It's probably a missing config entry in your board...
Do you have access to phpmyadmin ?
Yes, I have.
So add that and purge your cache:

Code: Select all

INSERT INTO `phpbb_config`(`config_name`, `config_value`, `is_dynamic`) VALUES ('fp_mod_bzh_addon', 1, 0)
phpBB-fr Former MOD Team Leader / Website Team Member

Locked

Return to “[3.0.x] MODs in Development”