simon-s-99 / games-r-us

A Blazor Web App created by Samuel Lööf, Adam Kumlin, Gabriel Wedin & Simon Sörqvist.
MIT License
3 stars 0 forks source link

Login for new project scaffold #23

Closed simon-s-99 closed 6 months ago

simon-s-99 commented 6 months ago

Originally this was worked on in branch "15-log-in-functionality" & "alternate-login". These branches were abandoned due to various issues, see comment on last push of each branch to read more.

Google login now works (along with other types of login if we want them).

Testing this is a little weird due to the removal of the built in css.

Press any of these (if you choose login and your account is not registered you are automatically redirected to register):

image

Then press where it says "Google" (this is a button, again the css is weird):

image image

When you are logged in the text "Not Authorized" in "Home" should display your email.

image

#

Partial

This pr represents a fully working (but partial) solution to #2 & #15 I still need to put together a front-end for these that match our design in Figma.

adamkumlin commented 6 months ago

I'm having issues running the application as these build errors seem to be present:

image

Anyone else also having this issue?

simon-s-99 commented 6 months ago

I'm having issues running the application as these build errors seem to be present:

image

Anyone else also having this issue?

Due to the re-scaffold, AppDbContext is now named ApplicationDbContext (blame Microsoft).

This should be a simple namechange to get it working.

adamkumlin commented 6 months ago

I'm still seeing this build error:

Microsoft.EntityFrameworkCore.DbUpdateException
  HResult=0x80131500
  Message=An error occurred while saving the entity changes. See the inner exception for details.
  Source=Microsoft.EntityFrameworkCore.Relational
  StackTrace:
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at games_r_us_source.Data.SampleData.Create(ApplicationDbContext database) in C:\Users\adamkumlin\Documents\GitHub\games-r-us\games-r-us-source\Data\SampleData.cs:line 16
   at games_r_us_source.Program.Main(String[] args) in C:\Users\adamkumlin\Documents\GitHub\games-r-us\games-r-us-source\Program.cs:line 82

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
SqlException: Invalid column name 'Address'.
Invalid column name 'FullName'.
Invalid column name 'Address'.
Invalid column name 'FullName'.

Maybe it's something about adding an 'Account' object into a table of type 'ApplicationUser'? I did delete the database and run 'Update-Database' beforehand.

simon-s-99 commented 6 months ago

I'm still seeing this build error:

Microsoft.EntityFrameworkCore.DbUpdateException
  HResult=0x80131500
  Message=An error occurred while saving the entity changes. See the inner exception for details.
  Source=Microsoft.EntityFrameworkCore.Relational
  StackTrace:
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at games_r_us_source.Data.SampleData.Create(ApplicationDbContext database) in C:\Users\adamkumlin\Documents\GitHub\games-r-us\games-r-us-source\Data\SampleData.cs:line 16
   at games_r_us_source.Program.Main(String[] args) in C:\Users\adamkumlin\Documents\GitHub\games-r-us\games-r-us-source\Program.cs:line 82

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
SqlException: Invalid column name 'Address'.
Invalid column name 'FullName'.
Invalid column name 'Address'.
Invalid column name 'FullName'.

Maybe it's something about adding an 'Account' object into a table of type 'ApplicationUser'? I did delete the database and run 'Update-Database' beforehand.

I should have mentioned this in the description of the pr but in this version of the program Account no longer exists, it has been replaced with ApplicationUser.