Skip to content

Instantly share code, notes, and snippets.

@raphiz
Last active January 26, 2016 12:21
Show Gist options
  • Save raphiz/96c2b07dacda746dd2f5 to your computer and use it in GitHub Desktop.
Save raphiz/96c2b07dacda746dd2f5 to your computer and use it in GitHub Desktop.
Moodle HSR Autologin Raw

Autologin for https://moodle.hsr.ch/ with the power of userscripts.

Please note that you should from a security point of view store the username and password using the browsers built-in password manager! To do so, store the before installing these scripts and remove the highlighted two lines from moodle_autologin_2.js. Otherwise, replace the and values with your credentials.

// ==UserScript==
// @name moodle_autologin_1
// @namespace http://raphael.li/moodle1/
// @version 0.1
// @description Moodle autologin - part 1
// @match https://moodle.hsr.ch
// @match https://moodle.hsr.ch/login_hsr/*
// @require http://code.jquery.com/jquery-latest.js
// @copyright 2015+, Raphi
// ==/UserScript==
$("#user_idp").val("https://aai-login.hsr.ch/idp/shibboleth");
$("#wayf_submit_button").click()
// ==UserScript==
// @name moodle_autologin_2
// @namespace http://raphael.li/moodle2/
// @version 0.1
// @description Moodle autologin - part 2
// @match https://aai-login.hsr.ch/idp/Authn/UserPassword
// @require http://code.jquery.com/jquery-latest.js
// @copyright 2015+, @raphiz
// ==/UserScript==
// TODO: remove the next two lines when using the browser built-in browser. Otherwise, replace <username> and <password> with your credentials
$('input[name=\'j_username\'').attr('value', '<username>');
$('input[name=\'j_password\'').attr('value', '<password>');
$('input[name=\'submit\'').click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment