Skip to content

Commit

Permalink
#218 - Skip redirect to login from register.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Mar 12, 2019
1 parent ec5d143 commit 6444bfb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Money.UI.Blazor/Services/Navigator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,20 @@ public void OpenUserPassword()
public void OpenLogin()
{
string loginUrl = UrlAccountLogin();
string currentUrl = GetCurrentUrl();

if (loginUrl != currentUrl && currentUrl != UrlAccountRegister())
uri.NavigateTo($"{loginUrl}?returnUrl={currentUrl}");
}

private string GetCurrentUrl()
{
string currentUrl = "/" + uri.ToBaseRelativePath(uri.GetBaseUri(), uri.GetAbsoluteUri());
int indexOfReturnUrl = currentUrl.IndexOf("?returnUrl");
if (indexOfReturnUrl >= 0)
currentUrl = currentUrl.Substring(0, indexOfReturnUrl);

if (loginUrl != currentUrl)
{
uri.NavigateTo($"{loginUrl}?returnUrl={currentUrl}");
}
return currentUrl;
}

public void OpenRegister()
Expand Down

0 comments on commit 6444bfb

Please sign in to comment.