Email Id gets displayed as riddhi.thack... in set authorization while hitting an api proxy

Not applicable

email.png

How to display complete email address? Once we save, it converts it to some format like riddhi.thack...

How can we change this ? We are working on Developer Portal, we need to know which file we can edit to change this defect?

Solved Solved
1 8 184
1 ACCEPTED SOLUTION

@Riddhi Thacker , Thank you for highlighting same.

Yes, I have seen this bug with smartdocs. Especially, When we have used Apigee Edge Management API smartdocs in Apigee @docs .

To answer your question, It's the JS file, "/profiles/apigee/modules/custom/devconnect/smartdocs/local/js/v6/model.js" code (line no : 666) which is trimming the email address. I don't know why we have done this on purpose. I clearly see it as a bug.

To fix above issue, You should not change the core files. Remember the first rule of working with Developer Portal is don't hack core. All customizations should go into sites/all directory.

To fix above issue,

Step 1 : Create a js file inside your theme js folder, Let's say, smartdocsfix.js , Use below code,

jQuery(document).ready(function() {
    var fixEmailTrim = function() {
        var basicAuthCredentials = "";
        if (localStorage.apisBasicAuthDetails) {
            basicAuthCredentials = localStorage.apisBasicAuthDetails;
        } else if (sessionStorage.apisBasicAuthDetails) {
            basicAuthCredentials = sessionStorage.apisBasicAuthDetails;
        }
        if (basicAuthCredentials !== "") {
            userEmail = basicAuthCredentials.split("@@@")[1];
            jQuery("#inputEmail").val(userEmail);
        }
    }
    fixEmailTrim();
    jQuery("[data-role='basic_auth_modal']").find("a.button_save_modal").click(fixEmailTrim);
});

Add js file using theme template file, We have to execute it after orginal js file to override default behaviour,

Step 2 : Add js file using below code in your theme template.php file, replace <THEMENAME> with your active custom theme.

function <THEMENAME>_preprocess_node(&$vars) {
    drupal_add_js(drupal_get_path('theme', '<THEMENAME>') . '/js/smartdocsfix.js',  array('group' => JS_THEME, 'scope' => 'footer', 'weight' => '-100000'));
}

Step 3 : Clear all caches, See fix in action.

I have tested above fix & works as expected. Hope it helps.

View solution in original post

8 REPLIES 8

@Riddhi Thacker , Thank you for highlighting same.

Yes, I have seen this bug with smartdocs. Especially, When we have used Apigee Edge Management API smartdocs in Apigee @docs .

To answer your question, It's the JS file, "/profiles/apigee/modules/custom/devconnect/smartdocs/local/js/v6/model.js" code (line no : 666) which is trimming the email address. I don't know why we have done this on purpose. I clearly see it as a bug.

To fix above issue, You should not change the core files. Remember the first rule of working with Developer Portal is don't hack core. All customizations should go into sites/all directory.

To fix above issue,

Step 1 : Create a js file inside your theme js folder, Let's say, smartdocsfix.js , Use below code,

jQuery(document).ready(function() {
    var fixEmailTrim = function() {
        var basicAuthCredentials = "";
        if (localStorage.apisBasicAuthDetails) {
            basicAuthCredentials = localStorage.apisBasicAuthDetails;
        } else if (sessionStorage.apisBasicAuthDetails) {
            basicAuthCredentials = sessionStorage.apisBasicAuthDetails;
        }
        if (basicAuthCredentials !== "") {
            userEmail = basicAuthCredentials.split("@@@")[1];
            jQuery("#inputEmail").val(userEmail);
        }
    }
    fixEmailTrim();
    jQuery("[data-role='basic_auth_modal']").find("a.button_save_modal").click(fixEmailTrim);
});

Add js file using theme template file, We have to execute it after orginal js file to override default behaviour,

Step 2 : Add js file using below code in your theme template.php file, replace <THEMENAME> with your active custom theme.

function <THEMENAME>_preprocess_node(&$vars) {
    drupal_add_js(drupal_get_path('theme', '<THEMENAME>') . '/js/smartdocsfix.js',  array('group' => JS_THEME, 'scope' => 'footer', 'weight' => '-100000'));
}

Step 3 : Clear all caches, See fix in action.

I have tested above fix & works as expected. Hope it helps.

@Marsh Gardiner @Chris Novak @Dino FYI ^^ , It's a one line fix , How can we push this fix in next release ?

Thank you for Solution. It's working fine when you save credentials, but when you select checkbox Remember credentials for 30 days it again displays riddhi.thack... Is there something we can do to fix this ?

@Riddhi Thacker , I am unable to reproduce same. Do you see the truncated one in the textbox ? Can you make sure browser cache is cleared before you try same ?

First time when we save it, it displays complete credentials. Opening the same thing 2-3 times it displays trimmed value.

This is a bug. I always run into this when re-entering my credentials after 30 days. When I click in the email box, the drop-down gives me a clipped username (smartdocs-auth.png). When I first selected the clipped value, I assumed SmartDocs knew what the rest of my email was. But it's actually a literal value with an ellipsis. So auth fails. You need to always type your full email and ignore the clipped suggestion.

@Floyd Jones , It's a single line fix, We need to remove the line which is trimming the value. @harsh , @Marsh Gardiner , @Ali Beatty ^^

Thanks as always, @Anil Sagar! I'm guessing this will be a lower eng priority since there's an easy workaround. So this fix will help interested folks in the meantime.