Skip to content

Instantly share code, notes, and snippets.

@hfloyd
Last active April 27, 2021 20:27
Show Gist options
  • Save hfloyd/8bce4f6ad53f56bdafb6f8a783097aea to your computer and use it in GitHub Desktop.
Save hfloyd/8bce4f6ad53f56bdafb6f8a783097aea to your computer and use it in GitHub Desktop.
Umbraco 8: Example of Thank you page after "Save As Member" workflow runs
@inherits UmbracoViewPage<IPublishedContent>
@{
var result = Umbraco8FormsMembersHelper.GetWorkflowResult();
if (result != null)
{
if (result.WorkflowResult == WorkflowExecutionStatus.Failed)
{
//Failure - Show some messages
<h3>Oops! There was a problem registering you with that information.</h3>
if (result.Errors.ContainsKey(Umbraco8FormsMembersHelper.SaveError.InvalidPassword))
{
<p>That password doesn't meet security requirements</p>
}
if (result.Errors.ContainsKey(Umbraco8FormsMembersHelper.SaveError.EmailAlreadyRegistered))
{
<p>That email address is already registered. Would you like to <a href="/Login">Login</a>?</p>
}
foreach (var error in @result.Errors)
{
<!--@error.Key = @error.Value-->
}
<input action="action" type="button" value="Try Registering Again" onclick="window.history.go(-1); return false;" />
}
else
{
//Success
//Optional - run other post-registration code
var updatedMember = UpdateNewMember(result.NewMemberId);
if (updatedMember != null)
{
<h3>Thanks for Registering, @updatedMember.FirstName!</h3>
}
else
{
<h3>Thanks for Registering!</h3>
}
}
}
else
{
<p>Hmm... something didn't work.</p>
}
@Html.Partial("MemberLogout", Model)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment