[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!
Ideas Centre
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 »

What do I need to change, that would be in the center of the personal Generator window to appear exactly in the center of the monitor? Window appears at the bottom. I tried everything I could, but my brain works can be seen in the wrong direction. Sorry for bad English.
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 »

New version coming soon...
phpBB-fr Former MOD Team Leader / Website Team Member
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:
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)
WORKS!

Thank you very much for your time!
geolim4 wrote:New version coming soon...
Wonder what are new features... ;)
Don't forget to clear cache, refresh template, theme and imageset, double check all files :)

My mod: [MODDB] Menu System
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 »

No new feature, better compatibility with others mod, code cleaning, better namespace, reducing addons modifications, better CSS for Opera/IE :)
phpBB-fr Former MOD Team Leader / Website Team Member
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 »

Great! :)
Don't forget to clear cache, refresh template, theme and imageset, double check all files :)

My mod: [MODDB] Menu System
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 »

In the plan the only one way to enable the addons is in javascript file: http://images.geolim4.com/image/5B :D
phpBB-fr Former MOD Team Leader / Website Team Member
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:In the plan the only one way to enable the addons is in javascript file: http://images.geolim4.com/image/5B :D
Don't know what you've said, but I hope it'll work on my board :)
Don't forget to clear cache, refresh template, theme and imageset, double check all files :)

My mod: [MODDB] Menu System
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 »

sure it'll work 8-)
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 »

geolim4 wrote:New version coming soon...
О-о_О!!!! :!:
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 »

Yes just let me the time to update UCP My Sessions before...
I'm working on a better Javascript code 8-)
phpBB-fr Former MOD Team Leader / Website Team Member
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 »

http://livetest.geolim4.com/ucp.php?i=p ... e=register

You can test the drag and drop and resize effect with Jquery in waiting the update (don't register for real, i'll wont approve new accounts, just try generator) 8-) 8-)
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 »

Very cute. And, too, the first code is the delay of the test Breizh Ajax Checks v1.3.0..
Although it is almost irrelevant. :!:
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 »

This is normal, we need to set a delay between both field checking !!!
Otherwise the server will abort the query !
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 »

All of the center. The original and the translation into Russian :oops:

ucp_profile_pwd_generator.html

Code: Select all

<!-- v1.0.0 13:00 22/01/2012 Geolim4 Exp $ -->
<div class="rules ucpboxpwdgenerator" id="ucppwdgenpopup" align="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>
			<h3 class="pwdgenerator">{L_UCP_GENERATE_GENRATOR}</h3>
			<h3 class="pwdgenerator">{L_UCP_GENERATE_PWD_CAN}:</h3>
				<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 -->
				<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 -->
				<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 -->
				<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 />

			<h3 class="pwdgenerator">{L_UCP_GENERATE_PWD_CHARSNUMB}:</h3>
				<input type="text" class="inputbox3" 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>
</div>
ucp_pwd_js.css

Code: Select all

h3.pwdgenerator {
    text-align: center;
}

div.ucpboxpwdgenerator {
	position: fixed;
	z-index:10; /*Opera isn't an human browser*/
	margin: 0 0;
	padding: 6px;
	font-size: inherit;
	border: 1px solid #FFCDCD;
	border-radius: 8px 8px;
	box-shadow: 1px 1px 6px 10px #515151;
	display: none;
	left: 30%;
	min-height: 280px; /*Avoid some browser to reduse w/y*/
	min-width: 450px;
	max-height: 450px;/*Opera and IE isn't an human browser too*/
	max-width: 650px;		
}

span.bd_is_separator{
   margin:0px 0px 0px 10px;/*&nbsp; suck...*/
} 

span.close_genpopup{
display:none;/**comment these line to disable jquery icon*/
   float: right;
   cursor: pointer;
   font-size: 1.5em;
}

#cssgeneratepwd, #gpnextnumbers, #gpnextminchars, #gpnextmaxchars, #gpnextothers, #pwddblclick {
   font-size: 0.8em;
   font-style: italic;
}

#closepwngen{
   position: absolute;
   margin: 5px 0 5px 0; 
   width: 24px; 
   height:24px; 
   background: url("{T_THEME_PATH}/images/dragpwdgen.png") no-repeat top right;
   top:-5px;
   right:0px;
   cursor:pointer;
   /*display:none;*//**uncomment these line to disable jquery icon*/
}

#dragme {
   position:absolute;
   margin: -5px 0 -5px 0; 
   width: 24px; 
   height:24px;
   cursor: move; 
   background: url("{T_THEME_PATH}/images/dragpwdgen.png") no-repeat top left;
   top:5px;
   left:0px;
   /*display:none;*//**uncomment these line to disable jquery icon*/
}
Russian

Code: Select all

<?php
/**
*
* info_ucp_pwd_js [Russian]
* @package ucp Password Generator JS
* @version $Id: info_ucp_pwd_js.php v1.0.0 13:00 22/01/2012 Geolim4 Exp $ 
* @copyright (c) 2012 Geolim4.com  http://Geolim4.com
* @package language
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
// Some characters you may want to copy&paste:
// ’ » “ ” …
// Use: <strong style="color:green">Texte</strong>',
//For add Color
//
$lang = array_merge($lang, array(
	//Password generator BOX
	'UCP_GENERATE_PWD_CPOPUP'		=> 'Закрыть окно',
	'UCP_GENERATE_GENRATOR'			=> 'Генератор паролей (создание новых паролей автоматически)',
	'UCP_GENERATE_PWD'				=> 'Сгенерировать пароль?',
	'UCP_GENERATE_PWD_BAD'			=> ' не содержит необходимых символов!',
	'UCP_GENERATE_PWD_NUMBERS'		=> 'Чисел (цифр)',
	'UCP_GENERATE_PWD_MINC'			=> 'Нижнего регистра',
	'UCP_GENERATE_PWD_MAXC'			=> 'Верхнего регистра',
	'UCP_GENERATE_PWD_SPEC'			=> 'Спецсимволов',
	'UCP_GENERATE_PWD_CAN'			=> 'Для усиления сложности пароля укажите из каких символов он должен быть',
	'UCP_GENERATE_PWD_CHARSNUMB'	=> 'Необходимое количество знаков в пароле (в указанном диапазоне)',
	'UCP_GENERATE_PWD_GENERATE'		=> 'Нажмите здесь для создание пароля',
	'UCP_GENERATE_PWD_GENERATED'	=> 'В этой строке появится созданный пароль ',
	'UCP_GENERATE_PWD_SENDINFORM'	=> 'Добавить созданный пароль в обе формы заполнения?',
	'UCP_GENERATE_PWD_REQUIRED'		=> 'Настройки только для единственного прочтения.',
	'UCP_GENERATE_PWD_EMPTYPWD'		=> 'Пароль не введен!',
	'UCP_GENERATE_PWD_SHORTPWD'		=> 'Пароль слишком короткий!',
	'UCP_GENERATE_PWD_BIGPWD'		=> 'Пароль слишком большой!',
	'UCP_GENERATE_PWD_CHECKBOX'		=> 'Любой разрешенный символ!',
	'UCP_GENERATE_PWD_DBLCLICK'		=> ' для выделения пароля щелкните на нем дважды',
	'UCP_GENERATE_PWD_SAVED'		=> 'Внимание!!! Сейчас Ваш пароль исчезнет и больше вы его не увидите! Если вы не сохранили пароль, нажмите "Отмена", скопируйте пароль и затем нажмите на кнопку "Добавить созданный пароль в обе формы заполнения?" Сохраните полученный пароль в надежном месте.',
));	

?>
Image

:oops: :oops: :oops:
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 »

Thanks for russian translation, i'll send you the next version by PM for translate 5key added since previous version 8-)
phpBB-fr Former MOD Team Leader / Website Team Member
Locked

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