X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/blobdiff_plain/5085530310ff52260aa0c23533ee883f1add85cd..8933592bf33ba067b1de182ace7ab0950d10d9ac:/login.php diff --git a/login.php b/login.php index 18f7531..5e2d310 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'); } }