I am trying to reset my password but not able rest password if password length is less then 6
. I am validating password filed with min:4
validation but when I enter more then 4 character form is not submitting but when I tried with more then 6 it is working.
Any Idea what is wrong in my code.
Here is my HTML:
<div class="reset_password_container">
<div class="reset_bg">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="token" value="{{ $token }}">
<div class="find_account_container">
<div class="find_inner_logo">
<h5>{{ trans('messages.reset_password_form.reset_password') }}</h5>
</div>
<div class="find_form_dv">
<div class="reset_para_dv">
<p>{{ trans('messages.reset_password_form.text_1') }}</p>
<div class="reset_email_dv">
<p>{{ trans('messages.reset_password_form.email') }} <a href="javascript:void(0);">{{ $email }}</a></p>
</div>
</div>
<div class="reset_form_dv">
<input type="hidden" class="txt" name="ID" value="{{ $email }}">
<input type="password" class="txt" name="password" value="{{ old('password') }}" placeholder="{{ trans('messages.reset_password_form.password') }}">
<p class="error"></p>
<input type="password" class="txt" name="password_confirmation" value="{{ old('password_confirmation') }}" placeholder="{{ trans('messages.reset_password_form.password_confirmation') }}">
<p class="error">
@if ($errors->has('password'))
{{ $errors->first('password') }}
@endif
</p>
</div>
</div>
</div>
<div class="reset_footer_bg">
<div class="rest_btn_bg">
<button type="submit" class="btn btn-primary">{{ trans('messages.reset_password_form.confirm') }}</button>
</div>
</div>
</form>
</div>
</div>
PasswordController.php
/**
* Reset the given user's password.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postReset(Request $request)
{
$this->validate($request, [
'token' => 'required',
'ID' => 'required|email',
'password' => 'required|min:4|confirmed',
'password_confirmation' => 'required|min:4'
]);
$credentials = $request->only(
'ID', 'password', 'password_confirmation', 'token'
);
$response = Password::reset($credentials, function ($user, $password) {
$this->resetPassword($user, $password);
});
switch ($response) {
case Password::PASSWORD_RESET:
return redirect($this->redirectPath())->with('status', trans($response));
default:
return redirect()->back()
->withInput($request->only('ID'))
->withErrors(['ID' => trans($response)]);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire