source: branches/comu-ver2/data/class/pages/frontparts/LC_Page_FrontParts_LoginCheck.php @ 18021

Revision 18021, 5.8 KB checked in by Seasoft, 15 years ago (diff)

merge 17771, 17807, 17894, 17972, 17973, 17974
・取得元: version-2_4
・追加対応: #471(続:管理機能 11文字以上のパスワードでログインできない)
【取得元のログメッセージ】

  • パスワード文字数の定数化
  • 空白、改行の自動トリム
  • モバイルで、ログイン時に入力されたメール・パスワードの定義を変更しているが、convertをかけていなかったのでログインできない不具合が発生していた、それの改修
  • #439 管理画面のID、PASSを全て半角英数字4から15文字に修正
  • #439 パスワード文字数4から10文字という文言が残っていた部分を修正
  • #439 ID、パスワードの文字数設定に関して、パラメータ設定の文言が分かりにくいため、明記しました。
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
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.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26
27/**
28 * ログインチェック のページクラス.
29 *
30 * TODO mypage/LC_Page_Mypage_LoginCheck と統合
31 *
32 * @package Page
33 * @author LOCKON CO.,LTD.
34 * @version $Id:LC_Page_FrontParts_LoginCheck.php 15532 2007-08-31 14:39:46Z nanasess $
35 */
36class LC_Page_FrontParts_LoginCheck extends LC_Page {
37
38    // }}}
39    // {{{ functions
40
41    /**
42     * Page を初期化する.
43     *
44     * @return void
45     */
46    function init() {
47        parent::init();
48
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process() {
57        $objCustomer = new SC_Customer();
58        // 不正なURLがPOSTされた場合はエラー表示
59        if (!$this->isValidToken()) {
60            GC_Utils_Ex::gfPrintLog('invalid access :login_check.php $POST["url"]=' . $_POST['url']);
61            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
62        }
63        // クッキー管理クラス
64        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
65        // パラメータ管理クラス
66        $this->objFormParam = new SC_FormParam();
67        // パラメータ情報の初期化
68        $this->lfInitParam();
69        //パスワード・Eメールにある空白をトリム
70        $_POST["login_email"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["login_email"]);
71        $_POST["login_pass"] = trim($_POST["login_pass"]); //認証用
72        $_POST["login_pass1"] = $_POST["login_pass"];      //最小桁数比較用
73        $_POST["login_pass2"] = $_POST["login_pass"];      //最大桁数比較用
74        // POST値の取得
75        $this->objFormParam->setParam($_POST);
76
77        if (!isset($_POST['mode'])) $_POST['mode'] = "";
78
79        switch($_POST['mode']) {
80        case 'login':
81            $this->objFormParam->toLower('login_email');
82            $arrErr = $this->objFormParam->checkError();
83
84            $this->p($arrErr);
85
86            // エラーの場合はエラー画面に遷移
87            if (count($arrErr) > 0) {
88                SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
89            }
90            $arrForm =  $this->objFormParam->getHashArray();
91            // クッキー保存判定
92            if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
93                $objCookie->setCookie('login_email', $_POST['login_email']);
94            } else {
95                $objCookie->setCookie('login_email', '');
96            }
97
98            if(count($arrErr) == 0) {
99                if($objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
100                    $this->sendRedirect($this->getLocation(URL_DIR, array(), false));
101                    exit;
102                } else {
103                    $arrForm['login_email'] = strtolower($arrForm['login_email']);
104                    $objQuery = new SC_Query;
105                    $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
106                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
107
108                    if($ret > 0) {
109                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
110                    } else {
111                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
112                    }
113                }
114            } else {
115                // 入力エラーの場合、元のアドレスに戻す。
116                $this->sendRedirect($this->getLocation($_POST['url'], array(), false));
117                exit;
118            }
119            break;
120        case 'logout':
121            // ログイン情報の解放
122            $objCustomer->EndSession();
123            $mypage_url_search = strpos('.'.$_POST['url'], "mypage");
124            //マイページログイン中はログイン画面へ移行
125            if ($mypage_url_search == 2){
126                $this->sendRedirect($this->getLocation(URL_DIR . "mypage/login.php", array(), false));
127            }else{
128                $this->sendRedirect($this->getLocation(URL_DIR, array(), false));
129            }
130            exit;
131            break;
132        }
133    }
134
135    /**
136     * デストラクタ.
137     *
138     * @return void
139     */
140    function destroy() {
141        parent::destroy();
142    }
143
144    /* パラメータ情報の初期化 */
145    function lfInitParam() {
146        $this->objFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
147        $this->objFormParam->addParam("メールアドレス", "login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK"));
148        $this->objFormParam->addParam("パスワード", "login_pass", PASSWORD_LEN1, "", array("EXIST_CHECK"));
149        $this->objFormParam->addParam("パスワード", "login_pass1", PASSWORD_LEN1, "", array("EXIST_CHECK", "MIN_LENGTH_CHECK"));
150        $this->objFormParam->addParam("パスワード", "login_pass2", PASSWORD_LEN2, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
151    }
152}
153?>
Note: See TracBrowser for help on using the repository browser.