Unable to translate "Verification code has been sent. Please copy it to the input box below." message - azure-ad-b2c

I'm unable to translate the text "Verification code has been sent. Please copy it to the input box below." on my Sing up page using Azure AD B2C.
I tried the solution on Cant customize the Verification code message, but it didn't work for me. I was able to translate all the other texts on the page, but not this one.
I tried doing the following with no success:
<ContentDefinition Id="api.localaccountsignup">
<LoadUri>~/tenant/templates/AzureBlue/selfAsserted.cshtml</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.1</DataUri>
<Metadata>
<Item Key="DisplayName">Local account Signup</Item>
</Metadata>
<LocalizedResourcesReferences MergeBehavior="Prepend">
<LocalizedResourcesReference Language="pt" LocalizedResourcesReferenceId="localaccountsignup.pt" />
</LocalizedResourcesReferences>
</ContentDefinition>
...
<LocalizedResources Id="localaccountsignup.pt">
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="verification_control_code_sent">Test.</LocalizedString>
...
When I try inserting the code above, I get the error:
Validation failed: 1 validation error(s) found in policy
"B2C_1A_PHONE_EMAIL_BASE" of tenant "MYWEBSITE.com".The
localized string with ElementType: UxElement and StringId:
verification_control_code_sent has an invalid StringIdThe localized
string with ElementType: UxElement and StringId:
verification_control_code_sent has an invalid StringId
I tried a lot of other things too, with no success.

I ended up getting this to work by changing the localization string to have the ElementType of a DisplayControl.
<LocalizedResources Id="localaccountsignup.pt">
<LocalizedStrings>
<LocalizedString ElementType="DisplayControl" ElementId="NAME_OF_YOUR_PHONE_CONTROL" StringId="success_send_code_msg"> </LocalizedString>
</LocalizedStrings>
</LocalizedResources>
I found the code by looking in the attribute in the web console:
Made an issue on github about this: https://github.com/MicrosoftDocs/azure-docs/issues/70611

Thanks and Please try and let us know if you need more information.
urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.0.0
and add "contract" into all content definition dataURIs like this, only selfasserted needs to be 2.0.0
https://learn.microsoft.com/en-us/azure/active-directory-b2c/contentdefinitions#migrating-to-page-layout
and then follow this https://learn.microsoft.com/en-us/azure/active-directory-b2c/javascript-samples#add-the-scriptexecution-element

Related

Azure B2C Sign up age restriction using custom policies

I'm trying to configure a B2C tenant using policies instead of user flows. For that, I'm using the SocialAndLocalAccount template as start base.
In the sign up page, I added a custom claim to ask the user about his/her birth date. If the user provides a date which make him/her an under age (+18), I would like to display a verification failed message (like the one you can set by using predicates) and prevent the user to be able to sign up by the create button being disabled.
So far, this is what I've got:
-I created two new claims to store a boolean value that would tell me if the user is under age or not and a second one to store the current time.
<ClaimType Id="systemDateTime">
<DisplayName>Today's date</DisplayName>
<DataType>dateTime</DataType>
</ClaimType>
<ClaimType Id="isNotUnderAge">
<DisplayName>Indicates whether user being under age or not</DisplayName>
<DataType>boolean</DataType>
<AdminHelpText>User must be over 18</AdminHelpText>
</ClaimType>
I added to ClaimsTransformation to get the current date and compare it to the selected one (date comparison):
<!-- Check user under age -->
<ClaimsTransformation Id="GetSystemDateTime" TransformationMethod="GetCurrentDateTime">
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="systemDateTime" TransformationClaimType="currentDateTime" />
</OutputClaims>
</ClaimsTransformation>
<ClaimsTransformation Id="CheckBirthDateIsNotUnderAge" TransformationMethod="DateTimeComparison">
<InputClaims>
<InputClaim ClaimTypeReferenceId="birthDate" TransformationClaimType="firstDateTime" />
<InputClaim ClaimTypeReferenceId="systemDateTime" TransformationClaimType="secondDateTime" />
</InputClaims>
<InputParameters>
<InputParameter Id="operator" DataType="string" Value="later than" />
<InputParameter Id="timeSpanInSeconds" DataType="int" Value="568025136" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="isNotUnderAge" TransformationClaimType="result" />
</OutputClaims>
</ClaimsTransformation>
Until this point, I think I'might be able to tell if the user is under age or not. From here on, I'm not sure how to continue in order to achieve my goal. I've been reading documentation but didn't come to a solution and I'm unsure that this would be the best approach.
Have you ever came across a similar restriction? If so, which is the best way to achieve this and where can I find any tips that help me resolve my issue?
Thank you very much!
EDIT 1:
I've found this question which explains a similar problem if not the same and it make me ask myself, is it possible to achieve this by using ClaimsTransformations and Predicates or is the REST API the only way to get the expected result?
It looks like you have the right idea as long as you want to blanket ban all users under 18. One option is you can use a validation technical profile to call AssertBooleanClaimIsEqualToValue transformation, which will display a custom error message on the sign-in page if the user is under 18 and won't let them continue. See Microsoft Documentation: Boolean Claim Transformations for example.
If you really want the Continue button to grey out, you could display isNotUnderage as a readonly claim and hide it with CSS, and then use JS to grey out the button based on its value.
The third option is to add an OrchestrationStep before presenting the user with your signup options with a precondition to skip if user is over 18 that will display a new Self-Asserted Technical Profile you can set up to display an error message (just a paragraph claim) and remove the continue button from. The downside here is that it requires you collect the user's age before offering them sign-up options which can complicate things.

