X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/blobdiff_plain/5085530310ff52260aa0c23533ee883f1add85cd..b44496e6b4c4b4a9e0b97d4b9488fe107ba2d480:/login.php diff --git a/login.php b/login.php index 18f7531..de6416e 100644 --- a/login.php +++ b/login.php @@ -4,34 +4,30 @@ require_once('mitsql.cfg.php'); require_once('mitsql.lib.php'); if (isSSL()) { - $Login2 = new Login($SSLUsername); if (is_null($SSLCred)) { $err[] = 'Please install a valid certificate.'; - } else { - if (!(empty($SSLUsername) || $Login2->exists())) { - addUser($SSLCred); - $Login = new Login($SSLUsername); - } } } -if (empty($err) && isPost()) { - +if (isPost() && empty($err)) { + if (isSSL()) { - $Login = new Login($SSLUsername); - $Login->update($cred['Name'],$cred['Email']); - sess('Login', $Login); + $Login = $LoginSSL; } else { $Login = new Login($i_u, $i_p); - if ($Login->exists() && !$Login->isEnabled()) { - $err[] = 'Account not active. Did you signup yet?.'; - } elseif (!$Login->exists()) { - $err[] = 'Nonexistant account or invalid password.'; - } elseif (!$Login->canLogin()) { - $err[] = 'That account is no longer valid. Please contact the staff.'; - } else { - sess('Login', $Login); - } + } + + if ($Login->exists() && !$Login->isEnabled()) { + $err[] = 'Account not active. Did you signup yet?.'; + } elseif (!$Login->exists()) { + $err[] = 'Nonexistant account or invalid password.'; + } elseif (!$Login->canLogin()) { + $err[] = 'That account is no longer valid. Please contact the staff.'; + } + + if (empty($err)) { + sess('UserId', $Login->getUserId()); + redirect('main'); } } @@ -40,4 +36,4 @@ isLoggedIn() && redirect('main'); include 'tpl/login.php'; -?> +?> \ No newline at end of file