| @@ 486-506 (lines=21) @@ | ||
| 483 | * |
|
| 484 | * @return boolean true if the user was successfully created. Otherwise false. |
|
| 485 | */ |
|
| 486 | public function activatePendingUser($user, $methodName = false) |
|
| 487 | { |
|
| 488 | if($methodName === false) |
|
| 489 | { |
|
| 490 | $count = count($this->methods); |
|
| 491 | for($i = 0; $i < $count; $i++) |
|
| 492 | { |
|
| 493 | if($this->methods[$i]->current === false) |
|
| 494 | { |
|
| 495 | continue; |
|
| 496 | } |
|
| 497 | ||
| 498 | $ret = $this->methods[$i]->activatePendingUser($user); |
|
| 499 | if($ret !== false) |
|
| 500 | { |
|
| 501 | $this->impersonateUser($ret); |
|
| 502 | return true; |
|
| 503 | } |
|
| 504 | } |
|
| 505 | return false; |
|
| 506 | } |
|
| 507 | $auth = $this->getAuthenticator($methodName); |
|
| 508 | return $auth->activatePendingUser($user); |
|
| 509 | } |
|
| @@ 519-542 (lines=24) @@ | ||
| 516 | * |
|
| 517 | * @return Auth\User|false The user if the password reset hash is valid. Otherwise false. |
|
| 518 | */ |
|
| 519 | public function getUserByResetHash($hash, $methodName = false) |
|
| 520 | { |
|
| 521 | if($methodName === false) |
|
| 522 | { |
|
| 523 | $count = count($this->methods); |
|
| 524 | for($i = 0; $i < $count; $i++) |
|
| 525 | { |
|
| 526 | if($this->methods[$i]->current === false) |
|
| 527 | { |
|
| 528 | continue; |
|
| 529 | } |
|
| 530 | ||
| 531 | $ret = $this->methods[$i]->getUserByResetHash($hash); |
|
| 532 | if($ret !== false) |
|
| 533 | { |
|
| 534 | return $ret; |
|
| 535 | } |
|
| 536 | } |
|
| 537 | return false; |
|
| 538 | } |
|
| 539 | $auth = $this->getAuthenticator($methodName); |
|
| 540 | if($auth === false) |
|
| 541 | { |
|
| 542 | return $this->getUserByResetHash($hash, false); |
|
| 543 | } |
|
| 544 | return $auth->getUserByResetHash($hash); |
|
| 545 | } |
|
| @@ 587-606 (lines=20) @@ | ||
| 584 | return true; |
|
| 585 | } |
|
| 586 | ||
| 587 | public function getUserByAccessCode($key, $methodName = false) |
|
| 588 | { |
|
| 589 | if($methodName === false) |
|
| 590 | { |
|
| 591 | $count = count($this->methods); |
|
| 592 | for($i = 0; $i < $count; $i++) |
|
| 593 | { |
|
| 594 | if($this->methods[$i]->current === false) |
|
| 595 | { |
|
| 596 | continue; |
|
| 597 | } |
|
| 598 | ||
| 599 | $ret = $this->methods[$i]->getUserByAccessCode($key); |
|
| 600 | if($ret !== false) |
|
| 601 | { |
|
| 602 | return $ret; |
|
| 603 | } |
|
| 604 | } |
|
| 605 | return false; |
|
| 606 | } |
|
| 607 | $auth = $this->getAuthenticator($methodName); |
|
| 608 | return $auth->getUserByAccessCode($key); |
|
| 609 | } |
|