Exemple #1
0
function draw_create_page()
{
    $a_retval = array();
    $a_retval[] = draw_page_head('<div><a class="black_link" href="/">Back to login page</a></div>');
    $a_retval[] = '<script type="text/javascript">dont_check_session_expired = true;</script>';
    $a_retval[] = draw_create_user_form();
    $a_retval[] = draw_page_foot();
    return implode("\n", $a_retval);
}
function draw_forgot_password_page()
{
    ob_start();
    ?>
	<script type="text/javascript">
		dont_check_session_expired = true;

		/**
		 * Changes the input from "email" to "username", or vice versa
		 * @select_element dom object The selectbox with the "email" and "username" options
		 */
		function change_input(select_element) {

			// get the selection option name
			var jselect = $(select_element);
			var option = jselect.val().toLowerCase();
			var all = $(".credential_type");
			var others = [];
			var joption = $("#"+option);

			// get a list of the other options and store values
			$.each(all, function(k,v) {
				if (v.id != option)
					others.push(v);
				var input = $(v).children("input");
				if (input.val() != "") {
					$("#"+v.id+"_bk").val(input.val());
					input.val("");
				}
			});

			// retrieve the value for the newly selected option
			joption.children("input").val($("#"+option+"_bk").val());

			// show only the selection option credentials
			$.each(others, function(k,v) {
				$(v).hide();
			});
			joption.show();
			joption.css({ display:'inline-block' });
		}
	</script>

	<form id='reset_password_form'>
		<input type='hidden' name='command' value='forgot_password_ajax' />
		<label class='errors'></label><br />

		I remember my
		<select onchange='change_input(this);'>
			<option>Username</option>
			<option>Email</option>
		</select>:
		<br /><br />

		<div id='username' class='credential_type' style='display:inline-block;'>
			<label name='username'>Username</label>
			<input type='textbox' size='20' name='username'><br />
		</div>
		<div id='email' class='credential_type' style='display:none;'>
			<label name='email'>Email</label>
			<input type='textbox' size='20' name='email'><br />
		</div>
		<br /><br />

		<div style='float:right;'>
			<input type='button' value='Send Email' onclick='send_ajax_call_from_form("/pages/users/ajax.php","reset_password_form");' />
		</div><br />
	</form>

	<input id='username_bk' type='hidden' value=''>
	<input id='email_bk' type='hidden' value=''>
	<?php 
    $s_page = ob_get_contents();
    ob_end_clean();
    $a_page[] = draw_page_head('<div><a class="black_link" href="/">Back to login page</a></div>');
    $a_page[] = $s_page;
    $a_page[] = draw_page_foot();
    return implode("\n", $a_page);
}
function draw_reset_password_page()
{
    $s_username = $_GET['username'];
    ob_start();
    ?>
	<script type="text/javascript">
		dont_check_session_expired = true;

		/**
		 * Verifies that the password is valid and the password fields match
		 */
		function verify_passwords() {

			var jp1 = $("#p1");
			var jp2 = $("#p2");
			var jlabel = $("#password_verification");

			if (jp1.val() == '') {
				jlabel.stop(true,true);
				jlabel.css({ color:'red', opacity:0 });
				jlabel.animate({ opacity:1 }, 300);
				jlabel.text('It is advised that your password not be blank.');
				return;
			}

			if (jp1.val() != jp2.val()) {
				jlabel.stop(true,true);
				jlabel.css({ color:'red', opacity:0 });
				jlabel.animate({ opacity:1 }, 300);
				jlabel.text('Passwords do not match.');
				return;
			}

			jlabel.stop(true,true);
			jlabel.css({ color:'green', opacity:0 });
			jlabel.animate({ opacity:1 }, 300);
			jlabel.text('OK!');
		}
	</script>

	<form id='reset_password_form'>
		<input type='hidden' name='command' value='reset_password_ajax' />
		<label class='errors'>Reset password for <?php 
    echo $s_username;
    ?>
:</label><br />

		Password: <input type='password' name='password' id='p1' /><br />
		Verify: <input type='password' id='p2' onkeyup='verify_passwords();' /><br />
		<input type='hidden' name='key' value='<?php 
    echo $_GET['key'];
    ?>
'></input>
		<input type='hidden' name='username' value='<?php 
    echo $_GET['username'];
    ?>
'></input>
		<label id='password_verification' style='font-weight:bold;'></label>
		<br /><br />

		<div style='float:right;'>
			<input type='button' value='Set Password' onclick='send_ajax_call_from_form("/pages/users/ajax.php","reset_password_form");' />
		</div><br />
	</form>
	<?php 
    $s_page = ob_get_contents();
    ob_end_clean();
    $a_page[] = draw_page_head('<div><a class="black_link" href="/">To login page</a></div>');
    $a_page[] = $s_page;
    $a_page[] = draw_page_foot();
    return implode("\n", $a_page);
}
Exemple #4
0
    $s_retval[] = '</td></tr></table>';
    return implode("\n", $s_retval);
}
if ($global_user) {
    if ($global_user->exists_in_db()) {
        $s_drawval = array();
        $s_drawval[] = draw_page_head();
        $s_drawval[] = '<script src="/js/table_functions.js"></script>';
        $s_drawval[] = '<script src="/js/jslists201330.js"></script>';
        $s_drawval[] = '<script src="/js/use_course_list.js"></script>';
        $s_drawval[] = '<script src="/js/course_list.js"></script>';
        $s_drawval[] = '<script src="/js/conflicts.js"></script>';
        $s_drawval[] = '<script src="/js/common_functions.js"></script>';
        $s_drawval[] = '<script src="/js/tab_functions.js"></script>';
        $s_drawval[] = '<script src="/js/semester_header.js"></script>';
        $s_drawval[] = '<script src="/js/schedule.js"></script>';
        $s_drawval[] = '<link href="/css/auto_table.css" rel="stylesheet" type="text/css">';
        $s_drawval[] = '<link href="/css/tabs.css" rel="stylesheet" type="text/css">';
        $s_drawval[] = '<link href="/css/select.css" rel="stylesheet" type="text/css">';
        $s_drawval[] = draw_logout_bar();
        $s_drawval[] = "<br />";
        $s_drawval[] = draw_semester_header();
        $s_drawval[] = "<br /><br /><dev id='content'>";
        $s_drawval[] = draw_tabs();
        $s_drawval[] = "</dev>";
        $s_drawval[] = draw_page_foot();
        echo manage_output(implode("\n", $s_drawval));
    }
} else {
    logout_session();
}
Exemple #5
0
function draw_login_page($session_expired_message)
{
    ob_start();
    ?>
	<script type="text/javascript">dont_check_session_expired = true;</script>

	<div style='display:inline-block; margin:0 15px 0 0; vertical-align:middle;'>
	<span id='login_form_guest'>
		<input type='hidden' name='username' value='guest' />
		<input type='hidden' name='password' value='guest' />
		<span style='color:red;'>:</span>
		<span class='highlight_link' onclick='send_ajax_call_from_form("/pages/login/login_ajax.php","login_form_guest");'>Login As Guest</span>
		<span style='color:red;'>:</span>
	</span><br />
	</div>

	<div style='display:inline-block; margin:0 15px 0 0; vertical-align:middle;'>
	<span style='color:gray; font-style:italic;'>or</span>
	</div>

	<div style='display:inline-block; margin:0 0 0 0; vertical-align:middle;'>
	<form id='login_form'>
		<label class='errors'><?php 
    echo $session_expired_message;
    ?>
</label><br />
		<label name='username'>Username</label>
		<input type='textbox' size='20' name='username'><br />
		<label name='password'>Password</label>
		<input type='password' size='20' name='password' onkeydown='if (event.which == 13) { $(this).parent().find("input[value=Submit]").click(); };'><br />
		<div style='float:right;'>
			<input type='button' value='Submit' onclick='send_ajax_call_from_form("/pages/login/login_ajax.php",$(this).parent().parent().prop("id"));' />
		</div><br />
		<div style='color:gray; font-size:12px;'>Do NOT use your TCC login.</div>
	</form>
	<br />
	<span>
		<span id="create_form" style="min-width:">
			<input type="hidden" name="draw_create_user_page" value="1">
			<a href="#" class="black_link" onclick="send_ajax_call_from_form('/pages/users/ajax.php','create_form');">Create User</a>,
		</span>
		<span id="password_form">
			<input type="hidden" name="draw_forgot_password_page" value="1" />
			<a href="#" class="black_link" onclick="send_ajax_call_from_form('/pages/users/ajax.php','password_form');">Forgot Password</a>
		</span>
	</span>
	</div>
	<?php 
    $s_page = ob_get_contents();
    ob_end_clean();
    $a_page[] = draw_page_head();
    $a_page[] = $s_page;
    $a_page[] = draw_page_foot();
    return implode("\n", $a_page);
}