orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.37k stars 643 forks source link

Invalid login message is not displayed when fortify is active #1762

Closed protocyber closed 3 years ago

protocyber commented 3 years ago

Describe the bug After I activate Fortify, everything is working fine except when I tried to enter invalid credentials, validation exception is not showing.

To Reproduce Steps to reproduce the behavior:

  1. Install orchidsoftware/fortify
  2. Login via fortify route /login. Not via orchid's route /admin/login
  3. Enter invalid credentials

Expected behavior Validation should return invalid credentials message.

Screenshots Not applicable

Desktop (please complete the following information): OS: Windows 10 Browser Google Chrome Version 91.0.4472.77 (Official Build) (64-bit)

Server (please complete the following information): Platfrom Version: 9.21.0 Laravel Version: 8.34.0 PHP Version: 7.3 Database: MySql Database Version: 5.7.24 - MySQL Community Server (GPL)

protocyber commented 3 years ago

I think I've found the problem.

By default, fortify login route is /login which does not contain orchid prefix.

The problem is this line in app.blade.php <meta name="turbolinks-root" content="{{ Dashboard::prefix() }}">

After user click login, if credential is invalid, turbolinks makes two requests causing validation exception not displayed.

tabuna commented 3 years ago

Hi @protocyber. I think it's easy to fix this by simply specifying the same prefix configs:

https://github.com/laravel/fortify/blob/25503723947e8cfcb456c4287c7218a7525114ef/config/fortify.php#L13

protocyber commented 3 years ago

Hi @tabuna. Thank you very much for the respond.

Yes it works by setting prefix in config/fortify.php

But the downside is: The login page must not be rendered in root URL. The same error will still be happened. User must always be redirected to /prefix/login.

Thank you @tabuna for the excellent work.