[16090] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[18734] | 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
[16090] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
[16090] | 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
| 25 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * ログインチェック のページクラス. |
---|
| 29 | * |
---|
| 30 | * TODO frontparts/LC_Page_Frontparts_LoginCheck と抽象化させる |
---|
| 31 | * FIXME ロジック見なおし... |
---|
| 32 | * |
---|
| 33 | * @package Page |
---|
| 34 | * @author LOCKON CO.,LTD. |
---|
| 35 | * @version $Id$ |
---|
| 36 | */ |
---|
| 37 | class LC_Page_Mypage_LoginCheck extends LC_Page { |
---|
| 38 | |
---|
| 39 | // }}} |
---|
| 40 | // {{{ functions |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * Page を初期化する. |
---|
| 44 | * |
---|
| 45 | * @return void |
---|
| 46 | */ |
---|
| 47 | function init() { |
---|
| 48 | parent::init(); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | /** |
---|
| 52 | * Page のプロセス. |
---|
| 53 | * |
---|
| 54 | * @return void |
---|
| 55 | */ |
---|
| 56 | function process() { |
---|
| 57 | $objCustomer = new SC_Customer(); |
---|
| 58 | // クッキー管理クラス |
---|
| 59 | $objCookie = new SC_Cookie(COOKIE_EXPIRE); |
---|
| 60 | // パラメータ管理クラス |
---|
| 61 | $this->objFormParam = new SC_FormParam(); |
---|
| 62 | // パラメータ情報の初期化 |
---|
| 63 | $this->lfInitParam(); |
---|
[17771] | 64 | //パスワード・Eメールにある空白をトリム |
---|
| 65 | $_POST["mypage_login_email"] = trim($_POST["mypage_login_email"]); |
---|
| 66 | $_POST["mypage_login_pass"] = trim($_POST["mypage_login_pass"]); //認証用 |
---|
| 67 | $_POST["mypage_login_pass1"] = trim($_POST["mypage_login_pass"]); //最小桁数比較用 |
---|
| 68 | $_POST["mypage_login_pass2"] = trim($_POST["mypage_login_pass"]); //最大桁数比較用 |
---|
[16090] | 69 | // POST値の取得 |
---|
| 70 | $this->objFormParam->setParam($_POST); |
---|
| 71 | |
---|
| 72 | if (!isset($_POST['mode'])) $_POST['mode'] = ""; |
---|
| 73 | |
---|
| 74 | switch($_POST['mode']) { |
---|
| 75 | case 'login': |
---|
| 76 | $this->objFormParam->toLower('mypage_login_email'); |
---|
| 77 | $arrErr = $this->objFormParam->checkError(); |
---|
[16374] | 78 | |
---|
| 79 | // エラーの場合はエラー画面に遷移 |
---|
| 80 | if (count($arrErr) > 0) { |
---|
| 81 | SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); |
---|
| 82 | } |
---|
[16090] | 83 | $arrForm = $this->objFormParam->getHashArray(); |
---|
| 84 | // クッキー保存判定 |
---|
| 85 | if ($arrForm['mypage_login_memory'] == "1" && $arrForm['mypage_login_email'] != "") { |
---|
| 86 | $objCookie->setCookie('login_email', $_POST['mypage_login_email']); |
---|
| 87 | } else { |
---|
| 88 | $objCookie->setCookie('login_email', ''); |
---|
| 89 | } |
---|
| 90 | |
---|
[16374] | 91 | if($objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'], true)) { |
---|
[18727] | 92 | $this->sendRedirect($this->getLocation("./index.php", array(), true)); |
---|
[16374] | 93 | exit; |
---|
| 94 | } else { |
---|
| 95 | $arrForm['mypage_login_email'] = strtolower($arrForm['mypage_login_email']); |
---|
| 96 | $objQuery = new SC_Query; |
---|
| 97 | $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; |
---|
| 98 | $ret = $objQuery->count("dtb_customer", $where, array($arrForm['mypage_login_email'], $arrForm['mypage_login_email'])); |
---|
[16090] | 99 | |
---|
[16374] | 100 | if($ret > 0) { |
---|
| 101 | SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); |
---|
| 102 | } else { |
---|
| 103 | SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); |
---|
[16090] | 104 | } |
---|
[16374] | 105 | } |
---|
[16090] | 106 | break; |
---|
| 107 | } |
---|
| 108 | } |
---|
[16374] | 109 | |
---|
[16090] | 110 | /** |
---|
| 111 | * デストラクタ. |
---|
| 112 | * |
---|
| 113 | * @return void |
---|
| 114 | */ |
---|
| 115 | function destroy() { |
---|
| 116 | parent::destroy(); |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | /* パラメータ情報の初期化 */ |
---|
| 120 | function lfInitParam() { |
---|
| 121 | $this->objFormParam->addParam("記憶する", "mypage_login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
[16374] | 122 | $this->objFormParam->addParam("メールアドレス", "mypage_login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK")); |
---|
[17771] | 123 | $this->objFormParam->addParam("パスワード", "mypage_login_pass", PASSWORD_LEN1, "KVa", array("EXIST_CHECK")); |
---|
| 124 | $this->objFormParam->addParam("パスワード", "mypage_login_pass1", PASSWORD_LEN1, "KVa", array("EXIST_CHECK", "MIN_LENGTH_CHECK")); |
---|
| 125 | $this->objFormParam->addParam("パスワード", "mypage_login_pass2", PASSWORD_LEN2, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); |
---|
[16090] | 126 | } |
---|
[17771] | 127 | |
---|
[16090] | 128 | } |
---|
| 129 | ?> |
---|