source: branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_LoginCheck.php @ 20116

Revision 20116, 6.3 KB checked in by nanasess, 13 years ago (diff)
  • svn properties を再設定
  • 再設定用のスクリプト追加
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2010 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_REALDIR . "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 */
37class 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        parent::process();
58        $this->action();
59        $this->sendResponse();
60    }
61
62    /**
63     * Page のAction.
64     *
65     * @return void
66     */
67    function action() {
68        $objCustomer = new SC_Customer();
69        // クッキー管理クラス
70        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
71        // パラメータ管理クラス
72        $this->objFormParam = new SC_FormParam();
73        // パラメータ情報の初期化
74        $this->lfInitParam();
75        //パスワード・Eメールにある空白をトリム
76        $_POST["mypage_login_email"] = trim($_POST["mypage_login_email"]);
77        $_POST["mypage_login_pass"] = trim($_POST["mypage_login_pass"]);  //認証用
78        $_POST["mypage_login_pass1"] = trim($_POST["mypage_login_pass"]); //最小桁数比較用
79        $_POST["mypage_login_pass2"] = trim($_POST["mypage_login_pass"]); //最大桁数比較用
80        // POST値の取得
81        $this->objFormParam->setParam($_POST);
82
83        switch($this->getMode()) {
84        case 'login':
85            $this->objFormParam->toLower('mypage_login_email');
86            $arrErr = $this->objFormParam->checkError();
87
88            // エラーの場合はエラー画面に遷移
89            if (count($arrErr) > 0) {
90                SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
91            }
92            $arrForm =  $this->objFormParam->getHashArray();
93            // クッキー保存判定
94            if ($arrForm['mypage_login_memory'] == "1" && $arrForm['mypage_login_email'] != "") {
95                $objCookie->setCookie('login_email', $_POST['mypage_login_email']);
96            } else {
97                $objCookie->setCookie('login_email', '');
98            }
99
100            // ログイン判定
101            $loginFailFlag = false;
102            if(Net_UserAgent_Mobile::isMobile() === true) {
103                // モバイルサイト
104                if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['mypage_login_pass']) &&
105                   !$objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'], true)) {
106                    $loginFailFlag = true;
107                }
108            } else {
109                // モバイルサイト以外
110                if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'])) {
111                    $loginFailFlag = true;
112                }
113            }
114            if($loginFailFlag === true) {
115                $arrForm['mypage_login_email'] = strtolower($arrForm['mypage_login_email']);
116                $objQuery = new SC_Query;
117                $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
118                $ret = $objQuery->count("dtb_customer", $where, array($arrForm['mypage_login_email'], $arrForm['mypage_login_email']));
119
120                if($ret > 0) {
121                    SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
122                } else {
123                    SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
124                }
125            } else {
126                if(Net_UserAgent_Mobile::isMobile() === true) {
127                    // ログインが成功した場合は携帯端末IDを保存する。
128                    $objCustomer->updateMobilePhoneId();
129
130                    /*
131                     * email がモバイルドメインでは無く,
132                     * 携帯メールアドレスが登録されていない場合
133                     */
134                    $objMobile = new SC_Helper_Mobile_Ex();
135                    if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
136                        if (!$objCustomer->hasValue('email_mobile')) {
137                            SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php');
138                            exit;
139                        }
140                    }
141                }
142
143                SC_Response_Ex::sendRedirect(DIR_INDEX_PATH);
144                exit;
145            }
146            break;
147        }
148    }
149
150    /**
151     * デストラクタ.
152     *
153     * @return void
154     */
155    function destroy() {
156        parent::destroy();
157    }
158
159    /* パラメータ情報の初期化 */
160    function lfInitParam() {
161        $this->objFormParam->addParam("記憶する", "mypage_login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
162        $this->objFormParam->addParam("メールアドレス", "mypage_login_email", MTEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
163        $this->objFormParam->addParam("パスワード", "mypage_login_pass", PASSWORD_LEN1, "KVa", array("EXIST_CHECK"));
164        $this->objFormParam->addParam("パスワード", "mypage_login_pass1", PASSWORD_LEN1, "KVa", array("EXIST_CHECK", "MIN_LENGTH_CHECK"));
165        $this->objFormParam->addParam("パスワード", "mypage_login_pass2", PASSWORD_LEN2, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
166    }
167
168}
169?>
Note: See TracBrowser for help on using the repository browser.