Hello, I am developing a laravel project but I got stuck somewhere. I wanted to ask you people who know. I will explain the problem below.
I direct the user to a Modal to reset the password. If the user is registered and the password is reset, it stays in the same Modal and sends the password reset link. I need to define the Password Validate part with a different name, but I couldn't.
PasswordResetLinkController.php
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use App\Models\Settings;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.forgot-password')->with([
'site_name' => Settings::find('site_name')->value,
'site_description' => __('auth.forgot_password_desc'),
'page_name' => __('auth.forgot_password'),
]);
}
/**
* Handle an incoming password reset link request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'email' => 'required|email',
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}
forgot_sifre.blade.php
<div class="modal modal-blur fade" id="modal--forgot--sifre" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<!-- <div class="modal-header">
<h5 class="modal-title" style="text-align: center;">{{ $site_name }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>-->
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<section class="login" style="font-family: 'El Messiri', sans-serif;">
<div class="form-login">
<h2 class="login">
<a href="{{ url('/') }}" style="text-decoration:none;">
{{ $site_name }}
</a>
</h2>
<div class="card-body">
{{ __('Parolanızı mı unuttunuz? Sorun değil. Sadece bize e-posta adresinizi bildirin, size yeni bir tane seçmenize izin verecek bir şifre sıfırlama bağlantısını e-posta ile gönderelim.') }}
</div>
<!-- Session Status -->
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
<script>
$(document).ready(function() {
$('#modal--forgot--sifre').modal('show');
});
</script>
@endif
<form method="POST" action="{{ route('password.email') }}" class="form-login">
@csrf
<div class="modal-body">
<div class="input Bx email-input">
<input id="email" type="email" class="ei @error('email') is-invalid @enderror" placeholder="Lütfen geçerli bir email giriniz" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
<script>
$(document).ready(function() {
$('#modal--forgot--sifre').modal('show');
});
</script>
@enderror
<svg class="ei" viewBox="0 0 18 18">
<path d="M11.5,10.5 C6.4987941,17.5909626 1,3.73719105 11.5,6 C10.4594155,14.5485365 17,13.418278 17,9 C17,4.581722 13.418278,1 9,1 C4.581722,1 1,4.581722 1,9 C1,13.418278 4.581722,17 9,17 C13.418278,17 17,13.42 17,9"></path>
<polyline points="5 9.25 8 12 13 6"></polyline>
</svg>
</div>
<div class="form-footer">
<div class="inputBx">
<input type="submit" value="{{ __('Gönder') }}" class="login" href="#" data-bs-toggle="modal" data-bs-target="#modal--forgot--sifre">
</div>
<p class="login">{{ __('auth.login_desc') }} <a class="login buttonn button-wigglee" href="#" data-bs-toggle="modal" data-bs-target="#modal--login--giris" data-bs-dismiss="modal">{{ __('auth.login') }}</a></p>
</div>
</form>
</div>
</section>
</div>
</div>
</div>