adfsWebCustomization icon indicating copy to clipboard operation
adfsWebCustomization copied to clipboard

Add domain to paginatedOnload.js

Open ghost opened this issue 5 years ago • 2 comments

Hi,

How can i add the domain to the userfield like we did before in our 2012 adfs onload.js like this:


if (typeof Login != 'undefined'){
    Login.submitLoginRequest = function () { 
    var u = new InputUtil();
    var e = new LoginErrors();
    var userName = document.getElementById(Login.userNameInput);
    var password = document.getElementById(Login.passwordInput);
    if (userName.value && !userName.value.match('[@\\\\]')) 
    {
        **var userNameValue = 'contoso.com\\' + userName.value;**
        document.forms['loginForm'].UserName.value = userNameValue;
    }

    if (!userName.value) {
       u.setError(userName, e.userNameFormatError);
       return false;
    }

Where should i add this in the code for paginatedonload.js

var usernameInput = document.getElementById("userNameInput");
var passwordInput = document.getElementById('passwordInput');

if ( usernameInput && passwordInput)
{
    var username = document.getElementById('userNameArea');
    var passArea = document.getElementById('passwordArea');
    
    var submitButton = document.getElementById('submitButton');
    var submissionArea = document.getElementById('submissionArea');
    var errorText = document.getElementById('errorText');
    var errorDisplay = document.getElementById('error');
    var workArea = document.getElementById('workArea');
    
    var loginMessage = document.getElementById('loginMessage');
    var originalLoginMessage = "";
    var didLoadPasswordPageBefore = false;

ghost avatar Oct 16 '20 14:10 ghost

I would like to know this as well.

My guess would be:

var usernameInput = document.getElementById("userNameInput");
var passwordInput = document.getElementById('passwordInput');

if ( usernameInput && passwordInput)
{
    var username = document.getElementById('userNameArea');
    var passArea = document.getElementById('passwordArea');
    
    // Allows the user to not have to specify the domain in the username field.
    if (username.value && !username.value.match('[@\\\\]')) 
    {
        var usernameValue = 'contoso.com\\' + username.value;
        document.forms['loginForm'].username.value = usernameValue;
    }

    var submitButton = document.getElementById('submitButton');
    var submissionArea = document.getElementById('submissionArea');
    var errorText = document.getElementById('errorText');
    var errorDisplay = document.getElementById('error');
    var workArea = document.getElementById('workArea');
    
    var loginMessage = document.getElementById('loginMessage');
    var originalLoginMessage = "";
    var didLoadPasswordPageBefore = false;

tjc-jhol avatar Jan 06 '21 16:01 tjc-jhol

Or actually, I think you just add it somewhere in the file relooking at it.

tjc-jhol avatar Jan 06 '21 17:01 tjc-jhol