bakaphp /
phalcon-api
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Gewaer\Api\Controllers; |
||
| 6 | |||
| 7 | use Gewaer\Models\Users; |
||
| 8 | use Gewaer\Models\UserLinkedSources; |
||
| 9 | use Gewaer\Exception\ServerErrorHttpException; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Class AuthController |
||
| 13 | * |
||
| 14 | * @package Gewaer\Api\Controllers |
||
| 15 | * |
||
| 16 | * @property Users $userData |
||
| 17 | * @property Request $request |
||
| 18 | * @property Config $config |
||
| 19 | * @property \Baka\Mail\Message $mail |
||
| 20 | * @property Apps $app |
||
| 21 | */ |
||
| 22 | class AuthController extends \Baka\Auth\AuthController |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Setup for this controller |
||
| 26 | * |
||
| 27 | * @return void |
||
| 28 | */ |
||
| 29 | 14 | public function onConstruct() |
|
| 30 | { |
||
| 31 | 14 | $this->userLinkedSourcesModel = new UserLinkedSources(); |
|
| 32 | 14 | $this->userModel = new Users(); |
|
| 33 | |||
| 34 | 14 | if (!isset($this->config->jwt)) { |
|
| 35 | throw new ServerErrorHttpException('You need to configure your app JWT'); |
||
| 36 | } |
||
| 37 | 14 | } |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Set the email config array we are going to be sending |
||
| 41 | * |
||
| 42 | * @param String $emailAction |
||
| 43 | * @param Users $user |
||
| 44 | */ |
||
| 45 | protected function sendEmail(BakaUsers $user, string $type): void |
||
|
0 ignored issues
–
show
|
|||
| 46 | { |
||
| 47 | $send = true; |
||
| 48 | $subject = null; |
||
| 49 | $body = null; |
||
| 50 | switch ($type) { |
||
| 51 | case 'recover': |
||
| 52 | $recoveryLink = $this->config->app->frontEndUrl . '/user/reset/' . $user->user_activation_forgot; |
||
| 53 | $subject = _('Password Recovery'); |
||
| 54 | $body = sprintf(_('Click %shere%s to set a new password for your account.'), '<a href="' . $recoveryLink . '" target="_blank">', '</a>'); |
||
| 55 | // send email to recover password |
||
| 56 | break; |
||
| 57 | case 'reset': |
||
| 58 | $activationUrl = $this->config->app->frontEndUrl . '/user/activate/' . $user->user_activation_key; |
||
| 59 | $subject = _('Password Updated!'); |
||
| 60 | $body = sprintf(_('Your password was update please, use this link to activate your account: %sActivate account%s'), '<a href="' . $activationUrl . '">', '</a>'); |
||
| 61 | // send email that password was update |
||
| 62 | break; |
||
| 63 | default: |
||
| 64 | $send = false; |
||
| 65 | break; |
||
| 66 | } |
||
| 67 | if ($send) { |
||
| 68 | $this->mail |
||
| 69 | ->to($user->email) |
||
| 70 | ->subject($subject) |
||
| 71 | ->content($body) |
||
| 72 | ->sendNow(); |
||
| 73 | } |
||
| 74 | } |
||
| 75 | } |
||
| 76 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths