Changeset 21138 for branches


Ignore:
Timestamp:
2011/08/05 23:14:32 (13 years ago)
Author:
nanasess
bzr:base-revision:
svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:21137
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/Smarty/templates/sphone/shopping/index.tpl index.tpl-20101209134550-lsv02w9wikfx9cj3-38
data/class/pages/shopping/LC_Page_Shopping.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping.php
bzr:mapping-version:
v4
bzr:merge:

ohkouchi@loop-az.jp-20110805141016-3y3e7515aj07h3li
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20110805141429-q4uvtjkhv4f7km3u
bzr:revno:
3841
bzr:revprop:branch-nick:
branches/version-2_11-dev
bzr:root:
branches/version-2_11-dev
bzr:testament:

bazaar-ng testament short form 2.1
revision-id: ohkouchi@loop-az.jp-20110805141429-q4uvtjkhv4f7km3u
sha1: 61681cc48b8e8a64c49987149056042bcc8f479e
bzr:text-parents:

data/Smarty/templates/sphone/shopping/index.tpl ohkouchi@loop-az.jp-20110805070326-8029rknyqmbbewny
data/class/pages/shopping/LC_Page_Shopping.php svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:20970
bzr:timestamp:
2011-08-05 23:14:29.957000017 +0900
bzr:user-agent:
bzr2.3.1+bzr-svn1.1.0dev0
Message:

#1413 ログインエラーを alert に

  • TODO リファクタリングしたい...
Location:
branches/version-2_11-dev/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/Smarty/templates/sphone/shopping/index.tpl

    r21132 r21138  
    2121 *}--> 
    2222<!--▼CONTENTS--> 
     23<script> 
     24  function ajaxLogin() { 
     25      var checkLogin = fnCheckLogin('member_form'); 
     26 
     27      if (checkLogin == false) { 
     28          return false; 
     29      } else { 
     30 
     31          var postData = new Object; 
     32          postData['<!--{$smarty.const.TRANSACTION_ID_NAME}-->'] = "<!--{$transactionid}-->"; 
     33          postData['mode'] = 'login'; 
     34          postData['login_email'] = $('input[type=email]').val(); 
     35          postData['login_pass'] = $('input[type=password]').val(); 
     36 
     37          $.ajax({ 
     38              type: "POST", 
     39              url: "<!--{$smarty.const.ROOT_URLPATH}-->shopping/index.php", 
     40              data: postData, 
     41              cache: false, 
     42              dataType: "json", 
     43              error: function(XMLHttpRequest, textStatus, errorThrown){ 
     44                  alert(textStatus); 
     45              }, 
     46              success: function(result){ 
     47                  if (result.success) { 
     48                      location.href = '<!--{$smarty.const.ROOT_URLPATH}-->shopping/' + result.success; 
     49                  } else { 
     50                      alert(result.login_error); 
     51                  } 
     52              } 
     53          }); 
     54      } 
     55  } 
     56</script> 
    2357<section id="slidewindow"> 
    2458<div data-role="header"> 
     
    2761</div> 
    2862</div> 
    29 <form name="member_form" id="member_form" method="post" action="<!--{$smarty.const.HTTP_URL}-->shopping/index.php" onSubmit="return fnCheckLogin('member_form')"> 
     63<!--<!--{$smarty.const.HTTP_URL}-->shopping/index.php--> 
     64<form name="member_form" id="member_form" method="post" action="javascript:;" onSubmit="return ajaxLogin()"> 
    3065    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
    3166    <input type="hidden" name="mode" value="login" /> 
  • branches/version-2_11-dev/data/class/pages/shopping/LC_Page_Shopping.php

    r20970 r21138  
    132132                    } 
    133133                } 
    134  
    135                 SC_Response_Ex::sendRedirect( 
    136                         $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
    137                                                $objCustomer, $objPurchase, 
    138                                                $objSiteSess)); 
     134                // スマートフォンの場合はログイン成功を返す 
     135                elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     136                    echo SC_Utils_Ex::jsonEncode(array('success' =>  
     137                                                $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
     138                                                                       $objCustomer, $objPurchase, 
     139                                                                       $objSiteSess))); 
     140                    exit; 
     141                } else { 
     142                    SC_Response_Ex::sendRedirect( 
     143                            $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
     144                                                   $objCustomer, $objPurchase, 
     145                                                   $objSiteSess)); 
     146                } 
    139147                exit; 
    140148            } 
     
    143151                // 仮登録の場合 
    144152                if($this->checkTempCustomer($objFormParam->getValue('login_email'))) { 
    145                     SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); 
    146                     exit; 
     153                    if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     154                        echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); 
     155                        exit; 
     156                    } else { 
     157                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); 
     158                        exit; 
     159                    } 
    147160                } else { 
    148                     SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); 
    149                     exit; 
     161                    if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     162                        echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); 
     163                        exit; 
     164                    } else { 
     165                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); 
     166                        exit; 
     167                    } 
    150168                } 
    151169            } 
     
    522540        return $count > 0; 
    523541    } 
     542 
     543    /** 
     544     * エラーメッセージを JSON 形式で返す. 
     545     * 
     546     * TODO リファクタリング 
     547     * この関数は主にスマートフォンで使用します. 
     548     * 
     549     * @param integer エラーコード 
     550     * @return string JSON 形式のエラーメッセージ 
     551     * @see LC_PageError 
     552     */ 
     553    function lfGetErrorMessage($error) { 
     554        switch ($error) { 
     555            case TEMP_LOGIN_ERROR: 
     556                $msg = "メールアドレスもしくはパスワードが正しくありません。\n本登録がお済みでない場合は、仮登録メールに記載されているURLより本登録を行ってください。"; 
     557                break; 
     558            case SITE_LOGIN_ERROR: 
     559            default: 
     560                $msg = "メールアドレスもしくはパスワードが正しくありません。"; 
     561        } 
     562        return SC_Utils_Ex::jsonEncode(array('login_error' => $msg)); 
     563    } 
    524564} 
    525565?> 
Note: See TracChangeset for help on using the changeset viewer.