Greetings again Andrei,
just to add to my previous post - we propose the same modification to the new Consent elements on the Register page, too.
Kind Regards,
Valentin.
var dbContext = EngineContext.Current.Resolve<IDbContext>() as DbContext;
var type = dbContext?.Model.FindRuntimeEntityType(entity.GetType()).ClrType;
var keyGroup = entity.GetUnproxiedEntityType().Name;
protected virtual string GetUnproxiedEntityTypeName()
{
// some default implementation of your choice that will work for the default entities
}
@if (Model.GdprConsents.Count > 0)
{
<div class="fieldset">
<div class="form-fields">
@foreach (var consent in Model.GdprConsents)
{
if (consent.IsRequired)
{
<script asp-location="Footer">
$(document).ready(function() {
$('#save-info-button').click(function() {
if ($('#consent@(consent.Id)').is(':checked')) {
//do some stuff
return true;
} else {
//just show validation errors, don't post
alert('@Html.Raw(JavaScriptEncoder.Default.Encode(consent.RequiredMessage))');
return false;
}
});
});
</script>
}
<div class="inputs accept-consent">
<input id="consent@(consent.Id)" type="checkbox" name="consent@(consent.Id)" checked="@consent.Accepted" />
<label for="consent@(consent.Id)">@consent.Message</label>
</div>
}
</div>
</div>
}