ADFS 3.0 not allowing login for SAMAccountname - 'Enter your user ID in the format "domain\user" or "user@domain"' RRS feed

  • Question

  • Hi,

    Moving from ADFS 2.0 to 3.0.

    configured the new environment with the existing farm and tested (using the hosts file, etc.)


    I have read several articles mentioning that to customize the login page to allow users to login with the SAMAccount name  instead of 'user@email.com' OR 'Domain\User' i would need to modify the onboard.js file.

    I have exported the content and have the onboard.js file to edit. I have changed the 'contoso.com' part to our domain, as advised in the Microsoft Technet article.

    Tried it, and it doesn't recognize. even after restarting the ADFS services and also restarting.

    Also note the the company orignally started with a different Domain to our current UPN (eg. 'smallcompany.net' to 'smallMediumCompany.net') so users can login with 'SMALLCOMPANY\User' or 'user@smallmediumcompany.net'.

    would there be any extra values i need to enter for this? 

    my current onboard.js file is shown below:

    // Copyright (c) Microsoft Corporation.  All rights reserved.
    // This file contains several workarounds on inconsistent browser behaviors that administrators may customize.
    "use strict";
    // iPhone email friendly keyboard does not include "\" key, use regular keyboard instead.
    // Note change input type does not work on all versions of all browsers.
    if (navigator.userAgent.match(/iPhone/i) != null) {
        var emails = document.querySelectorAll("input[type='email']");
        if (emails) {
            for (var i = 0; i < emails.length; i++) {
                emails[i].type = 'text';
    // In the CSS file we set the ms-viewport to be consistent with the device dimensions, 
    // which is necessary for correct functionality of immersive IE. 
    // However, for Windows 8 phone we need to reset the ms-viewport's dimension to its original
    // values (auto), otherwise the viewport dimensions will be wrong for Windows 8 phone.
    // Windows 8 phone has agent string 'IEMobile 10.0'
    if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
        var msViewportStyle = document.createElement("style");
    // If the innerWidth is defined, use it as the viewport width.
    if (window.innerWidth && window.outerWidth && window.innerWidth !== window.outerWidth) {
        var viewport = document.querySelector("meta[name=viewport]");
        viewport.setAttribute('content', 'width=' + window.innerWidth + 'px; initial-scale=1.0; maximum-scale=1.0');
    // Gets the current style of a specific property for a specific element.
    function getStyle(element, styleProp) {
        var propStyle = null;
        if (element && element.currentStyle) {
            propStyle = element.currentStyle[styleProp];
        else if (element && window.getComputedStyle) {
            propStyle = document.defaultView.getComputedStyle(element, null).getPropertyValue(styleProp);
        return propStyle;
    // The script below is used for downloading the illustration image 
    // only when the branding is displaying. This script work together
    // with the code in PageBase.cs that sets the html inline style
    // containing the class 'illustrationClass' with the background image.
    var computeLoadIllustration = function () {
        var branding = document.getElementById("branding");
        var brandingDisplay = getStyle(branding, "display");
        var brandingWrapperDisplay = getStyle(document.getElementById("brandingWrapper"), "display");
        if (brandingDisplay && brandingDisplay !== "none" &&
            brandingWrapperDisplay && brandingWrapperDisplay !== "none") {
            var newClass = "illustrationClass";
            if (branding.classList && branding.classList.add) {
            } else if (branding.className !== undefined) {
                branding.className += " " + newClass;
            if (window.removeEventListener) {
                window.removeEventListener('load', computeLoadIllustration, false);
                window.removeEventListener('resize', computeLoadIllustration, false);
            else if (window.detachEvent) {
                window.detachEvent('onload', computeLoadIllustration);
                window.detachEvent('onresize', computeLoadIllustration);
    if (window.addEventListener) {
        window.addEventListener('resize', computeLoadIllustration, false);
        window.addEventListener('load', computeLoadIllustration, false);
    else if (window.attachEvent) {
        window.attachEvent('onresize', computeLoadIllustration);
        window.attachEvent('onload', computeLoadIllustration);
    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 = 'SMALLCOMPANY.net\\' + 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;
        return false;

    Any suggestions?

    Thursday, November 3, 2016 9:00 AM

All replies

  • found a similar thread here, could you check if this is helpful


    Linus || Please mark posts as answers/helpful if it answers your question.

    Thursday, November 3, 2016 2:12 PM