Jump to content
  • entries
    14
  • comments
    21
  • views
    266

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


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.

 


// 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";

Edited by FN-GM

2 Comments


Recommended Comments

SebD

Posted

Great post - thank you very much, this worked a treat.

You don't happen to know how to make the same change on the 'Password Change' screen for AD FS 4.0?

FN-GM

Posted

I haven't touched version 4 as yet. It is on my list of things to do though. I will let you know when I get chance.

 

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...