ADFS Login with Only Username (Eliminating Domain Name for Login)

      Comments Off on ADFS Login with Only Username (Eliminating Domain Name for Login)

Open PowerShell on ADFS Server with run as Administartor

PowerShell Command to Create New ADFS Theme

New-AdfsWebTheme Name ThemeName SourceName default

 PowerShell Command to Export ADFSTheme files

Export-AdfsWebTheme Name default DirectoryPath c:\theme

Update below mentioned code into Script file of (C:\Theme\Script\onload.js)

Note:

Just Change the Domain with your internal Windows Domain NetBIOS NameMIFAROOK

——

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 = ‘MIFAROOK\\’ + userName.value;
        document.forms[‘loginForm’].UserName.value = userNameValue;
    }

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

    if (!password.value)
    {
        u.setError(password, e.passwordEmpty);
        return false;
    }
    document.forms[‘loginForm’].submit();
    return false;
};
}

——

After modifying with above mentioned script on Onload.js, Save it and uplaod it using PowerShell Command.

Set-AdfsWebTheme -TargetName ThemeName -AdditionalFileResource @{Uri=’/adfs/portal/script/onload.js’;path="c:\theme\script\onload.js"}

PowerShell Command to Set Username Theme to Default

Set-AdfsWebConfig -ActiveThemeName ThemeName

Once Updated, You can login with only Username, No more require to put domain name before or after UserName