Skip to content

Commit

Permalink
auth-login username login enable
Browse files Browse the repository at this point in the history
  • Loading branch information
shakilofficial0 committed Sep 19, 2023
1 parent 9c233f6 commit 6024a04
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'

- name: Compile Assets
run: |
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/FortifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function boot(): void
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);

RateLimiter::for('login', function (Request $request) {
$email = (string)$request->email;
$email = (string)$request->username;

return Limit::perMinute(5)->by($email . $request->ip());
});
Expand Down
6 changes: 3 additions & 3 deletions app/Providers/NukeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function register()
public function boot()
{
RateLimiter::for('login', function (Request $request) {
$email = (string)$request->email;
$email = (string)$request->username;

return Limit::perMinute(5)->by($email . $request->ip());
});
Expand Down Expand Up @@ -70,8 +70,8 @@ public function boot()
return session()->put(['attempt-failed' => Lang::get('passwords.attempt'), 'end_time' => time() + 300]);
}

$user = User::where('email', $request->email)
->orWhere('username', $request->email)
$user = User::where('email', $request->username)
->orWhere('username', $request->username)
->first();

if ($user && Hash::check($request->password, $user->password)) {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/auth-login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class="app-brand-text demo text-body fw-bold ms-1">Codebumble Inc.</span>
@csrf
<div class="mb-3">
<label for="email" class="form-label">Email or Username</label>
<input type="text" class="form-control" id="email" name="email"
<input type="text" class="form-control" id="email" name="username"
placeholder="Enter your email or username" autofocus>
</div>
<div class="mb-3 form-password-toggle">
Expand Down
36 changes: 34 additions & 2 deletions resources/views/auth/auth-verify-email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,41 @@ class="app-brand-text demo text-body fw-bold ms-1">Codebumble Inc.</span>
<!-- /Logo -->

@if (session('status') == 'verification-link-sent')
<div class="alert alert-success p-1 text-center">
A new email verification link has been emailed to you!

<h2 class="card-title fw-bolder mb-1">Verify your email ✉️</h2>
<p class="card-text mb-2">
We've sent a link to your registered Email Address<span class="fw-bolder"></span> Please
follow the
link inside to continue.
</p>

<div class="alert alert-primary alert-dismissible d-flex align-items-baseline" role="alert">
<span class="alert-icon alert-icon-lg text-primary me-2">
<i class="ti ti-send ti-sm"></i>
</span>
<div class="d-flex flex-column ps-1">
<h5 class="alert-heading mb-2">New Verification Mail Sent!</h5>
<p class="mb-0">We have sent a new Email Verification Link which is linked with this Account. Please Check Spam Box if you are unable to get it.</p>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>
</div>

<p class="mt-2 text-center">
<span>Didn't receive an email? </span>

<form action="{{ route('verification.send') }}" method="POST">
@csrf
<button type="submit" class="btn btn-primary w-100">&nbsp;Resend</button>
</form>

<p class="mt-2 text-center">Or</p>

<form action="{{ route('logout') }}" method="POST">
@csrf
<button type="submit" class="btn btn-primary w-100">&nbsp;Logout</button>
</form>
</p>
@else
<h2 class="card-title fw-bolder mb-1">Verify your email ✉️</h2>
<p class="card-text mb-2">
Expand Down

0 comments on commit 6024a04

Please sign in to comment.