wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
821 stars 770 forks source link

[Improvement] Should show an understandable error message to non technical users when try to add user without providing email #1739

Closed gvasanka closed 4 years ago

gvasanka commented 6 years ago

Description: [Improvement] Should show an understandable error message to non-technical users when try to add user without providing email

Suggested Labels: Priority/Low Severity/Minor

Suggested Assignees:

Affected Product Version: API 210

OS, DB, other environment details and versions:

Steps to reproduce:

Go to the management console https://openbanking.staging.wso2.com:9443/carbon
Go to "Users and Roles" --> Add -->Add New User
Fill the details on step 1 as below
User Name Asanka Password Asanka Password Repeat Asanka
4 Select the Roles and click finish

Issue: Getting issue as in attached image which is not understandable selection_269

Related Issues: https://github.com/wso2/financial-open-banking/issues/328

msm1992 commented 6 years ago

The message shown in the error dialog box is configured in user-mgt.xml (in case of a primary userstore) under the relevant <UserStoreManager> as follows. <Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property> In case this property is missing, the below default error message is shown. “Entered user name is not conforming to policy. Please enter a user name, which adheres to policy.”

So you should be able to resolve this concern by setting a meaningful error message in the relevant <UserStoreManager> in <PRODUCT_HOME>/repository/conf/user-mgt.xml. (For secondary user stores changes should be applied to relevant config files in <PRODUCT_HOME>/repository/deployment/server/userstores folder)

For more details below is the source code governing this behaviour. [1]. https://github.com/wso2-support/carbon-identity-framework/blob/support-5.7.5/components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/add-step1.jsp#L190

gvasanka commented 6 years ago

Now I have the following config for both Primary and Secondary user stores

Username pattern policy violated.

When I am adding an invalid user to Primary user store, getting above configured error message. But when adding to secondary user store getting an error message as below. selection_345

msm1992 commented 6 years ago

For the error with secondary userstores, will you please check whether the following regex property is set to an appropriate regex value (to support email usernames) in your secondary user store configuration ?

Ex: <Property name="UsernameJavaScriptRegEx">^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$</Property>

If not, please add and check whether you are getting the expected error message thereafter.

chamilaadhi commented 4 years ago

closing since an answer is provided