View RSS Feed

FN-GM

Office 365 with ADFS 3.0 - Login with username instead of email address

Rate this Entry
by , 17th July 2014 at 11:49 PM (5304 Views)
Hi all,

When we where looking into Office 365, on the ADFS login screen, we found we would prefer it if the user could login with the network username instead of email address. This is so it matches the rest of our services. with Active Directory Federated Services 3 we found on Server 2012 R2 wouldn't allow us to do this out of the box. The next closest thing was logging in with domain\username format.

However thanks to users on the Microsoft forum i have put some code together so the email address is populated automatically, allowing users to enter only a username.

You need to put the code in the bottom of the onload.js file. Just change the domain example.com to your domain name. Information on how to modify this can be found here..

The downside is all your username will need to be on the same email domain.

Hope someone finds this handy.

Code:
// Check whether the loginMessage element is present on this page.
var loginMessage = document.getElementById('loginMessage');
if (loginMessage)
{
       // loginMessage element is present, modify its properties.
       loginMessage.innerHTML = 'Sign in with your network username and password';
}


//remove email address requirement
function runScript(e) {
    if (e.keyCode == 13) {
        AppendUPN();
    return Login.submitLoginRequest();
    }
}

var AppendUPN = function () {
var userName = document.getElementById(Login.userNameInput);
var lowerUserName = userName.value.toLowerCase();

//Check to see if they already included the UPN
var li = lowerUserName.lastIndexOf('@example.com');
if (li == -1)
{
    userName.value = userName.value + '@exaple.com';
}

return true;
}

document.getElementById('submitButton').onclick = new Function('AppendUPN();return Login.submitLoginRequest();');
document.getElementById('passwordInput').onkeypress = runScript;

document.getElementById("userNameInput").placeholder="Username";

Updated 18th July 2014 at 12:12 AM by FN-GM

Categories
Uncategorized

Comments

Trackbacks

Total Trackbacks 0
Trackback URL: