DarkGhostHunter / Laraguard

"On-premises 2FA Authentication for all your users out-of-the-box
MIT License
266 stars 24 forks source link

Ajax support? #12

Closed sinnbeck closed 4 years ago

sinnbeck commented 4 years ago

I assume this isn't going to happen considering how the package is built, using listeners. But are there any plans to make it possible to use with javascript/ajax? I am using inertia for a project where I would love to add two factor auth, but I need to have control over the response (Inertia::render())

DarkGhostHunter commented 4 years ago

This package is not built around AJAX.

I'm not familiar with Inertia, but when you issue the login credentials through AJAX, you will receive a 4XX code. You can catch these codes, edit the view to make it AJAX-friendly and show it to the user when you receive it in your frontend.

It's not the best implementation but surely you can add a PR to add a AJAX-friendly form view.