This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into #89-unit-tests
- Loading branch information
Showing
12 changed files
with
94 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
use Blumilk\Meetup\Core\Models\User; | ||
use Illuminate\Database\Seeder; | ||
use Illuminate\Support\Carbon; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
class DummyDataSeeder extends Seeder | ||
{ | ||
|
@@ -19,7 +20,7 @@ public function run(): void | |
$user = User::factory([ | ||
"name" => "Admin", | ||
"email" => "[email protected]", | ||
"password" => "password", | ||
"password" => Hash::make("password"), | ||
"email_verified_at" => Carbon::createFromDate(2022, 01, 01), | ||
])->create(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,11 @@ | |
<div> | ||
<h1 class="text-xl">Reset Password</h1> | ||
</div> | ||
@if (!empty($error)) | ||
<div class="relative text-red-500 -top-6 left-1/2 transform -translate-x-1/2"> | ||
{{ $error }} | ||
</div> | ||
@endif | ||
<div> | ||
<input type="string" id="token" hidden="hidden" name="token" value="{{ $token }}"> | ||
<x-input-error for="token" /> | ||
|
@@ -19,8 +24,7 @@ | |
</label> | ||
<div class="mt-1"> | ||
<input id="email" name="email" type="email" placeholder="[email protected]" | ||
value="{{ $_GET['email'] }}" required | ||
<input id="email" name="email" type="email" placeholder="[email protected]" value="{{ $email }}" required | ||
class="appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" | ||
readonly="readonly" /> | ||
<x-input-error for="email" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Meetup\Core\Exceptions; | ||
|
||
use Exception; | ||
|
||
class PasswordIsTheSameAsOldException extends Exception | ||
{ | ||
protected $message = "Password cannot be the same as old password"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Meetup\Core\Services; | ||
|
||
use Blumilk\Meetup\Core\Models\User; | ||
use Illuminate\Auth\Events\Registered; | ||
use Illuminate\Contracts\Hashing\Hasher; | ||
|
||
class UserRegisterService | ||
{ | ||
public function __construct( | ||
protected Hasher $hasher, | ||
) {} | ||
|
||
public function register(string $email, string $name, string $password): void | ||
{ | ||
$hashedPassword = $this->hasher->make($password); | ||
|
||
$user = User::query()->firstOrCreate([ | ||
"email" => $email, | ||
"name" => $name, | ||
"password" => $hashedPassword, | ||
]); | ||
|
||
event(new Registered($user)); | ||
} | ||
} |