PHPWind9.0 Manual Shield Verification Code solves the problem that the background closes the authentication code but still displays _php instance

Source: Internet
Author: User

Recently in the design of a product, need post login phpwind, however, as we all know, 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 causes the authentication code to appear even if the webmaster shutdown policy is still logged (provided that the user retries too many times).

To post a login and do not need a CAPTCHA, you have to deal with this problem, but the authorities do not provide a solution, can only rely on their own processing.

First of all to understand that phpwind is not like many simple PHP program is generally simply the page code placed in the corresponding file, each visit will call the wekit.php, and then by the Wekit invoke Plug-ins, applications, services. Once the analysis is complete, we can solve the problem.

Login, login section, in the path. \src\applications\u\controller, from the filename is not difficult to recognize, logincontroller.php is used for the login part (this part actually looks at the English name to see to know)
This time we posted a code (I gave some notes later)

The public Function run () {
$this->setoutput ($this->_showverify (), ' verify '), and/or the verification code shows
$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 screen out the Verification Code display section.

Will

$this->setoutput ($this->_showverify (), ' verify ')//Verify code display

Modified into

$this->setoutput ($this->_showverify (), ' verify ')//Verify code display

At this point, we completed the verification code display hidden, but to this step if you login will find, incredibly prompt verification code error, so we need to further modify, make more like no verification code, yes! We want to return the verification code successfully regardless of how.

The verification code belongs to the service section (see the Official document for details), the file is in. \src\service\verify\srv, and the pwverifyservice.php is the primary file that provides the authentication code service by the filename.

This time I posted a piece of code (the opportunity part of the note content)

Public Function checkverify ($verifyType, $code = ' ") {return
true;
if ($code = = ") return false;//if the verification code is empty, returns a validation code 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 rough, concrete other methods do not say more, want to study oneself depth can.

The Public Function checkverify ($verifyType, $code = ") {
return true;//directly returns TRUE, returns the verification code correct
//if ($code = =") return false;
$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;
}

So far, the problem has been solved.

The above is a small set to introduce the PHPWind9.0 manual shielding verification code to solve the background to close the verification code but still show the problem, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.