bitfoundation / bitplatform

Build all of your apps using what you already know and love ❤️
https://bitplatform.dev
MIT License
1.07k stars 222 forks source link

Admin Template - Typo in TokenOptions: DefaultPhoneProvider used instead DefaultEmailProvider #7792

Closed techscx closed 3 months ago

techscx commented 3 months ago

Is there an existing issue for this?

Describe the bug

During user Registration using an Email & Password, the ConfirmEmailToken is generated:

IdentityController.cs, Line 521: var token = await userManager.GenerateUserTokenAsync(user, TokenOptions.DefaultPhoneProvider, FormattableString.Invariant($"VerifyEmail:{email},{user.EmailTokenRequestedOn}"));

Line 103: var tokenIsValid = await userManager.VerifyUserTokenAsync(user, TokenOptions.DefaultPhoneProvider, FormattableString.Invariant($"VerifyEmail:{request.Email},{user.EmailTokenRequestedOn}"), request.Token!);

Expected Behavior

It should read TokenOptions.DefaultEmailProvider.

Steps To Reproduce

Exceptions (if any)

The token returns to be invalid.

.NET Version

8.0.301

Anything else?

No response

ysmoradi commented 3 months ago

Thanks for submitting issue. Note that we're using TokenOptions.DefaultPhoneProvider by design in order to generate 6 digits codes, so the user will be able to either: 1- Open the link to confirm email account 2- Copy/paste 6-digit codes 3- Remember/type 6-digit codes in order to confirm its email address.

techscx commented 3 months ago

Thanks for submitting issue. Note that we're using TokenOptions.DefaultPhoneProvider by design in order to generate 6 digits codes, so the user will be able to either: 1- Open the link to confirm email account 2- Copy/paste 6-digit codes 3- Remember/type 6-digit codes in order to confirm its email address.

Thank you. My procedure: If I register with Email & Password without providing a Phone Number, the token verification fails. Once, I have changed to the DefaultEmailProvider, the token verification succeeds.

ysmoradi commented 3 months ago

Just signed in with ysmoradi+122445@gmail.com and 123456 and without any phone number to https://adminpanel.bitplatform.dev without any issue. You can also sign-in with the credentials I provided to check if you see any problem or not. Let me know about the results and also provide me details about your Boilerplate version.

techscx commented 3 months ago

Just signed in with ysmoradi+122445@gmail.com and 123456 and without any phone number to https://adminpanel.bitplatform.dev without any issue. You can also sign-in with the credentials I provided to check if you see any problem or not. Let me know about the results and also provide me details about your Boilerplate version.

That is interesting. So there must be an issue in my copy of the Template. Thank you!

ysmoradi commented 3 months ago

We're happy to help at any time, let me know if you found any more details