!! Reprint trouble First notify himself, thank you.
Recently in the design of a product, need to post login phpwind, but it is well known that PHPWIND9 (hereinafter referred to as PW9) own security policy, details you can go to phpwind the official forum to see. The presence of a security policy will cause the verification code to be displayed even if the webmaster shuts down the CAPTCHA policy (provided that the user retries too many times).
To post login, and do not need a verification code, you have to deal with this problem, but the official does not provide solutions, can only rely on their own processing.
The first thing to understand, Phpwind is not like many simple PHP programs are generally just simple page code placed in the corresponding file, every visit will call wekit.php, and then by Wekit call plug-ins, applications, services. Once the analysis is complete, we can solve the problem.
Login, login section, under Path. \src\applications\u\controller, from the file name is not difficult to recognize, logincontroller.php is used to log in the section (this part actually look at the English name to know)
At this time we posted a piece of code (I gave some notes later)
Public Function Run () {$this->setoutput ($this->_showverify (), ' verify ');//Verification Code display $this->setoutput (' User login ', ' Title '); Set the page title $this->setoutput ($this->_filterurl (false), ' URL '), $this->setoutput (pwuserhelper:: Getloginmessage (), ' Loginway '), $this->setoutput ($this->getinput (' invite '), ' invite '); $this->settemplate (' login '); Wind::import (' SRV:seo.bo.PwSeoBo '); $seoBo = Pwseobo::getinstance (); $lang = wind::getcomponent (' i18n '); $seoBo Setcustomseo ($lang->getmessage (' Seo:u.login.run.title '), ', '); Wekit::setv (' seo ', $seoBo);}
Obviously, first we need to block out the verification Code display section.
Will
$this->setoutput ($this->_showverify (), ' verify ');//Verification Code display
Modified into
$this->setoutput ($this->_showverify (), ' verify ');//Verification Code display
At this point, we completed the verification code display of the hidden, but to this step you will find if login, actually prompted the verification code error, so we need to further modify, so that more like no verification code, yes! We want to return verification code success regardless of how.
The verification code belongs to the service section (see the Official document for details), the file in the. \src\service\verify\srv, also according to the filename can be distinguished by the pwverifyservice.php is the main file to provide authentication code service.
This time I posted a piece of code (opportunity part of the content)
Public Function checkverify ($verifyType, $code = ") {return true;if ($code = =") return false;//if the verification code is empty, the error $types = $this->getverifytype (), if (!array_key_exists ($verifyType, $types)) return false; $verify = $types [$verifyType];if ( !isset ($verify [' Components '] [' path ']) return false, $obj = Wekit::load ($verify [' Components '] [' path ']); if ($obj- Checkverify ($code) = = = True) return True;return false;}
Here I give a simple rude, specific other methods not to say, want to study their own in-depth can.
Public Function checkverify ($verifyType, $code = ") {return true;//returns True immediately, returns the correct//if ($code = =") return false; $typ es = $this->getverifytype (), if (!array_key_exists ($verifyType, $types)) return false; $verify = $types [$verifyType]; if (!isset ($verify [' Components '] [' path ']) return false, $obj = Wekit::load ($verify [' Components '] [' path ']); if ($obj- >checkverify ($code) = = = True) return True;return false;}
At this point, the problem solved, enjoy the silky bar.
This article is from the "Weasely Weasel" blog, reproduced please contact the author!
PHPWind9.0 manual block Verification Code, resolve the background to close the verification code but still show the problem