Commit 5a834c0f authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(auth): display error messages from validator

parent fcad25a5
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ class InteractController extends Controller
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', service('validation')->getErrors());
                ->with('errors', $this->validator->getErrors());
        }

        $validData = $this->validator->getValidated();
+2 −2
Original line number Diff line number Diff line
@@ -45,12 +45,11 @@ class MagicLinkController extends ShieldMagicLinkController
            'new_password' => 'required|strong_password',
        ];

        $userModel = new UserModel();
        if (! $this->validate($rules)) {
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', $userModel->errors());
                ->with('errors', $this->validator->getErrors());
        }

        $validData = $this->validator->getValidated();
@@ -60,6 +59,7 @@ class MagicLinkController extends ShieldMagicLinkController
            ->user()
            ->password = $validData['new_password'];

        $userModel = new UserModel();
        if (! $userModel->update(auth()->user()->id, auth()->user())) {
            return redirect()
                ->back()
+2 −2
Original line number Diff line number Diff line
@@ -35,12 +35,11 @@ class MyAccountController extends BaseController
            'new_password' => 'required|strong_password|differs[password]',
        ];

        $userModel = new UserModel();
        if (! $this->validate($rules)) {
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', $userModel->errors());
                ->with('errors', $this->validator->getErrors());
        }

        $validData = $this->validator->getValidated();
@@ -66,6 +65,7 @@ class MyAccountController extends BaseController
            ->user()
            ->password = $validData['new_password'];

        $userModel = new UserModel();
        if (! $userModel->update(auth()->user()->id, auth()->user())) {
            return redirect()
                ->back()
+2 −2
Original line number Diff line number Diff line
@@ -290,12 +290,11 @@ class InstallController extends Controller
            'password' => 'required|strong_password',
        ];

        $userModel = new UserModel();
        if (! $this->validate($rules)) {
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', $userModel->errors());
                ->with('errors', $this->validator->getErrors());
        }

        $validData = $this->validator->getValidated();
@@ -308,6 +307,7 @@ class InstallController extends Controller
            'is_owner' => true,
        ]);

        $userModel = new UserModel();
        try {
            $userModel->save($user);
        } catch (ValidationException) {
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ use Modules\Auth\Config\Auth;
        required="true"
        type="email"
        inputmode="email"
        autocomplete="email"
        autocomplete="username"
        autofocus="autofocus"
    />

Loading