Here is a GreaseMonkey Script that changes the languages options on the PeopleSoft login page to users’ names. When you click on the user’s name, it populates the username and password. It is great for when you are testing Workflow or something like that.
// ==UserScript== // @name PSautologin // @namespace http://psst0101.wordpress.com // @description Automatic Login for PS // @include http://ps_server:*/psp/*/EMPLOYEE/ERP/?cmd=logout // @include http://ps_server:*/psp/*/?cmd=login* // @include http://ps_server:*/psp/HR90CNV/*/HRMS/?cmd=logout // ==/UserScript== // set up jQuery variable var $; // Add jQuery var GM_JQ = document.createElement("script"); GM_JQ.src = "http://code.jquery.com/jquery-latest.min.js"; GM_JQ.type = "text/javascript"; document.body.appendChild(GM_JQ); // Check if jQuery's loaded var checker=setInterval(function(){ if(typeof ($ = unsafeWindow.jQuery) != "undefined") { clearInterval(checker); letsJQuery(); } },100); // All your GM code must be inside this function function letsJQuery() { var selectALanguage = $('.pslanguageframe .psloginlabel:contains("Select a Language")'); selectALanguage.text("Select A User:"); $('.pslanguageframe .pslogintext').toggleClass('skpremove'); $('.pslanguageframe .pslogintext').text("Hello"); $('.pslanguageframe .textnormal').remove(); $('.pslanguageframe .pslogintext:first').text("test"); addUser('PS', 'PS'); addUser('VP1', 'VP1'); $('.pslanguageframe .skpremove').remove(); $('table:first table:first > tbody > tr:eq(1) td').html('<a href="http://serverWithList/">Other Instances</a>'); } function addUser(userName, password) { var newLink = $('.pslanguageframe .skpremove:first').html("<a href='javascript:login'>" + userName + "</a>").toggleClass('skpremove').children('a'); newLink.attr('userName', userName); newLink.attr('password', password); newLink.click(loginwith); } function loginwith() { userName = $(this).attr('userName'); password = $(this).attr('password'); $('#userid').val(userName); $('#pwd').val(password); // don't trigger URL for link return false; }
Great work! And great idea for a GreaseMonkey script!
I hope you don’t mind, but I’ve taken your lead, and added a few enhancements. Instead of hard-coding credentials in the script, I capture them during log-in and prompt to store new credentials. (These are stored in an environment-specific cookie.)
I also added support for PeopleTools 8.47. Because the the page’s HTML is slight different, the jQuery selectors in the above code didn’t find their targets.
Install:
http://userscripts.org/scripts/show/51998
View source code:
http://userscripts.org/scripts/review/51998
Rick,
This is really great. I haven’t had the chance to try it out myself, but I hope to create a new post to bring more attention to your changes.
Thanks,
Stephen
Hi ,
How to use the above script.
shoul i run it as a batch file ?
I looking for a similar script that login peoplsoft automatically .
Aravind.