HEX
Server: Apache/2
System: Linux ctr689471.novalocal 4.9.241-37.el7.x86_64 #1 SMP Mon Nov 2 13:55:04 UTC 2020 x86_64
User: bluecool (1005)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /home/bluecool/domains/bluecool.vn/public_html/wp-content/auth.berkeley.edu/login_files/common.js
document.addEventListener("DOMContentLoaded", function() {
    var form = document.getElementById("fm1");

    form.addEventListener("submit", function(e) {
        var calnet_id = document.getElementById("username");

        // Trim leading and trailing spaces
        calnet_id.value = calnet_id.value.replace(/^\s+|\s+$/g, "");

        if (calnet_id !== null) {
            // Check for the specific conditions
            if (window.location.search && decodeURIComponent(window.location.search).match(/bpr.calnet.berkeley.edu\/account-manager/) && calnet_id.value.match(/^cads\d+$/)) {
                return true;
            } else if (calnet_id.value.match(/^cads\d+$/)) {
                e.preventDefault(); // Stop form from submitting

                var message = "You're using an inactive legacy Alumni ID (cads). Click OK to learn how to fix this.";
                alert(message);

                window.location.href = "https://berkeley.service-now.com/kb?id=kb_article_view&sysparm_article=KB0014883";
                return false; // Prevent form submission
            }
        }

        // If no conditions are met, allow normal submission
        return true;
    });
});