Skip to content
Snippets Groups Projects
Commit 5fc119b1 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

added some things so links during cas signin will include view=mobile when needed

parent 46ebdd6d
No related branches found
No related tags found
No related merge requests found
......@@ -17,12 +17,13 @@
$email = get_input('email');
$email = sanitise_string($email);
$view = get_input('view');
if (is_email_address($email)) {
if (!get_user_by_email($email)) {
$ts = time();
$token = generate_action_token($ts);
forward($CONFIG->url.'action/login?usecas=yes&email='.$email.'&__elgg_ts='.$ts.'&__elgg_token='.$token);
forward($CONFIG->url.'action/login?usecas=yes&email='.$email.'&__elgg_ts='.$ts.'&__elgg_token='.$token.'&view='.$view);
} else {
register_error(elgg_echo("Sorry, that email has already been registered. Please try again."));
}
......
......@@ -23,6 +23,8 @@
$usecas = get_input('usecas');
//this is available once they have given their email
$email = get_input('email');
//look for view=mobile
$view = get_input('view');
// 1. Do the regular elgg login if username and password are set
$result = false;
......@@ -39,11 +41,11 @@
global $CONFIG;
$ts = time();
$token = generate_action_token($ts);
SimpleCAS::setURL($CONFIG->url.'action/login?usecas=yes&__elgg_ts='.$ts.'&__elgg_token='.$token);
SimpleCAS::setURL($CONFIG->url.'action/login?usecas=yes&__elgg_ts='.$ts.'&__elgg_token='.$token.'&view='.$view);
$casObject->forceCas();
} else {
$cas_user = $casObject->getUserCas();
if ($user = $casObject->casAuthenticate($cas_user,$email)) {
$cas_user = $casObject->getUserCas();
if ($user = $casObject->casAuthenticate($cas_user,$email,$view)) {
$result = login($user);
if ($result)
$_SESSION['loggedInWithCas'] = true;
......@@ -75,16 +77,12 @@
datalist_set('first_admin_login', time());
forward('pg/admin/plugins');
} else {
/* here's the modifications we're making
forward("pg/dashboard/"); */
} else {
$lastlogin_date = $_SESSION['user']->last_login;
if (!$lastlogin_date){
if (!$lastlogin_date && $view != 'mobile')
forward("mod/profile/edit.php?firstlogin=yes");
}
//forward("pg/profile/$username");
forward("pg/dashboard/");
else
forward("pg/dashboard/");
}
}
} else {
......
......@@ -49,7 +49,7 @@
}
function getemail_page_handler($page) {
if (!isloggedin()) {
page_draw(elgg_echo('Your Email'), elgg_view("account/forms/getemail"));
page_draw(elgg_echo('Your Email'), elgg_view("account/forms/getemail"));
} else {
forward();
}
......@@ -112,7 +112,7 @@ class elggSimpleCas {
return true;
}
public function casAuthenticate($username,$email=""){
public function casAuthenticate($username,$email="",$view=""){
if (empty($username))
return false;
......@@ -137,15 +137,16 @@ class elggSimpleCas {
$pf_user_info = peoplefinderServices($casusername);
$name = $pf_user_info->cn;
if (empty($email)){
if (empty($email)){
if($pf_user_info->mail)
forward($CONFIG->url . 'pg/getemail?e=' . $pf_user_info->mail);
forward($CONFIG->url.'pg/getemail?e='.$pf_user_info->mail.'&view='.$view);
else
forward($CONFIG->url . 'pg/getemail');
forward($CONFIG->url.'pg/getemail?view='.$view);
}
try {
if ($user_guid = register_user($username, generate_random_cleartext_password(), $name, $email, false, 0, '', true)) {
try {
$password = generate_random_cleartext_password();
if ($user_guid = register_user($username, $password, $name, $email, false, 0, '', true)) {
$thisuser = get_user($user_guid);
//pre-populate profile fields with data from Peoplefinder Services
......
......@@ -8,39 +8,13 @@
* @copyright 2010
* @link http://www.unl.edu/
*/
global $CONFIG;
if($vars['config']->input['view'] == 'mobile')
$viewmobile = 'view=mobile';
else
$viewmobile = '';
?>
<?php /*
<div id="login">
<div class="two_col left">
<h2 class="sec_main">Students, Faculty, Staff</h2>
<p>If you are a student, faculty or staff member, you already have an account. Use your my.UNL credentials to begin.</p>
<?php
$form_body = '<p class="login-box">';
$form_body .= '<label>' . elgg_view('input/hidden', array('internalname' => 'usecas', 'value' => 'yes')) . '</label>';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('UNL Login'))) . '</p>';
$ts = time();
$token = generate_action_token($ts);
echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login?usecas=yes&__elgg_ts='.$ts.'&__elgg_token='.$token"));
?>
<p style="margin-top: 40px;"><a title="Find your my.UNL password" href="https://login.unl.edu/faq/account-resetpw.shtml">Lost your my.UNL password?</a></p>
</div>
<div class="two_col right">
<h2 class="sec_main">Huskers Worldwide</h2>
<?php
$form_body = '<p class="login-box"><label>' . elgg_echo('username') . '<br />' . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . '</label><br />';
$form_body .= '<label>' . elgg_echo('password') . '<br />' . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . '</label><br />';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . '</p>';
$form_body .= '<p><a href="'. $vars['url'] .'account/register.php">' . elgg_echo('register') . '</a> | <a href="'. $vars['url'] .'account/forgotten_password.php">' . elgg_echo('user:password:lost') . '</a></p>';
echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login"));
?>
</div>
</div>
*/ ?>
<div id="login">
<div class="two_col left">
......@@ -50,20 +24,16 @@
$ts = time();
$token = generate_action_token($ts);
?>
<a href="<?php echo $CONFIG->url ?>action/login?usecas=yes&__elgg_ts=<?php echo $ts; ?>&__elgg_token=<?php echo $token; ?>" class="wdn_loginLink"><span>UNL Login</span></a>
<a href="<?php echo $vars['url'] ?>action/login?usecas=yes&__elgg_ts=<?php echo $ts; ?>&__elgg_token=<?php echo $token; ?>&<?php echo $viewmobile;?>" class="wdn_loginLink"><span>UNL Login</span></a>
<p style="clear:both;padding-top:15px"><a href="https://login.unl.edu/faq/account-resetpw.shtml" title="Find your my.UNL password">Lost your my.UNL password?</a></p>
</div>
<div class="two_col right">
<h2 class="sec_main">Huskers Worldwide</h2>
<?php
if($vars['config']->input['view'] == 'mobile')
$viewmobile = '?view=mobile';
else
$viewmobile = '';
$form_body = '<p class="login-box"><label>' . elgg_echo('username') . '<br />' . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . '</label><br />';
$form_body .= '<label>' . elgg_echo('password') . '<br />' . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . '</label><br />';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . '</p>';
$form_body .= '<p><a href="'. $vars['url'] .'account/register.php'.$viewmobile.'">' . elgg_echo('register') . '</a> | <a href="'. $vars['url'] .'account/forgotten_password.php'.$viewmobile.'">' . elgg_echo('user:password:lost') . '</a></p>';
$form_body .= '<p><a href="'. $vars['url'] .'account/register.php?'.$viewmobile.'">' . elgg_echo('register') . '</a> | <a href="'. $vars['url'] .'account/forgotten_password.php?'.$viewmobile.'">' . elgg_echo('user:password:lost') . '</a></p>';
echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login"));
?>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment