Posted on 15/03/2017 15:20:22
Hey Nicolai,
I was not aware of that. I thought the demo environment was just there for that purpose. I could try and get a demo environment running locally I suppose.
Our template doesn't contain an error. Our own solution differs from the demo environment.
Our code looks like this: (can't seem to find a code tag or something, so I hope it renders well)
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="wp-block default user-form">
@if (!string.IsNullOrWhiteSpace(GetString("UserManagement:User.Login.Action=Recovery")))
{
<h3>
@Translate("Get back into your account", "Get back into your account")
</h3>
<br />
<form method="post" action="/Default.aspx?id=@GetString("Global:Page.ID")">
<input type="hidden" name="ForgotPasswordMailTemplate" value="@GetString("UserManagement:User.Login.EmailTemplate")" />
<input type="hidden" name="ForgotPasswordSenderEmail" value="@GetString("UserManagement:User.Login.EmailSender")" />
<input type="hidden" name="ForgotPasswordMailSubject" value="@GetString("UserManagement:User.Login.EmailSubject")" />
@if (GetInteger("UserManagement:User.Login.FoundUsersCount") == 0 || GetInteger("UserManagement:User.Login.FoundUsersCount") >= 1)
{
<div class="info-pane error">@Translate("User not found!", "User not found!")</div>
}
@foreach (LoopItem loginfield in GetLoop("UserManagement:User.Login.Fields"))
{
<div class="pr-field">
<label class="title" for="@loginfield.GetString("Field.Name")">
@loginfield.GetString("Field.Title"):
</label>
@loginfield.GetString("Field.Input")
@if (!string.IsNullOrWhiteSpace(loginfield.GetString("Field.Error")))
{
<label class="error" for="@loginfield.GetString("Field.Name")">@loginfield.GetString("Field.Error")</label>
}
</div>
}
<div class="pr-field commands">
<button type="submit" name="LoginAction" value="Recovery">@Translate("Submit", "Submit")</button>
</div>
</form>
}
@if (GetString("UserManagement:User.Login.Action") == "RecoveryLinkSent")
{
<div class="info-pane">
<div class="title">@Translate("Check your email", "Check your email")</div>
<div class="body">
@Translate("Check your email - we sent you an email with a link. Click it to continue to reset your password.", "Check your email - we sent you an email with a link. Click it to continue to reset your password.")
</div>
</div>
}
@if (GetString("UserManagement:User.Login.Action") == "NewPasswordForm")
{
if (GetBoolean("UserManagement:User.Login.RecoveryToken.FoundUser") != true)
{
<div class="info-pane">
<div class="title">@Translate("Something went wrong", "Something went wrong")</div>
<div class="body">
@Translate("Try recover password", "Try recover password") <a href="/default.aspx?id=@GetString("Global:Page.ID")">@Translate("again", "again")</a>.
</div>
</div>
}
if (GetBoolean("UserManagement:User.Login.RecoveryToken.FoundUser") == true && GetBoolean("UserManagement:User.Login.RecoveryToken.OutOfDate") == true)
{
<div class="info-pane">
<div class="title">@Translate("The recovery password link out of date", "The recovery password link out of date")</div>
<div class="body">
@Translate("The recovery password link out of date", "The recovery password link out of date") @Translate("Try recover password", "Try recover password") <a href="/default.aspx?id=@GetString("Global:Page.ID")">@Translate("again", "again")</a>.
</div>
</div>
}
if (GetBoolean("UserManagement:User.Login.RecoveryToken.FoundUser") == true && GetBoolean("UserManagement:User.Login.RecoveryToken.OutOfDate") != true)
{
<h3 class="head">
@Translate("Choose a new password", "Choose a new password")
<br />
<small>
<strong>@Translate("Notice", "Notice"):</strong> @Translate("A strong password is a combination of letters and punctuation marks", "A strong password is a combination of letters and punctuation marks")
</small>
</h3>
<form method="post" action="/Default.aspx?id=@GetString("Global:Page.ID")">
<input type="hidden" name="RecoveryToken" value="@GetString("UserManagement:User.Login.RecoveryToken")" />
<input type="hidden" name="ForgotPasswordMailTemplate" value="@GetString("UserManagement:User.Login.EmailTemplate")" />
<input type="hidden" name="ForgotPasswordSenderEmail" value="@GetString("UserManagement:User.Login.EmailSender")" />
<input type="hidden" name="ForgotPasswordMailSubject" value="@GetString("UserManagement:User.Login.EmailSubject")" />
<div class="pr-field">
<label class="title" for="@GetString("UserManagement:User.Login.Field.NewPassword.Name")">
@Translate("New Password", "New Password"):
</label>
@GetString("UserManagement:User.Login.Field.NewPassword.Input")
@if (!string.IsNullOrWhiteSpace(GetString("UserManagement:User.Login.Field.NewPassword.Error")))
{
<label class="error" for="@GetString("UserManagement:User.Login.Field.NewPassword.Name")">@GetString("UserManagement:User.Login.Field.NewPassword.Error")</label>
}
</div>
<div class="pr-field">
<label class="title" for="@GetString("UserManagement:User.Login.Field.NewPasswordConfirm.Name")">
Confirm Password:
</label>
@GetString("UserManagement:User.Login.Field.NewPasswordConfirm.Input")
@if (!string.IsNullOrWhiteSpace(GetString("UserManagement:User.Login.Field.NewPasswordConfirm.Error")))
{
<label class="error" for="@GetString("UserManagement:User.Login.Field.NewPasswordConfirm.Name")">@GetString("UserManagement:User.Login.Field.NewPasswordConfirm.Error")</label>
}
</div>
<div class="pr-field commands">
<button type="submit" name="LoginAction" value="ChangePassword">@Translate("Submit", "Submit")</button>
</div>
</form>
}
}
@if (GetString("UserManagement:User.Login.Action") == "PasswordChanged")
{
<div class="info-pane">
<div class="title">Congratulations!</div>
<div class="body">
Password changed
</div>
</div>
}
</div>
</div>
</div>
</div>
--- END CODE ---
I think this is basically the default form. If there are errors in the template then I am not sure where to look. Again if I use another setting the recovery part is shown, but from the demo environment I almost get the idea another template is used in that case.
Kind regards,
Manon Wekking