Azure B2C Datepicker (Calendar)

I'm creating a custom policy that must do the following:
1. If the user clicks to Sign up, show a screen with three input fields that are:
a. A key (string)
b. date of birth (I would like to display a calendar)
c. another key (string)
However, after reading all the documentation Add claims and customize user input using custom policies in Azure Active Directory B2C and searching in Google, I couldn't find a way to create a "Datepicker" input field in Azure B2C.
How can I accomplish that?
Thank you
<ClaimType Id="dateOfBirth">
<DisplayName>Date of Birth</DisplayName>
<DataType>date</DataType>
<AdminHelpText>The user's date of birth.</AdminHelpText>
<UserHelpText>Your date of birth.</UserHelpText>
<UserInputType>DateTimeDropdown</UserInputType>
<PredicateValidationReference Id="CustomDateRange" />
</ClaimType>
Use DateTimeDropdown.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/claimsschema
Complementing #Jonny answer, you canconfigure the custom data range validation like so:
<BuildingBlocks>
<ClaimsSchema>
<ClaimType Id="dateOfBirth">
<DisplayName>Date of Birth</DisplayName>
<DataType>date</DataType>
<AdminHelpText>The user's date of birth.</AdminHelpText>
<UserHelpText>Your date of birth.</UserHelpText>
<UserInputType>DateTimeDropdown</UserInputType>
<PredicateValidationReference Id="CustomDateRange" />
</ClaimType>
<Predicates>
<Predicate Id="DateRange" Method="IsDateRange" HelpText="The date must be between 01-01-1980 and today.">
<Parameters>
<Parameter Id="Minimum">1980-01-01</Parameter>
<Parameter Id="Maximum">Today</Parameter>
</Parameters>
</Predicate>
</Predicates>
<PredicateValidations>
<PredicateValidation Id="CustomDateRange">
<PredicateGroups>
<PredicateGroup Id="DateRangeGroup">
<PredicateReferences>
<PredicateReference Id="DateRange" />
</PredicateReferences>
</PredicateGroup>
</PredicateGroups>
</PredicateValidation>
</PredicateValidations>
</ClaimsSchema>
</BuildingBlocks>
Helpful links:
BuildingBlocks
Predicates and PredicateValidations

Unable to Get Paragraph InputType to Display Any Text In Azure B2C IEF

I am having some trouble using the Paragraph UserInput Type available to Azure B2C IEF. I would like to use the Paragraph element because it would make localization a lot easier. However, no matter what I have tried, I am unable to get the Paragraph element to display any text.
I have tried to follow the documentation: https://learn.microsoft.com/en-us/azure/active-directory-b2c/claimsschema#paragraph and I have also contacted the B2C Team via GitHub and was recommended I assign default values.
ClaimType
<ClaimType Id="UserExistsErrorMessage">
<DisplayName>Error Message</DisplayName>
<DataType>string</DataType>
<UserInputType>Paragraph</UserInputType>
</ClaimType>
In my technical profile I am assigning a default value
<OutputClaim ClaimTypeReferenceId="UserExistsErrorMessage" DefaultValue="Test">
I am expecting the paragraph to display the text that I have assigned. Instead all I am getting is a blank < p>< /p> HTML tags when reviewing the source during testing.
To set the value of Paragraph UserInputType, please set default value using input claim.
<InputClaims>
<InputClaim ClaimTypeReferenceId="UserExistsErrorMessage" DefaultValue="Test"/>
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="UserExistsErrorMessage"/>
</OutputClaims>
I believe it's the Enumeration value that must be set to the display value:
<ClaimType Id="UserExistsErrorMessage">
<DisplayName>Error Message</DisplayName>
<DataType>string</DataType>
<UserInputType>Paragraph</UserInputType>
<Restriction>
<Enumeration Text="Test" Value="This is a test message." />
</Restriction>
</ClaimType>

no resource found on android studio

i have a little problem
for my activities, i created 2 differents styles, i had no problem with it but suddenly it couldn't build anymore,
i had 4 errors
"No resource found that matches the given name: attr 'textColor'"
"No resource found that matches the given name: attr 'textSize'"
"No resource found that matches the given name: attr 'textColor'"
"No resource found that matches the given name: attr 'textSize'"
on the /app/build/intermediates/res/merged/debug/values/values.xml.
and i have no idea how to fix it
The message you have shared seems there is a problem in the debug.
So you can simply perform CLEAN_PROJECT from the BUILD OPTION and then REBUILD_PROJECT.
If that still fails, try restarting the Android Studio.
ok, here is what i added in the styles :
<style name="title">
<item name="android:layout_margin">20dp</item>
<item name="android:gravity">center</item>
<item name="android:textSize">30sp</item>
<item name="android:textColor">#color/colorAccent</item>
<item name="android:textStyle">bold</item>
</style>
<style name="text">
<item name="android:layout_marginTop">30dp</item>
<item name="android:gravity">center</item>
<item name="textSize">15sp</item>
<item name="textColor">#color/colorPrimary</item>
<!-- <item name="android:textStyle"></item> -->
</style>
which has been added into the values file, in the intermediates res.
and the error is precisely in this file.

Disable 'assign to' at workflow notifications

I'm working with Liferay Workflow and I've got a problem. The workflow goes this way: the user submits an asset and when the reviewer approves it, a notification is sent to the author. If the user opens the notification, there will be an option to assign the next workflow task to himself. But the user has not the responsible role to do this. It happens only at notifications, if the user goes to My account > My workflow tasks, there will be nothing assigned to him or his roles.
Any ideas how to solve it? Thanks in advance!
this is some code from a working workflow where the "asset creator" does not need to assign the task to himself. I think you need to put in the assignment, "user" reflects to the asset creator.
<task>
<name>update</name>
<metadata><![CDATA[{"xy":[160,208],"transitions":{"resubmit":{"bendpoints":[[178,171]]},"Submit changes":{"xy":[-18,2],"bendpoints":[[178,171]]}}}]]></metadata>
<actions>
<notification>
<name>update notification</name>
<template>${taskComments}</template>
<template-language>freemarker</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user/>
</recipients>
<execution-type>onEntry</execution-type>
</notification>
<notification>
<name>update email notification</name>
<description>Update required</description>
<template>Dear ${userName}<br></template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<recipients>
<user/>
</recipients>
<execution-type>onEntry</execution-type>
</notification>
</actions>
<assignments>
<user></user>
</assignments>
<task-timers>
<task-timer>
<name>default-assignment</name>
<delay>
<duration>1</duration>
<scale>minute</scale>
</delay>
<blocking>true</blocking>
<timer-actions>
<timer-notification>
<name>reminder update</name>
<description>Reminder: update needed</description>
<template>Dear ${userName}<br></template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
</timer-notification>
<reassignments>
<user></user>
</reassignments>
</timer-actions>
</task-timer>
</task-timers>
<transitions>
<transition>
<name>submit changes</name>
<target>review</target>
</transition>
</transitions>
</task>

Resources