enwikipedia-acc /
waca
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /****************************************************************************** |
||
| 3 | * Wikipedia Account Creation Assistance tool * |
||
| 4 | * * |
||
| 5 | * All code in this file is released into the public domain by the ACC * |
||
| 6 | * Development Team. Please see team.json for a list of contributors. * |
||
| 7 | ******************************************************************************/ |
||
| 8 | |||
| 9 | namespace Waca\Pages\UserAuth\Login; |
||
| 10 | |||
| 11 | use Waca\Exceptions\ApplicationLogicException; |
||
| 12 | use Waca\WebRequest; |
||
| 13 | |||
| 14 | class PagePasswordLogin extends LoginCredentialPageBase |
||
| 15 | { |
||
| 16 | protected function providerSpecificSetup() |
||
| 17 | { |
||
| 18 | list($partialId, $partialStage) = WebRequest::getAuthPartialLogin(); |
||
| 19 | |||
| 20 | if($partialId !== null && $partialStage > 1) { |
||
| 21 | $sql = 'SELECT type FROM credential WHERE user = :user AND factor = :stage AND disabled = 0 ORDER BY priority'; |
||
| 22 | $statement = $this->getDatabase()->prepare($sql); |
||
| 23 | $statement->execute(array(':user' => $partialId, ':stage' => $partialStage)); |
||
| 24 | $nextStage = $statement->fetchColumn(); |
||
| 25 | $statement->closeCursor(); |
||
| 26 | |||
| 27 | $this->redirect("login/" . $this->nextPageMap[$nextStage]); |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->setTemplate('login/password.tpl'); |
||
| 32 | } |
||
| 33 | |||
| 34 | View Code Duplication | protected function getProviderCredentials() |
|
|
0 ignored issues
–
show
|
|||
| 35 | { |
||
| 36 | $password = WebRequest::postString("password"); |
||
| 37 | if ($password === null || $password === "") { |
||
| 38 | throw new ApplicationLogicException("No password specified"); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $password; |
||
| 42 | } |
||
| 43 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.