Skip to content

Adding 2fa feature for Vue Starter #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Adding 2fa feature for Vue Starter #120

wants to merge 3 commits into from

Conversation

tnylea
Copy link
Contributor

@tnylea tnylea commented Apr 22, 2025

This PR will add Two Factor Auth Functionality to the Vue Starter Kit.

In the settings page, users will now see a Two-Factor Auth button.

CleanShot 2025-04-22 at 17 17 54@2x

Clicking this will take them to their 2FA settings page.

CleanShot 2025-04-22 at 17 18 10@2x

They can enable 2FA and they will see a modal with a QR code and secret key.

CleanShot 2025-04-22 at 17 18 19@2x

After scanning the QR code with an authenticator app, they can click on continue and they'll see the 2FA confirmation screen.

CleanShot 2025-04-22 at 17 18 38@2x

After the user successfully confirms they will see that 2FA is now active on their account.

CleanShot 2025-04-22 at 17 19 06@2x

They will also see their recovery codes on the previous screen. Now, upon logging in as their user, they will also have to verify a 2FA code.

CleanShot 2025-04-22 at 17 19 28@2x

You will also find the relevant PR's for this feature in the other Starter Kits.

Other Starter Kit 2FA Feature PR's

React: github.com/laravel/react-starter-kit/pull/101
Livewire: github.com/laravel/livewire-starter-kit/pull/84

@laserhybiz
Copy link
Contributor

Why bring in unplugin-vue-components?

@@ -40,6 +41,7 @@
"typescript": "^5.2.2",
"vite": "^6.2.0",
"vue": "^3.5.13",
"vue-input-otp": "^0.2.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package isn't used anywhere

import HeadingSmall from '@/components/HeadingSmall.vue';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { PinInputInput, PinInputRoot } from 'reka-ui'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, what's the reason for using Reka UI's Pin Input component directly instead of going through the shadcn/vue integration?
https://www.shadcn-vue.com/docs/components/pin-input.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I experienced issues with the ShadCN pin input not functioning and displaying correctly. Instead of submitting an issue and waiting to hear back about the fixes, I decided to go right to the source and use the component from the underlying library.

If you'd like to give the ShadCN Vue Pin Input a try, please let me know how it goes. It could have been user error, but I spent over an hour trying to debug some issues.

@ibrunotome
Copy link
Contributor

@tnylea the livewire PR is not using generateSecretKey(16) and it is using RendererStyle(800) instead of RendererStyle(400) like this PR or react PR.

I’m curious why the team decided to rewrite backend logic in all the starter kits instead of using Fortify, since it already includes these features (like this option to configure secret length laravel/fortify#568)

@David-Grass-Feria
Copy link

David-Grass-Feria commented Apr 25, 2025

@ibrunotome Thats right! All of this starterkids can use fortify! Soo much work for nothing....
The laravel team can save the power for other things. Create only the blade views for livewire, or react, or vue components and use fortify.

@tnylea
Copy link
Contributor Author

tnylea commented Apr 25, 2025

@ibrunotome and @David-Grass-Feria, thanks for letting me know about the generateSecretKey(16) and the RendererStyle(800).

This PR is not final and there are still many iterations that we are going through. Many of the logic from Fortify has been ported over and we are still working on finalizing this functionality. I appreciate the input.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants