Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dash8x committed Mar 11, 2024
2 parents 620c1e7 + 883ff12 commit 11e64ee
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 33 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
"javaabu/helpers": "^1.9",
"javaabu/activitylog": "^1.1",
Expand Down
10 changes: 0 additions & 10 deletions src/Enums/IsEnum.php

This file was deleted.

21 changes: 0 additions & 21 deletions src/Enums/NativeEnumsTrait.php

This file was deleted.

3 changes: 3 additions & 0 deletions src/Enums/UserStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Javaabu\Auth\Enums;

use Javaabu\Helpers\Enums\IsEnum;
use Javaabu\Helpers\Enums\NativeEnumsTrait;

enum UserStatuses: string implements IsEnum
{
use NativeEnumsTrait;
Expand Down
69 changes: 69 additions & 0 deletions src/Notifications/NewPasswordNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace Javaabu\Auth\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\SerializesModels;
use Javaabu\Auth\User;

class NewPasswordNotification extends Notification implements ShouldQueue
{
use Queueable;
use SerializesModels;

/**
* Create a new notification instance.
*
* @param string $password
*/
public function __construct(
protected string $password)
{
}

/**
* Get the notification's delivery channels.
*
* @param User $notifiable
* @return array
*/
public function via(User $notifiable): array
{
return [
'mail'
];
}

/**
* Get the mail representation of the notification.
*
* @param User $notifiable
* @return MailMessage
*/
public function toMail(User $notifiable): MailMessage
{
$user_type = slug_to_title($notifiable->getMorphClass());
$account_name = get_setting('app_name').' '.$user_type.' Account';

$message = (new MailMessage())
->subject($account_name.' Login Details')
->greeting("Hi {$notifiable->name},")
->line("The login details of your $account_name are given below:")
->line("**Email:** {$notifiable->email}")
->line("**Password:** {$this->password}");


if ($notifiable->requiresPasswordUpdate()) {
$message->line('You will be required to change your password after your next login.');
} else {
$message->line('We recommend that you change your password after your next login.');
}

$message->action('Login Now', $notifiable->loginUrl());

return $message;
}
}
4 changes: 3 additions & 1 deletion src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\File;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\Image\Enums\Fit;


abstract class User extends Authenticatable implements AdminModel, HasMedia, MustVerifyEmail, PasswordUpdatableContract, UserContract
{
Expand Down Expand Up @@ -542,7 +544,7 @@ public function registerMediaConversions(?Media $media = null): void
$this->addMediaConversion('avatar')
->width(200)
->height(200)
->fit('crop', 200, 200)
->fit(Fit::Crop, 200, 200)
->keepOriginalImageFormat()
->performOnCollections('avatar');

Expand Down

0 comments on commit 11e64ee

Please sign in to comment.