[ Index ] |
PHP Cross Reference of Eventum |
[Summary view] [Print] [Text view]
1 <?php 2 /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */ 3 // +----------------------------------------------------------------------+ 4 // | Eventum - Issue Tracking System | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB | 7 // | | 8 // | This program is free software; you can redistribute it and/or modify | 9 // | it under the terms of the GNU General Public License as published by | 10 // | the Free Software Foundation; either version 2 of the License, or | 11 // | (at your option) any later version. | 12 // | | 13 // | This program is distributed in the hope that it will be useful, | 14 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 // | GNU General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to: | 20 // | | 21 // | Free Software Foundation, Inc. | 22 // | 59 Temple Place - Suite 330 | 23 // | Boston, MA 02111-1307, USA. | 24 // +----------------------------------------------------------------------+ 25 // | Authors: João Prado Maia <jpm@mysql.com> | 26 // +----------------------------------------------------------------------+ 27 // 28 // @(#) $Id: login.php 3258 2007-02-14 23:25:56Z glen $ 29 30 require_once(dirname(__FILE__) . "/init.php"); 31 require_once (APP_INC_PATH . "db_access.php"); 32 require_once (APP_INC_PATH . "class.auth.php"); 33 require_once (APP_INC_PATH . "class.user.php"); 34 require_once (APP_INC_PATH . "class.validation.php"); 35 36 if (Validation::isWhitespace($_POST["email"])) { 37 Auth::redirect(APP_RELATIVE_URL . "index.php?err=1"); 38 } 39 if (Validation::isWhitespace($_POST["passwd"])) { 40 Auth::saveLoginAttempt($_POST["email"], 'failure', 'empty password'); 41 Auth::redirect(APP_RELATIVE_URL . "index.php?err=2&email=" . $_POST["email"]); 42 } 43 44 // check if user exists 45 if (!Auth::userExists($_POST["email"])) { 46 Auth::saveLoginAttempt($_POST["email"], 'failure', 'unknown user'); 47 Auth::redirect(APP_RELATIVE_URL . "index.php?err=3"); 48 } 49 // check if the password matches 50 if (!Auth::isCorrectPassword($_POST["email"], $_POST["passwd"])) { 51 Auth::saveLoginAttempt($_POST["email"], 'failure', 'wrong password'); 52 Auth::redirect(APP_RELATIVE_URL . "index.php?err=3&email=" . $_POST["email"]); 53 } 54 // check if this user did already confirm his account 55 if (Auth::isPendingUser($_POST["email"])) { 56 Auth::saveLoginAttempt($_POST["email"], 'failure', 'pending user'); 57 Auth::redirect(APP_RELATIVE_URL . "index.php?err=9", $is_popup); 58 } 59 // check if this user is really an active one 60 if (!Auth::isActiveUser($_POST["email"])) { 61 Auth::saveLoginAttempt($_POST["email"], 'failure', 'inactive user'); 62 Auth::redirect(APP_RELATIVE_URL . "index.php?err=7", $is_popup); 63 } 64 65 Auth::saveLoginAttempt($_POST["email"], 'success'); 66 // redirect to the initial page 67 @Auth::createLoginCookie(APP_COOKIE, $_POST["email"]); 68 Session::init(User::getUserIDByEmail($_POST['email'])); 69 if (!empty($_POST["url"])) { 70 $extra = '?url=' . urlencode($_POST["url"]); 71 } else { 72 $extra = ''; 73 } 74 Auth::redirect(APP_RELATIVE_URL . "select_project.php" . $extra);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 19 21:21:33 2007 | Cross-referenced by PHPXref 0.7 |