Skip to content

Commit

Permalink
Merge pull request #1663 from bakaphp/hotfix-zoho-lead
Browse files Browse the repository at this point in the history
feat: add todo
  • Loading branch information
kaioken committed Jul 9, 2024
2 parents aa30cbd + ed677fe commit d4afe37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Domains/Souk/Orders/DataTransferObject/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function __construct(
public readonly CompanyInterface $company,
public readonly People $people,
public readonly UserInterface $user,
public readonly string $email,
public readonly string $token,
public readonly string $orderNumber,
public readonly ?Address $shippingAddress,
Expand All @@ -37,6 +36,7 @@ public function __construct(
public readonly Currencies $currency,
#[DataCollectionOf(OrderItem::class)]
public readonly DataCollection $items,
public readonly ?string $email = null,
public readonly ?string $metadata = null,
public readonly float $weight = 0.0,
public readonly ?string $shippingMethod = null,
Expand Down
17 changes: 11 additions & 6 deletions src/Kanvas/Auth/Services/ForgotPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Kanvas\Apps\Models\Apps;
use Kanvas\Enums\AppEnums;
use Kanvas\Exceptions\ModelNotFoundException as ExceptionsModelNotFoundException;
use Kanvas\Notifications\Templates\ResetPassword;
use Kanvas\Users\Models\Users;
use Kanvas\Users\Models\UsersAssociatedApps;
Expand Down Expand Up @@ -48,12 +49,16 @@ public function forgot(string $email): Users
*/
public function reset(string $newPassword, string $hashKey): bool
{
$recoverUser = UsersAssociatedApps::fromApp($this->app)
->notDeleted()
->where([
'companies_id' => AppEnums::GLOBAL_COMPANY_ID->getValue(),
'user_activation_forgot' => $hashKey,
])->firstOrFail();
try {
$recoverUser = UsersAssociatedApps::fromApp($this->app)
->notDeleted()
->where([
'companies_id' => AppEnums::GLOBAL_COMPANY_ID->getValue(),
'user_activation_forgot' => $hashKey,
])->firstOrFail();
} catch (ModelNotFoundException $e) {
throw new ExceptionsModelNotFoundException('Password reset link has expired, request a new link.');
}

return $recoverUser->user()->firstOrFail()->resetPassword($newPassword, $this->app);
}
Expand Down

0 comments on commit d4afe37

Please sign in to comment.