• Resolved Better Studio

    (@betterstudio)


    Hi dear,
    You plugin is awesome but we found a simple problem in your problem that currently mades some login problem for our authors.
    When we have both login and reset pass forms in one page the JS of login protector is not work correctly because of variable scope.

    Please change codes of “wp-simple-firewall/src/processors/loginprotect_gasp.php” line 120:146 to following code to resolve variable scope problem (variable should be unique for each form)

    $sHtml =
    				$sStyles.
    				'<p id="'.$sUniqElem.'" class="icwpImHuman_'.$sUniqId.'"></p>
    			<script type="text/javascript">
    				var icwp_wpsf_login_p'.$sUniqElem.'		= document.getElementById("'.$sUniqElem.'");
    				var icwp_wpsf_login_cb'.$sUniqElem.'		= document.createElement("input");
    				var icwp_wpsf_login_lb'.$sUniqElem.'		= document.createElement("label");
    				var icwp_wpsf_login_text'.$sUniqElem.'	= document.createTextNode(" '.$sLabel.'");
    				icwp_wpsf_login_cb'.$sUniqElem.'.type		= "checkbox";
    				icwp_wpsf_login_cb'.$sUniqElem.'.id		= "'.$this->getGaspCheckboxName().'";
    				icwp_wpsf_login_cb'.$sUniqElem.'.name		= "'.$this->getGaspCheckboxName().'";
    				icwp_wpsf_login_p'.$sUniqElem.'.appendChild( icwp_wpsf_login_lb'.$sUniqElem.' );
    				icwp_wpsf_login_lb'.$sUniqElem.'.appendChild( icwp_wpsf_login_cb'.$sUniqElem.' );
    				icwp_wpsf_login_lb'.$sUniqElem.'.appendChild( icwp_wpsf_login_text'.$sUniqElem.' );
    				var frm = icwp_wpsf_login_cb'.$sUniqElem.'.form;
    
    				frm.onsubmit = icwp_wpsf_login_it'.$sUniqElem.';
    				function icwp_wpsf_login_it'.$sUniqElem.'(){
    					if(icwp_wpsf_login_cb'.$sUniqElem.'.checked != true){
    						alert("'.$sAlert.'");
    						return false;
    					}
    					return true;
    				}
    			</script>
    			<noscript>'._wpsf__('You MUST enable Javascript to be able to login').'</noscript>
    			<input type="hidden" id="icwp_wpsf_login_email" name="icwp_wpsf_login_email" value="" />
    		';
    

    Thanks for your efforts and keep doing good.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Paul

    (@paultgoodchild)

    Great, good catch. Should have this in for the next release.
    Thanks for the providing the resolution too… huge help.

    Thread Starter Better Studio

    (@betterstudio)

    Your welcome ??
    Your plugin is powerful and handy ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Login protector problem when both Login and Reset password forms are in page’ is closed to new replies.