Merge pull request #3813 from pyramidsbuilder/3805-stop-registration-redirect-without-verification

display verification message instead of redirecting new user before e…
This commit is contained in:
Shaun Walker 2024-02-22 12:34:21 -05:00 committed by GitHub
commit b2dc397fb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,8 @@
@if (PageState.Site.AllowRegistration) @if (PageState.Site.AllowRegistration)
{ {
if (!_userCreated)
{
<AuthorizeView Roles="@RoleNames.Registered"> <AuthorizeView Roles="@RoleNames.Registered">
<Authorizing> <Authorizing>
<text>...</text> <text>...</text>
@ -68,6 +70,7 @@
</form> </form>
</NotAuthorized> </NotAuthorized>
</AuthorizeView> </AuthorizeView>
}
} }
else else
{ {
@ -85,6 +88,7 @@ else
private string _confirm = string.Empty; private string _confirm = string.Empty;
private string _email = string.Empty; private string _email = string.Empty;
private string _displayname = string.Empty; private string _displayname = string.Empty;
private bool _userCreated = false;
private bool _allowsitelogin = true; private bool _allowsitelogin = true;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous;
@ -128,15 +132,9 @@ else
if (user != null) if (user != null)
{ {
await logger.LogInformation("User Created {Username} {Email}", _username, _email); await logger.LogInformation("User Created {Username} {Email}", _username, _email);
if (!string.IsNullOrEmpty(PageState.ReturnUrl)) _userCreated = true;
{
NavigationManager.NavigateTo(PageState.ReturnUrl);
}
else // legacy behavior
{
AddModuleMessage(Localizer["Info.User.AccountCreate"], MessageType.Info); AddModuleMessage(Localizer["Info.User.AccountCreate"], MessageType.Info);
} }
}
else else
{ {
await logger.LogError("Error Adding User {Username} {Email}", _username, _email); await logger.LogError("Error Adding User {Username} {Email}", _username, _email);