Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ await cookie.Remove(new ButilCookie()
{
Name = item.Name,
Path = "/",
Domain = AbsoluteServerAddress.GetAddress().Host,
SameSite = SameSite.Strict,
Secure = AppEnvironment.IsDevelopment() is false
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</BitStack>
<BitStack Class="stack" FitHeight>
<SignInPanel OnSuccess="OnSuccess"
ReturnUrlQueryString="@ReturnUrl"
ReturnUrl="@ReturnUrl"
SignInPanelType="SignInPanelType.Otp" />
</BitStack>
</BitStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<BitStack Horizontal VerticalAlign="BitAlignment.Center">
<BitText>@Localizer[nameof(AppStrings.Password)]</BitText>
<BitSpacer />
<BitLink Href="@($"{Urls.ForgotPasswordPage}?return-url={Uri.EscapeDataString(ReturnUrl!)}")">@Localizer[nameof(AppStrings.ForgotPasswordLink)]</BitLink>
<BitLink Href="@($"{Urls.ForgotPasswordPage}?return-url={Uri.EscapeDataString(GetReturnUrl())}")">@Localizer[nameof(AppStrings.ForgotPasswordLink)]</BitLink>
</BitStack>
</LabelTemplate>
</BitTextField>
Expand Down Expand Up @@ -141,7 +141,7 @@
{
<BitText Align="BitTextAlign.Center" Typography="BitTypography.Body2">
@Localizer[nameof(AppStrings.DontHaveAccountMessage)]
<BitLink Href="@($"{Urls.SignUpPage}?return-url={Uri.EscapeDataString(ReturnUrl!)}")">@Localizer[nameof(AppStrings.SignUp)]</BitLink>
<BitLink Href="@($"{Urls.SignUpPage}?return-url={Uri.EscapeDataString(GetReturnUrl())}")">@Localizer[nameof(AppStrings.SignUp)]</BitLink>
</BitText>
}
</BitStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public partial class SignInPanel
private SignInPanelType internalSignInPanelType;
private readonly SignInRequestDto model = new();
private AppDataAnnotationsValidator? validatorRef;
private string ReturnUrl => ReturnUrlQueryString ?? Urls.HomePage;
private string GetReturnUrl() => ReturnUrl ?? ReturnUrlQueryString ?? Urls.HomePage;

[Parameter]
public string? ReturnUrl { get; set; }

[Parameter, SupplyParameterFromQuery(Name = "return-url")]
public string? ReturnUrlQueryString { get; set; }
Expand Down Expand Up @@ -139,7 +141,7 @@ private async Task DoSignIn()

if (isNewUser is false)
{
model.ReturnUrl = ReturnUrl;
model.ReturnUrl = GetReturnUrl();

requiresTwoFactor = await AuthManager.SignIn(model, CurrentCancellationToken);

Expand Down Expand Up @@ -183,7 +185,7 @@ private async Task DoSignIn()
}
else
{
NavigationManager.NavigateTo(ReturnUrl ?? Urls.HomePage, replace: true);
NavigationManager.NavigateTo(GetReturnUrl(), replace: true);
}
}
}
Expand Down Expand Up @@ -243,7 +245,7 @@ private async Task SocialSignIn(string provider)

var port = localHttpServer.EnsureStarted();

var redirectUrl = await identityController.GetSocialSignInUri(provider, ReturnUrl, port is -1 ? null : port, CurrentCancellationToken);
var redirectUrl = await identityController.GetSocialSignInUri(provider, GetReturnUrl(), port is -1 ? null : port, CurrentCancellationToken);

await externalNavigationService.NavigateToAsync(redirectUrl);
}
Expand Down Expand Up @@ -319,7 +321,7 @@ private async Task SendOtp(bool resend)

var request = new IdentityRequestDto { UserName = model.UserName, Email = model.Email, PhoneNumber = model.PhoneNumber };

await identityController.SendOtp(request, ReturnUrl, CurrentCancellationToken);
await identityController.SendOtp(request, GetReturnUrl(), CurrentCancellationToken);

isOtpSent = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public partial class AuthManager : AuthenticationStateProvider, IAsyncDisposable
[AutoInject] private IUserController userController = default!;
[AutoInject] private ILogger<AuthManager> authLogger = default!;
[AutoInject] private IAuthTokenProvider tokenProvider = default!;
[AutoInject] private ITelemetryContext telemetryContext = default!;
[AutoInject] private IExceptionHandler exceptionHandler = default!;
[AutoInject] private IStringLocalizer<AppStrings> localizer = default!;
[AutoInject] private IIdentityController identityController = default!;
[AutoInject] private IAuthorizationService authorizationService = default!;
[AutoInject] private AbsoluteServerAddressProvider absoluteServerAddress = default!;

public void OnInit()
{
Expand Down Expand Up @@ -61,6 +61,7 @@ await cookie.Set(new()
Value = response.AccessToken,
MaxAge = rememberMe is true ? response.ExpiresIn : null, // to create a session cookie
Path = "/",
Domain = absoluteServerAddress.GetAddress().Host,
SameSite = SameSite.Strict,
Secure = AppEnvironment.IsDevelopment() is false
});
Expand Down Expand Up @@ -223,6 +224,7 @@ await cookie.Remove(new ButilCookie()
{
Name = "access_token",
Path = "/",
Domain = absoluteServerAddress.GetAddress().Host,
SameSite = SameSite.Strict,
Secure = AppEnvironment.IsDevelopment() is false
});
Expand Down
Loading