-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoLogin.js
47 lines (41 loc) · 1.75 KB
/
AutoLogin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// ==UserScript==
// @name SSO UI, EMAS2, SCELE, and SIAK-NG AutoLogin
// @namespace http://tampermonkey.net/
// @version 2.3
// @description This userscript is made to automatically login to UI websites using your account credentials.
// @author absolutepraya
// @match https://scele.cs.ui.ac.id/
// @match https://scele.cs.ui.ac.id/login/index.php
// @match https://emas2.ui.ac.id/login/index.php
// @match https://academic.ui.ac.id/main/Authentication/
// @match https://sso.ui.ac.id/cas/login*
// @match https://sso.ui.ac.id/cas2/login*
// @icon https://i.ibb.co.com/m8vqKV2/favicon-32x32.png
// ==/UserScript==
(function() {
// replace ___username___ and ___password___ with your own username and password
var username = "___username___";
var password = "___password___";
// declare variables
var inputName, inputPassword, submitButton;
// insert username and password
if (window.location.href === "https://academic.ui.ac.id/main/Authentication/") {
inputName = document.getElementsByName("u")[0];
inputPassword = document.getElementsByName("p")[0];
} else if (window.location.href.startsWith("https://sso.ui.ac.id/cas/login")) {
inputName = document.getElementById("username");
inputPassword = document.getElementById("password");
} else {
inputName = document.getElementsByName("username")[0];
if (inputName) {
} else {
return;
}
inputPassword = document.getElementsByName("password")[0];
}
inputName.value = username;
inputPassword.value = password;
// click the login button
submitButton = document.querySelector("[type='submit']");
submitButton.click();
})();