Skip to content

Commit

Permalink
(#405) web: update sign in method
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Sep 5, 2024
1 parent cf09419 commit bb795ca
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
@code {
private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Account settings", href: "/events/follow", disabled: true, icon: @Icons.Material.Filled.ManageAccounts),
};

Expand Down
9 changes: 4 additions & 5 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Account/SignIn.razor
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@
{
try
{
// Pass the deviceType when calling SignInAsync
var response = await IdentityService.SignInAsync(signInModel.Email, signInModel.Password, deviceType);

if (response != null && response.Content != null)
Expand All @@ -188,14 +187,14 @@
{
isTwoFactorRequired = true;
userId = response.Content.UserId;
twoFactorModel.Code = string.Empty; // Ensure the code is clear
twoFactorModel.Code = string.Empty;
StateHasChanged();
}
else if (!string.IsNullOrEmpty(response.Content.AccessToken))
{
await StudentsService.UpdateStudentDto(IdentityService.UserDto.Id);
var nextPage = StudentsService.StudentDto.State == "incomplete" ? "/signin/first" : "/";
NavigationManager.NavigateTo(nextPage, true);
var nextPage = StudentsService.StudentDto.State == "incomplete" ? "/signin/first" : "/home";
NavigationManager.NavigateTo(nextPage, forceLoad: true);
}
else
{
Expand Down Expand Up @@ -227,7 +226,7 @@
if (response != null && response.Content != null && !string.IsNullOrEmpty(response.Content.AccessToken))
{
await StudentsService.UpdateStudentDto(IdentityService.UserDto.Id);
var nextPage = StudentsService.StudentDto.State == "incomplete" ? "/signin/first" : "/";
var nextPage = StudentsService.StudentDto.State == "incomplete" ? "/signin/first" : "/home";
NavigationManager.NavigateTo(nextPage, true);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
var response = await IdentityService.SignInAsync(signInModel.Email, signInModel.Password, deviceType);
if (response != null && response.Content != null && !string.IsNullOrEmpty(response.Content.AccessToken))
{
NavigationManager.NavigateTo("/", true);
NavigationManager.NavigateTo("/home", true);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion MiniSpace.Web/src/MiniSpace.Web/Pages/Chats/NewChat.razor
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@

private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Chats", href: "/chats", icon: Icons.Material.Filled.Chat),
new BreadcrumbItem("New Chat", href: "/chats/new", disabled: true, icon: Icons.Material.Filled.AddComment),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Search", href: "/friends/search", icon: Icons.Material.Filled.PersonSearch),
new BreadcrumbItem("Friends", href: "/friends", disabled: true, icon: Icons.Material.Filled.LibraryAddCheck),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@

private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Search", href: "/friends/search", icon: Icons.Material.Filled.PersonSearch),
new BreadcrumbItem("Friends", href: "/friends", icon: Icons.Material.Filled.LibraryAddCheck),
new BreadcrumbItem("Requests", href: "/friends/requests", disabled: true, icon: Icons.Material.Filled.GroupAdd),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@

private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Search", href: "/friends/search", disabled: true, icon: Icons.Material.Filled.PersonSearch)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Search", href: "/friends/search", icon: Icons.Material.Filled.PersonSearch),
new BreadcrumbItem("Friends", href: "/friends", icon: Icons.Material.Filled.LibraryAddCheck),
new BreadcrumbItem("Requests", href: "/friends/requests", icon: Icons.Material.Filled.GroupAdd),
Expand Down
8 changes: 2 additions & 6 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
}
</MudItem>
</MudItem>
@* <MudItem xs="12" md="6" Class="content-section" Style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<MudText Typo="Typo.h4" Class="mini-space-title animated fadeIn" Style="font-size: 3rem; font-weight: bold; color: #555; margin-bottom: 0.5rem; animation-duration: 1s;">Mini Space</MudText>
<MudText Typo="Typo.h4" Class="welcome-title animated slideInFromLeft" Style="font-size: 2rem; font-weight: bold; color: #333; margin-bottom: 1rem; animation-duration: 1.5s;">@titles[activeIndex]</MudText>
<MudText Typo="Typo.h6" Class="welcome-tagline animated popIn" Style="color: #555; margin-bottom: 2rem; animation-duration: 1s;">@descriptions[activeIndex]</MudText>
<MudButton Color="Color.Primary" Size="Size.Large" Variant="Variant.Filled">Get Started</MudButton>
</MudItem> *@
<div class="content-section" style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<h1 class="mini-space-title" style="font-size: 3rem; font-weight: bold; color: #555; margin-bottom: 0.5rem;">Welcome to Mini Space</h1>
<h2 class="welcome-title" style="font-size: 2rem; font-weight: bold; color: #333; margin-bottom: 1rem;">@titles[activeIndex]</h2>
Expand Down Expand Up @@ -131,4 +125,6 @@
"Connect with friends and family, share your experiences.",
"Share your adventures and stories with a global audience."
};


}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@code {
private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Notifications", href: "/notifications/all", icon: Icons.Material.Filled.Notifications)
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@code {
private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Notifications", href: "/notifications/all", icon: Icons.Material.Filled.Notifications),
new BreadcrumbItem("New Notifications", href: "/notifications/new", icon: Icons.Material.Filled.NotificationsActive),
new BreadcrumbItem("Notifications History", href: "/notifications/history", disabled: true, icon: Icons.Material.Filled.NotificationsPaused)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@code {
private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Notifications", href: "/notifications/all", icon: Icons.Material.Filled.Notifications),
new BreadcrumbItem("New Notifications", href: "/notifications/new", disabled: true, icon: Icons.Material.Filled.NotificationsActive)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@code {
private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
{
new BreadcrumbItem("Home", href: "/", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Home", href: "/home", icon: Icons.Material.Filled.Home),
new BreadcrumbItem("Notifications", href: "/notifications/all", icon: Icons.Material.Filled.Notifications),
new BreadcrumbItem("New Notifications", href: "/notifications/new", icon: Icons.Material.Filled.NotificationsActive),
new BreadcrumbItem("Notifications History", href: "/notifications/history", icon: Icons.Material.Filled.NotificationsPaused),
Expand Down
4 changes: 2 additions & 2 deletions MiniSpace.Web/src/MiniSpace.Web/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
{
if (NavigationManager.Uri != NavigationManager.BaseUri)
{
NavigationManager.NavigateTo("/", true);
NavigationManager.NavigateTo("/home", true);
}
while (NavigationManager.Uri != NavigationManager.BaseUri)
{
Expand All @@ -277,7 +277,7 @@

void NavigateToHome()
{
NavigationManager.NavigateTo("/");
NavigationManager.NavigateTo("/home");
}

private string _themeName = "light";
Expand Down

0 comments on commit bb795ca

Please sign in to comment.