Skip to content

Commit

Permalink
otp disabled in local system
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Oct 9, 2024
1 parent 8e38230 commit e235e5a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
29 changes: 16 additions & 13 deletions src/Notifications/OTPNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ public function __construct(array $data)
*/
public function via(object $notifiable): array
{
if (request()->filled('mobile')) {
return ['sms'];
}

if (request()->filled('email')) {
return ['mail'];
}

if (request()->filled('user')) {
$userModel = config('fintech.auth.user_model', User::class);
return ($notifiable instanceof $userModel)
? $notifiable->prefer ? [$notifiable->prefer] : ['mail']
: ['database'];
if (app()->environment() == 'production') {

if (request()->filled('mobile')) {
return ['sms'];
}

if (request()->filled('email')) {
return ['mail'];
}

if (request()->filled('user')) {
$userModel = config('fintech.auth.user_model', User::class);
return ($notifiable instanceof $userModel)
? $notifiable->prefer ? [$notifiable->prefer] : ['mail']
: ['database'];
}
}

return ['database'];
Expand Down
17 changes: 5 additions & 12 deletions src/Services/PasswordResetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,11 @@ public function notifyUser($user)
{
try {

switch ($this->resetMethod) {
case PasswordResetOption::TemporaryPassword->value:
$notification_data = $this->viaTemporaryPassword($user);
break;

case PasswordResetOption::Otp->value:
$notification_data = $this->viaOneTimePin($user);
break;

default:
$notification_data = $this->viaResetLink($user);
}
$notification_data = match ($this->resetMethod) {
PasswordResetOption::TemporaryPassword->value => $this->viaTemporaryPassword($user),
PasswordResetOption::Otp->value => $this->viaOneTimePin($user),
default => $this->viaResetLink($user),
};

$notification_data['method'] = $this->resetMethod;

Expand Down

0 comments on commit e235e5a

Please sign in to comment.