My Routes are below
Route::get('/me/{UserName}', array('uses' => 'Website\Account@index', 'as' => 'Profile'));
Route::post('/UpdateProfile', 'Website\Account@UpdateProfile');
My Request class has below code
protected function getValidatorInstance()
{
$instance = parent::getValidatorInstance();
$instance->after(function ($validator) {
$this->IsValidPassword($validator);
});
return $instance;
}
public function IsValidPassword($validator)
{
$Profile = \Auth::user();
if(\Request::get( "EmailAddress" ) != $Profile->EmailAddress) {
if(!\Hash::check(\Request::get( "Password" ), $Profile->Password)) {
$validator->errors()->add('PasswordMismatch', 'Password is incorrect!');
}
}
}
public function response(array $errors){
return \Redirect::back()->withErrors($errors);
}
Above code checks if the Password is incorrect then send the errors back to page.
Problem is : It does not go back to the page but below error is coming
HttpResponseException {#286 ▼
#response: RedirectResponse {#289 ▶}
#message: ""
#code: 0
#file: "C:\xampp\htdocs\Learning\vendor\laravel\framework\src\Illuminate\Foundation
\Http\FormRequest.php"
#line: 107
-trace: {▶}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire