#2831 emlak24 requirements

This commit is contained in:
Diatrex 2020-12-08 10:46:22 +03:00
parent 1882151896
commit b926180b0b
5 changed files with 23 additions and 0 deletions

View File

@ -375,6 +375,9 @@ return [
'password' => [
'name' => 'Password',
],
'old_password' => [
'name' => 'Old password',
],
'new_password' => [
'name' => 'New password',
],

View File

@ -29,6 +29,7 @@ return [
'empty_password_sms_message' => 'Due to security issues, we changed your password! Your new password is:',
'required_all' => "All Field is Required!",
'can_not_remove_filled_fields' => "You can not remove filled fields!",
'wrong_password' => "The password you entered is not correct!",
// Forgot Password
'email_phone_not_found' => 'The E-mail, Phone Number is not correct!',

View File

@ -236,6 +236,12 @@
{{ passwordForm.open()|raw }}
<div class="row">
<div class="col-12">
<div class="form-group">
<label class="font-weight-bold">{{ trans("visiosoft.module.profile::field.old_password.name") }}</label>
{{ passwordForm.fields.old_password.input|raw }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ trans("visiosoft.module.profile::field.new_password.name") }}</label>

View File

@ -6,6 +6,13 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
class PasswordFormBuilder extends FormBuilder
{
protected $fields = [
'old_password' => [
'type' => 'anomaly.field_type.text',
'required' => true,
'config' => [
'type' => 'password'
],
],
'new_password' => [
'type' => 'anomaly.field_type.text',
'required' => true,

View File

@ -4,6 +4,7 @@ use Anomaly\Streams\Platform\Message\MessageBag;
use Anomaly\UsersModule\User\User;
use Anomaly\UsersModule\User\UserPassword;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class PasswordFormHandler
{
@ -20,6 +21,11 @@ class PasswordFormHandler
return;
}
if (!Hash::check($builder->getPostValue('old_password'), \auth()->user()->password)) {
$messages->error(trans('visiosoft.module.profile::message.wrong_password'));
return redirect()->back();
}
if ($builder->getPostValue('new_password') != $builder->getPostValue('re_new_password')) {
$messages->error(trans('visiosoft.module.profile::message.password_do_not_match'));
return redirect()->back();