Skip to content
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

Question about Login/Register views and controllers #45

Closed
gep13 opened this issue Jun 11, 2019 · 5 comments
Closed

Question about Login/Register views and controllers #45

gep13 opened this issue Jun 11, 2019 · 5 comments

Comments

@gep13
Copy link

gep13 commented Jun 11, 2019

I recently created a new ASP.NET MVC project using dotnet new mvc --auth Individual and tested that everything was working. i.e. I clicked on the Register button, I created an account, I then logged out, and logged back out again, and everything worked as expected. All of this was done using the Sqlite Database for persistence.

I then followed the guide here:

https://dlmelendez.github.io/identityazuretable/#/walkthroughcore2

To set about switching to use Azure Table Storage as the persistence layer. After a little bit of messing around, I was able to get it to create the tables in the locally running Azure Storage Emulator, and I thought I was all set to start creating users. However, when I ran the site, and tried to click on the Register and Login buttons, they no longer worked.

@dlmelendez can you confirm that I will need to re-implement the Register/Login View and Controllers in order to work with your NuGet package for storing information in Azure Table Storage?

Thank you for your help in building out this library, I believe that it is going to be very useful to me!

@dlmelendez
Copy link
Owner

@gep13 There is a working sample here https://github.com/dlmelendez/identityazuretable/tree/master/sample/samplemvccore2 that should be able to answer your questions on implementation.

@gep13
Copy link
Author

gep13 commented Jun 11, 2019

@dlmelendez looking at your sample, and comparing it to what has been generated from the dotnet new mvc --auth Individual command, it is clear that your sample has a number of additional Controllers and Views, which are not included in the site that was generated from the dotnet new command.

Can I ask where you generated the sample projects from?

Do you have any examples or documentation around adding identityazuretable to a newly created project from the dotnet new command?

@dlmelendez
Copy link
Owner

dlmelendez commented Jun 11, 2019

@gep13 This sample was created before the Razor Scaffolding feature was introduced. More about that here https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.2&tabs=visual-studio#scaffold-register-login-and-logout . The project has not implement any dotnet new templates. If you would like to contribute one, that would be great. https://docs.microsoft.com/en-us/dotnet/core/tutorials/create-custom-template

@gep13
Copy link
Author

gep13 commented Jun 11, 2019

@dlmelendez I would love to, but currently I can’t get it to work, and I was hoping that you might be able to provide some guidance. I believe I can add all the “bits” and the builds and compiles correctly, including creating the tables in Azure Storage, however, the Login/Register links on the template remain non functional.

Do you have any ideas on what can be done to make these work? I will look at the link that you provided tomorrow, only on phone just now.

Thanks!

@gep13
Copy link
Author

gep13 commented Jun 12, 2019

@dlmelendez just wanted to follow up to say that the link that you provided got me to a solution 😄

I scaffolded out all the Account related pages, and then updated them all to use ApplicationUser, rather than IdentityUser, as well as change some pages to use the implementation of IEmailSender, and then everything worked as expected.

I was also then able to change to include GitHub as an Authentication provider, and this also worked as expected.

Thanks again for your help with this!

@gep13 gep13 closed this as completed Jun 12, 2019
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

No branches or pull requests

2 participants