| @@ 332-354 (lines=23) @@ | ||
| 329 | * |
|
| 330 | * @return boolean true if the user was successfully created. Otherwise false. |
|
| 331 | */ |
|
| 332 | public function createPendingUser($user, $methodName = false) |
|
| 333 | { |
|
| 334 | if($methodName === false) |
|
| 335 | { |
|
| 336 | $count = count($this->methods); |
|
| 337 | for($i = 0; $i < $count; $i++) |
|
| 338 | { |
|
| 339 | if($this->methods[$i]->pending === false) |
|
| 340 | { |
|
| 341 | continue; |
|
| 342 | } |
|
| 343 | ||
| 344 | $ret = $this->methods[$i]->createPendingUser($user); |
|
| 345 | if($ret !== false) |
|
| 346 | { |
|
| 347 | return true; |
|
| 348 | } |
|
| 349 | } |
|
| 350 | return false; |
|
| 351 | } |
|
| 352 | $auth = $this->getMethodByName($methodName); |
|
| 353 | return $auth->createPendingUser($user); |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * Convert a Auth\PendingUser into an Auth\User |
|
| @@ 367-390 (lines=24) @@ | ||
| 364 | * |
|
| 365 | * @return boolean true if the user was successfully created. Otherwise false. |
|
| 366 | */ |
|
| 367 | public function activatePendingUser($user, $methodName = false) |
|
| 368 | { |
|
| 369 | if($methodName === false) |
|
| 370 | { |
|
| 371 | $count = count($this->methods); |
|
| 372 | for($i = 0; $i < $count; $i++) |
|
| 373 | { |
|
| 374 | if($this->methods[$i]->current === false) |
|
| 375 | { |
|
| 376 | continue; |
|
| 377 | } |
|
| 378 | ||
| 379 | $ret = $this->methods[$i]->activatePendingUser($user); |
|
| 380 | if($ret !== false) |
|
| 381 | { |
|
| 382 | $this->impersonateUser($ret); |
|
| 383 | return true; |
|
| 384 | } |
|
| 385 | } |
|
| 386 | return false; |
|
| 387 | } |
|
| 388 | $auth = $this->getMethodByName($methodName); |
|
| 389 | return $auth->activatePendingUser($user); |
|
| 390 | } |
|
| 391 | ||
| 392 | /** |
|
| 393 | * Get a current user by a password reset hash |
|