ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 1071


Ignore:
Timestamp:
Dec 7, 2006, 8:10:21 PM (14 years ago)
Author:
takanashi
Message:

PNEスレーブ確認用

Location:
OpenPNE/branches/takanashi/prj_takanashi3
Files:
2 added
24 edited
25 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/OpenPNE/Auth.php

    r364 r1071  
    2323    var $sess_id;
    2424    var $cookie_path;
    25 
    26     function OpenPNE_Auth($storageDriver = 'DB', $options = '')
     25    var $is_ktai;
     26
     27    function OpenPNE_Auth($storageDriver = 'DB', $options = '', $is_ktai = false)
    2728    {
    2829        ini_set('session.use_cookies', 0);
    29         if (!empty($_COOKIE[session_name()])) {
    30             $this->sess_id = $_COOKIE[session_name()];
    31             session_id($this->sess_id);
     30        $this->is_ktai = $is_ktai;
     31        if ($this->is_ktai) {
     32            if (!empty($_REQUEST['ksid'])) {
     33                $this->sess_id = $_REQUEST['ksid'];
     34                session_id($this->sess_id);
     35            }
     36        } else {
     37            if (!empty($_COOKIE[session_name()])) {
     38                $this->sess_id = $_COOKIE[session_name()];
     39                session_id($this->sess_id);
     40            }
    3241        }
    3342        $this->storage = $storageDriver;
     
    5968    }
    6069
    61     function login($is_save_cookie = false, $is_encrypt_username = false)
     70    function login($is_save_cookie = false, $is_encrypt_username = false, $is_ktai = false)
    6271    {
    6372        $this->auth =& $this->factory(true);
    6473        if ($is_encrypt_username) {
    65             $this->auth->post[$this->auth->_postUsername] =
    66                 t_encrypt($this->auth->post[$this->auth->_postUsername]);
     74            switch (LOGIN_NAME_TYPE) {
     75                case 0:
     76                $this->auth->post[$this->auth->_postUsername] =
     77                    db_member_c_member_id4username($this->auth->post[$this->auth->_postUsername], $is_ktai);
     78                break;
     79                default:
     80                break;
     81            }
    6782        }
    6883
     
    7994                $expire = 0;
    8095            }
    81             setcookie(session_name(), session_id(), $expire, $this->cookie_path);
     96            if (!$this->is_ktai) {
     97                setcookie(session_name(), session_id(), $expire, $this->cookie_path);
     98            }
    8299            return true;
    83100        } else {
     
    105122
    106123        if (isset($_COOKIE[session_name()])) {
    107             setcookie(session_name(), '', time() - 3600, $this->cookie_path);
     124            if (!$this->is_ktai) {
     125                setcookie(session_name(), '', time() - 3600, $this->cookie_path);
     126            }
    108127        }
    109128        $_SESSION = array();
     
    132151    }
    133152
    134     function getUsername()
    135     {
    136         return $this->auth->getUsername();
     153    function getUsername($LOGIN_NAME_TYPE = 0)
     154    {
     155        $username = $this->auth->getUsername();
     156        switch ($LOGIN_NAME_TYPE) {
     157            case 1:
     158            $username = db_member_c_member_id4username($username);
     159            break;
     160            default :
     161            break;
     162        }
     163        return $username;
    137164    }
    138165
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/auth.inc

    r404 r1071  
    1212
    1313if (   !$auth->auth()
    14     || !($u = _db_c_member_id4pc_address_encrypted($auth->getUsername()))
     14    || !($u = $auth->getUsername(LOGIN_NAME_TYPE))
    1515    || db_member_is_login_rejected($u)) {
    1616    $auth->logout();
     
    2828$GLOBALS['AUTH'] = $auth;
    2929
     30if (!$_SESSION['regist_step']) {
     31    $check_param = db_member_check_param_inputed($u);
     32    $_SESSION['regist_step'] = ($check_param == 0);
     33   
     34    //プロフィールが未登録の場合はリダイレクト
     35    $prof_ext_page=array(
     36    "do_h_regist_prof"=>true,
     37    "page_h_regist_prof"=>true,
     38    "do_inc_page_header_logout"=>true,
     39    );
     40   
     41    if (($check_param==1) && !$prof_ext_page[$_REQUEST['a']]) {
     42        openpne_redirect('pc', 'page_h_regist_prof');
     43    }
     44   
     45    //メールアドレスが未登録の場合はリダイレクト
     46    $mail_ext_page=array(
     47    "do_h_regist_address"=>true,
     48    "page_h_regist_address"=>true,
     49    "do_inc_page_header_logout"=>true,
     50    );
     51   
     52    if (($check_param==2) && !$mail_ext_page[$_REQUEST['a']]) {
     53        openpne_redirect('pc', 'page_h_regist_address');
     54    }
     55}
     56
    3057?>
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/db/etc.php

    r972 r1071  
    134134function db_common_authenticate_password($c_member_id, $password)
    135135{
    136     $sql = 'SELECT c_member_secure_id FROM c_member_secure' .
    137             ' WHERE c_member_id = ? AND hashed_password = ?';
    138     return (bool)db_get_one($sql, array(intval($c_member_id), md5($password)));;
     136    switch (LOGIN_NAME_TYPE) {
     137        case 0:
     138        $username = $c_member_id;
     139        break;
     140        default:
     141        $username = db_member_username4c_member_id($c_member_id);
     142        break;
     143    }
     144   
     145    $auth_config = get_auth_config();
     146    $storage = Auth::_factory($auth_config['storage'],$auth_config['options']);
     147    return $storage->fetchData($username, $password, false);
    139148}
    140149
     
    487496
    488497    $sql = 'DELETE FROM c_member WHERE c_member_id = ?';
     498    db_query($sql, $single);
     499   
     500    $sql = 'DELETE FROM c_username WHERE c_member_id = ?';
    489501    db_query($sql, $single);
    490502}
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/db/member.php

    r939 r1071  
    5050        }
    5151    }
     52   
     53    if ((LOGIN_NAME_TYPE == 1) && $is_secure) {
     54        $c_member['username'] = db_member_username4c_member_id($c_member_id);
     55    }
    5256
    5357    return $c_member;
     
    100104function db_member_c_member_secure4c_member_id($c_member_id)
    101105{
    102     $sql = 'SELECT pc_address, ktai_address, regist_address, easy_access_id FROM c_member_secure WHERE c_member_id = ?';
     106    $sql = 'SELECT pc_address, ktai_address, regist_address, easy_access_id, hashed_password, hashed_password_query_answer FROM c_member_secure WHERE c_member_id = ?';
    103107    $c_member_secure = db_get_row($sql, array(intval($c_member_id)));
    104 
    105     return array_map('t_decrypt', $c_member_secure);
     108   
     109    if (is_array($c_member_secure)) {
     110        return array_map('t_decrypt', $c_member_secure);
     111    } else {
     112        return $c_member_secure;
     113    }
    106114}
    107115
     
    680688        return false;
    681689    }
    682 
    683     $sql = "SELECT c_member_id FROM c_member_secure" .
    684             " WHERE ktai_address = ?" .
    685             " AND hashed_password = ?";
    686     $params = array(t_encrypt($ktai_address), md5($password));
    687     return db_get_one($sql, $params);
     690   
     691    $c_member_id = db_member_c_member_id4username($ktai_address, true);
     692    $sql = "SELECT hashed_password FROM c_member_secure " .
     693            " WHERE c_member_id = ? ";
     694    if (md5($password) != db_get_one($sql, array($c_member_id))) {
     695        return false;
     696    }
     697   
     698    return $c_member_id;
    688699}
    689700
     
    10681079}
    10691080
     1081function db_member_regist_c_member_pc_address4c_member_id($c_member_id, $pc_address)
     1082{
     1083    $data = array(
     1084    'pc_address' => t_encrypt($pc_address),
     1085    'regist_address' => t_encrypt($pc_address),
     1086    );
     1087    $where = array('c_member_id' => intval($c_member_id));
     1088    return db_update('c_member_secure', $data, $where);
     1089}
     1090
    10701091//(ktai_address)
    10711092
     
    11231144}
    11241145
     1146function db_member_h_regist_mail($c_member_id, $pc_address)
     1147{
     1148    $insert_id = 0;
     1149    $session = create_hash();
     1150
     1151    // 既にpreに存在するアドレスかどうか
     1152    if (do_common_c_pc_address_pre4pc_address($pc_address)) {
     1153        $data = array(
     1154            'c_member_id' => intval($c_member_id),
     1155            'session' => $session,
     1156            'r_datetime' => db_now(),
     1157        );
     1158        $where = array('pc_address' => $pc_address);
     1159        db_update('c_pc_address_pre', $data, $where);
     1160    } else {
     1161        $data = array(
     1162            'c_member_id' => intval($c_member_id),
     1163            'pc_address' => $pc_address,
     1164            'session' => $session,
     1165            'r_datetime' => db_now(),
     1166        );
     1167        $insert_id = db_insert('c_pc_address_pre', $data);
     1168    }
     1169
     1170    do_h_regist_mail_mail_send($c_member_id, $session, $pc_address);
     1171    return $insert_id;
     1172}
     1173
    11251174function db_member_delete_c_pc_address_pre4sid($sid)
    11261175{
     
    11441193
    11451194    db_member_update_c_member_pc_address4c_member_id($c_member_id, $pc_address);
     1195    db_member_delete_c_pc_address_pre4sid($sid);
     1196    return true;
     1197}
     1198
     1199function db_member_regist_mail($sid, $password)
     1200{
     1201    if (!$c_pc_address_pre = do_common_c_pc_address_pre4sid($sid)) {
     1202        return false;
     1203    }
     1204
     1205    $c_member_id = $c_pc_address_pre['c_member_id'];
     1206    $pc_address = $c_pc_address_pre['pc_address'];
     1207
     1208    if (!db_common_authenticate_password($c_member_id, $password)) {
     1209        return false;
     1210    }
     1211
     1212    db_member_regist_c_member_pc_address4c_member_id($c_member_id, $pc_address);
    11461213    db_member_delete_c_pc_address_pre4sid($sid);
    11471214    return true;
     
    13731440}
    13741441
     1442function db_member_insert_username($c_member_id, $username)
     1443{
     1444    $data = array(
     1445    "c_member_id"=>$c_member_id,
     1446    "username"=>$username,
     1447    );
     1448    db_insert('c_username', $data);
     1449}
     1450
     1451/**
     1452 * c_member_idからログインIDを取得
     1453 */
     1454function db_member_c_member_id4username($username, $is_ktai = false)
     1455{
     1456    switch (LOGIN_NAME_TYPE) {
     1457        case 0:
     1458        if ($is_ktai) {
     1459            $c_member_id = db_member_c_member_id4ktai_address_encrypted(t_encrypt($username));
     1460        } else {
     1461            $c_member_id = db_member_c_member_id4pc_address($username);
     1462        }
     1463        break;
     1464        default :
     1465        $sql = 'SELECT c_member_id FROM c_username WHERE username = ?';
     1466        $params = array($username);
     1467        $c_member_id = db_get_one($sql, $params);
     1468        break;
     1469    }
     1470    return $c_member_id;
     1471}
     1472
     1473/**
     1474 * ログインIDからc_member_idを取得
     1475 */
     1476function db_member_username4c_member_id($c_member_id, $is_ktai = false)
     1477{
     1478    switch (LOGIN_NAME_TYPE) {
     1479        case 0:
     1480        $c_member_secure = db_member_c_member_secure4c_member_id($c_member_id);
     1481        if ($is_ktai) {
     1482            $username = t_decrypt($c_member_secure['ktai_address']);
     1483        } else {
     1484            $username = t_decrypt($c_member_secure['pc_address']);
     1485        }
     1486        break;
     1487       
     1488        default :
     1489        $sql = 'SELECT username FROM c_username WHERE c_member_id = ?';
     1490        $params = array($c_member_id);
     1491        $username = db_get_one($sql, $params);
     1492        break;
     1493    }
     1494    return $username;
     1495}
     1496
     1497/**
     1498 * ログインしたユーザのメンバー情報が存在しない場合自動で生成
     1499 */
     1500function db_member_create_member($username)
     1501{
     1502        $data = array(
     1503        'nickname'    => "NO NAME",
     1504        'birth_year'  => 0,
     1505        'birth_month' => 0,
     1506        'birth_day'   => 0,
     1507        'public_flag_birth_year' => "public",
     1508        'c_member_id_invite'  => 1,
     1509        'c_password_query_id' => 0,
     1510        'is_receive_mail' => true,
     1511        'is_receive_ktai_mail'  => true,
     1512        'is_receive_daily_news' => true,
     1513        'r_date' => db_now(),
     1514    );
     1515    $c_member_id = db_insert('c_member', $data);
     1516   
     1517    $data = array(
     1518        'c_member_id' => intval($c_member_id),
     1519        'hashed_password' => "",
     1520        'hashed_password_query_answer' => "",
     1521        'pc_address'     => "",
     1522        'ktai_address'   => "",
     1523        'regist_address' => "",
     1524    );
     1525    db_insert('c_member_secure', $data);
     1526   
     1527    $data = array(
     1528        'c_member_id' => intval($c_member_id),
     1529        'username' => $username,
     1530    );
     1531    db_insert('c_username', $data);
     1532}
     1533
     1534/**
     1535 * プロフィールに必須項目が入力されているかを返す。
     1536 * 0:入力済み
     1537 * 1:プロフィール未入力
     1538 * 2:メールアドレス未登録
     1539 */
     1540function db_member_check_param_inputed($c_member_id, $is_ktai = false)
     1541{
     1542    $c_member = db_member_c_member4c_member_id($c_member_id, true);
     1543   
     1544    if (($c_member['nickname']=="")
     1545    ||($c_member['birth_year']=="")
     1546    ||($c_member['birth_month']=="")
     1547    ||($c_member['birth_day']=="")
     1548    ||($c_member['c_password_query_id']=="")
     1549    ||($c_member['secure']['hashed_password_query_answer']=="")
     1550    ) {
     1551        return 1;
     1552    }
     1553   
     1554   
     1555    if ($c_member['secure']['pc_address']=="" && !$is_ktai) {
     1556        return 2;
     1557    }
     1558    if ($c_member['secure']['ktai_address']=="" && $is_ktai) {
     1559        return 2;
     1560    }
     1561   
     1562    return 0;
     1563}
     1564           
     1565
    13751566?>
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/util/mail_send.php

    r399 r1071  
    219219    $ktai_address = $c_member['secure']['ktai_address'];
    220220
    221     $p = array('kad' => t_encrypt($c_member['secure']['ktai_address']));
     221    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_id, true)));
    222222    $login_url = openpne_gen_url('ktai', 'page_o_login', $p);
    223223    $params = array(
     
    456456}
    457457
     458//メールアドレス変更メール
     459function do_h_regist_mail_mail_send($target_c_member_id, $session, $pc_address)
     460{
     461    $params = array(
     462        "c_member" => db_common_c_member4c_member_id($target_c_member_id),
     463        "sid"      => $session,
     464    );
     465    return fetch_send_mail($pc_address, 'm_pc_regist_mail', $params);
     466}
     467
    458468//あしあとお知らせメール
    459469function do_common_send_ashiato_mail($c_member_to, $c_member_from)
     
    474484
    475485    //ktai
    476     $p = array('kad' => t_encrypt($c_member_to['secure']['ktai_address']));
     486    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_to['c_member_id'], true)));
    477487    $params['login_url'] = openpne_gen_url('ktai', 'page_o_login', $p);
    478488    fetch_send_mail($ktai_address, 'm_ktai_ashiato', $params);
     
    511521{
    512522    $c_member_secure = db_common_c_member_secure4c_member_id($c_member_id);
    513     $p = array('kad' => t_encrypt($c_member_secure['ktai_address']));
     523    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_id, true)));
    514524    $params['url'] = openpne_gen_url('ktai', 'page_o_login', $p);
    515525    return fetch_send_mail($ktai_address, 'm_ktai_login_regist_end', $params);
     
    541551{
    542552    $c_member_secure = db_common_c_member_secure4c_member_id($c_member_id);
    543     $p = array('kad' => t_encrypt($c_member_secure['ktai_address']));
     553    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_id, true)));
    544554    $params['url'] = openpne_gen_url('ktai', 'page_o_login', $p);
    545555    return fetch_send_mail($sender, 'm_ktai_login_get', $params);
     
    642652    $ktai_address = $c_member_to['secure']['ktai_address'];
    643653    $is_receive_ktai_mail = $c_member_to['is_receive_ktai_mail'];
    644     $p = array('kad' => t_encrypt($c_member_to['secure']['ktai_address']));
     654    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_to['c_member_id'], true)));
    645655    $login_url = openpne_gen_url('ktai', 'page_o_login', $p);
    646656
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/lib/util/util.php

    r619 r1071  
    444444}
    445445
     446function get_auth_config()
     447{
     448    switch (LOGIN_NAME_TYPE) {
     449        case 1:
     450        $config = $GLOBALS['_OPENPNE_AUTH_CONFIG'];
     451        break;
     452        default :
     453        $config['storage'] = 'DB';
     454        $config['options'] = array(
     455            'dsn'         => db_get_dsn(),
     456            'table'       => 'c_member_secure',
     457            'usernamecol' => 'c_member_id',
     458            'passwordcol' => 'hashed_password',
     459            'cryptType'   => 'md5',
     460        );
     461        break;
     462    }
     463    return $config;
     464}
     465
     466function crypt_func($raw_value,$cryptType)
     467{
     468    if (   isset($cryptType)
     469        && $cryptType == 'none') {
     470        $cryptFunction = 'strval';
     471    } elseif (   isset($cryptType)
     472              && function_exists($cryptType)) {
     473        $cryptFunction = $cryptType;
     474    } else {
     475        $cryptFunction = 'md5';
     476    }
     477   
     478    return $cryptFunction($raw_value);
     479}
     480
    446481?>
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/admin/lib/db_admin.php

    r939 r1071  
    673673    $ktai_address = $c_member_to['secure']['ktai_address'];
    674674    $is_receive_ktai_mail = $c_member_to['is_receive_ktai_mail'];
    675     $p = array('kad' => t_encrypt($c_member_to['secure']['ktai_address']));
     675    $p = array('kad' => t_encrypt(db_member_username4c_member_id($c_member_to['c_member_id'], true)));
    676676    $login_url = openpne_gen_url('ktai', 'page_o_login', $p);
    677677
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/admin/templates/list_c_member.tpl

    r924 r1071  
    110110({/foreach})
    111111<th>ID</th>
     112({if $smarty.const.LOGIN_NAME_TYPE == 1})
     113<th>ユーザID</th>
     114({/if})
    112115<th>PCアドレス</th>
    113116<th>携帯アドレス</th>
     
    209212({/foreach})
    210213<td class="idnumber">({$item.c_member_id})</td>
     214({if $smarty.const.LOGIN_NAME_TYPE == 1})
     215<td>({if $item.username})({$item.username|t_truncate:"30"|escape:"hexentity"})({else})&nbsp;({/if})</td>
     216({/if})
    211217<td>({if $item.secure.pc_address})<a href="mailto:({$item.secure.pc_address|escape:"hexentity"})">({$item.secure.pc_address|t_truncate:"30"|escape:"hexentity"})</a>({else})&nbsp;({/if})</td>
    212218<td>({if $item.secure.ktai_address})<a href="mailto:({$item.secure.ktai_address})">({$item.secure.ktai_address|t_truncate:"30"})</a>({else})&nbsp;({/if})</td>
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/auth.inc

    r404 r1071  
    1212session_id($_REQUEST['ksid']);
    1313session_start();
     14require_once 'OpenPNE/Auth.php';
    1415
    15 if (OPENPNE_SESSION_CHECK_URL) {
    16     if (@$_SESSION['OPENPNE_URL'] != OPENPNE_URL) {
    17         __logout(15);
     16$options = array("advancedsecurity"=>false);
     17
     18$auth = new OpenPNE_Auth('DB','',true);
     19$auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']);
     20$auth->setIdle($GLOBALS['OpenPNE']['common']['session_idletime']);
     21
     22if (   !$auth->auth()
     23    || !($u = $auth->getUsername(LOGIN_NAME_TYPE))
     24    || db_member_is_login_rejected($u)) {
     25    $auth->logout();
     26   
     27    __logout();
     28}
     29
     30$auth->uid($u);
     31$GLOBALS['AUTH'] = $auth;
     32
     33$GLOBALS['KTAI_C_MEMBER_ID'] = $auth->uid();
     34$GLOBALS['KTAI_URL_TAIL'] = "ksid=" . session_id();
     35
     36
     37if (!$_SESSION['regist_step']) {
     38    $check_param = db_member_check_param_inputed($u, true);
     39    $_SESSION['regist_step'] = ($check_param == 0);
     40   
     41    //プロフィールが未登録の場合はリダイレクト
     42    $prof_ext_page=array(
     43    "do_h_regist_prof"=>true,
     44    "page_h_regist_prof"=>true,
     45    );
     46   
     47    if (($check_param==1) && !$prof_ext_page[$_REQUEST['a']]) {
     48        openpne_redirect('ktai', 'page_h_regist_prof');
     49    }
     50   
     51    //メールアドレスが未登録の場合はリダイレクト
     52    $mail_ext_page=array(
     53    "do_h_regist_address"=>true,
     54    "page_h_regist_address"=>true,
     55    );
     56   
     57    if (($check_param==2) && !$mail_ext_page[$_REQUEST['a']]) {
     58        openpne_redirect('ktai', 'page_h_regist_address');
    1859    }
    1960}
    20 
    21 if (   empty($_SESSION['c_member_id'])
    22     || !k_auth($_SESSION['c_member_id'])
    23     || db_member_is_login_rejected($_SESSION['c_member_id'])) {
    24     __logout(15);
    25 }
    26 
    27 // 携帯アドレスのチェック
    28 $c_member_id = _db_c_member_id4ktai_address_encrypted($_SESSION['ktai_address']);
    29 if ($c_member_id != $_SESSION['c_member_id']) {
    30     __logout(15);
    31 }
    32 
    33 // セッションの有効期限
    34 $lifetime = $GLOBALS['OpenPNE']['ktai']['session_lifetime'];
    35 $idletime = $GLOBALS['OpenPNE']['ktai']['session_idletime'];
    36 if (!isset($_SESSION['timestamp']) ||
    37     ($liftime && ($_SESSION['timestamp'] + $lifetime) < time())
    38    ) {
    39     __logout(15, $_SESSION['c_member_id']);
    40 }
    41 if (!isset($_SESSION['idle']) ||
    42     ($idletime && ($_SESSION['idle'] + $idletime) < time())
    43    ) {
    44     __logout(15, $_SESSION['c_member_id']);
    45 }
    46 
    47 $_SESSION['idle'] = time();
    48 
    49 $GLOBALS['KTAI_C_MEMBER_ID'] = $_SESSION['c_member_id'];
    50 $GLOBALS['KTAI_URL_TAIL'] = "ksid=" . session_id();
    51 
    5261
    5362function __logout($msg = 0, $c_member_id = 0)
     
    5968    }
    6069    if ($c_member_id) {
    61         $c_member_secure = db_common_c_member_secure4c_member_id($c_member_id);
    62         $_REQUEST['kad'] = t_encrypt($c_member_secure['ktai_address']);
     70        $_REQUEST['kad'] = t_encrypt(db_member_username4c_member_id($c_member_id, true));
    6371    }
    6472    $_REQUEST['login_params'] = $_SERVER['QUERY_STRING'];
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/do/o_easy_login.php

    r403 r1071  
    99class ktai_do_o_easy_login extends OpenPNE_Action
    1010{
     11    var $_auth;
     12   
    1113    function isSecure()
    1214    {
     
    2729        @session_start();
    2830        @session_regenerate_id();
    29 
     31       
     32        $auth_config = get_auth_config();
     33        $auth_config['options']['advancedsecurity'] = false;
     34        $auth = new OpenPNE_Auth($auth_config['storage'], $auth_config['options'],true);
     35        $this->_auth =& $auth;
     36        $auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']);
     37        $auth->setIdle($GLOBALS['OpenPNE']['common']['session_idletime']);
     38       
     39        if (LOGIN_CHECK_ENABLE) {
     40            // 不正ログインチェック
     41            include_once 'OpenPNE/LoginChecker.php';
     42            $options = array(
     43                'check_num'   => LOGIN_CHECK_NUM,
     44                'check_time'  => LOGIN_CHECK_TIME,
     45                'reject_time' => LOGIN_REJECT_TIME,
     46            );
     47            $lc = new OpenPNE_LoginChecker($options);
     48            if ($lc->is_rejected()) {
     49                // 認証エラー
     50                $lc->fail_login();
     51                $p = array('msg' => '0', 'login_params' => $requests['login_params']);
     52                openpne_redirect('ktai', 'page_o_login', $p);
     53            }
     54        }
     55        $auth->auth =& $auth->factory(true);
     56        $auth->auth->setAuth(db_member_username4c_member_id($c_member_id));
     57        $auth->auth->setAuthData('OPENPNE_URL', OPENPNE_URL);
     58       
    3059        $_SESSION['c_member_id'] = $c_member_id;
    31         $_SESSION['ktai_address'] = t_encrypt($c_member['secure']['ktai_address']);
    32         $_SESSION['timestamp'] = $_SESSION['idle'] = time();
    33         if (OPENPNE_SESSION_CHECK_URL) {
    34             $_SESSION['OPENPNE_URL'] = OPENPNE_URL;
    35         }
    3660
    3761        $p = array();
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/do/o_login.php

    r403 r1071  
    77class ktai_do_o_login extends OpenPNE_Action
    88{
     9    var $_auth;
     10   
    911    function isSecure()
    1012    {
     
    1921        $password = $requests['password'];
    2022        // ----------
    21 
     23       
     24        @session_name('OpenPNEktai');
     25        @session_start();
     26        @session_regenerate_id();
     27       
     28        $auth_config = get_auth_config();
     29        $auth_config['options']['advancedsecurity'] = false;
     30        $auth = new OpenPNE_Auth($auth_config['storage'], $auth_config['options'],true);
     31        $this->_auth =& $auth;
     32        $auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']);
     33        $auth->setIdle($GLOBALS['OpenPNE']['common']['session_idletime']);
     34       
    2235        if (LOGIN_CHECK_ENABLE) {
    2336            // 不正ログインチェック
     
    2942            );
    3043            $lc = new OpenPNE_LoginChecker($options);
    31             if ($lc->is_rejected() || !$c_member_id = k_auth_login($ktai_address, $password)) {
     44            if ($lc->is_rejected() || !$auth->login(false, true, true)) {
    3245                // 認証エラー
    3346                $lc->fail_login();
     
    3649            }
    3750        } else {
    38             if (!$c_member_id = k_auth_login($ktai_address, $password)) {
     51            if (!$auth->login(false, true, true)) {
    3952                $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']);
    4053                openpne_redirect('ktai', 'page_o_login', $p);
    4154            }
    4255        }
    43 
    44         @session_name('OpenPNEktai');
    45         @session_start();
    46         @session_regenerate_id();
    47 
     56        if (!($c_member_id = $auth->getUsername(LOGIN_NAME_TYPE))) {
     57            db_member_create_member($_POST['username']);
     58        }
     59       
    4860        $_SESSION['c_member_id'] = $c_member_id;
    49         $_SESSION['ktai_address'] = t_encrypt($requests['ktai_address']);
    50         $_SESSION['timestamp'] = $_SESSION['idle'] = time();
    51         if (OPENPNE_SESSION_CHECK_URL) {
    52             $_SESSION['OPENPNE_URL'] = OPENPNE_URL;
    53         }
    54 
    5561        $p = array();
    5662        if ($requests['login_params']) {
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/do/o_password_query.php

    r2 r1071  
    1414    function execute($requests)
    1515    {
     16        if (LOGIN_NAME_TYPE == 1) {
     17            exit;
     18        }
    1619        //--- 権限チェック
    1720        //パスワード確認の質問と答えがあっている
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/do/o_update_ktai_address.php

    r2 r1071  
    3838
    3939        // login ページへリダイレクト
    40         $p = array('msg' => 19, 'kad' => t_encrypt($ktai_address));
     40        $p = array('msg' => 19, 'kad' => t_encrypt(db_member_username4c_member_id($c_member_id, true)));
    4141        openpne_redirect('ktai', 'page_o_login', $p);
    4242    }
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/page/o_password_query.php

    r102 r1071  
    1414    function execute($requests)
    1515    {
     16        if (LOGIN_NAME_TYPE == 1) {
     17            exit;
     18        }
    1619        $this->set('password_query_list', p_common_c_password_query4null());
    1720        return 'success';
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/ktai/templates/o_login.tpl

    r792 r1071  
    2424<input type="hidden" name="login_params" value="({$requests.login_params})">
    2525({if $ktai_address})
    26 <input type="hidden" name="ktai_address" value="({$ktai_address})">
     26<input type="hidden" name="username" value="({$ktai_address})">
    2727({else})
     28({if $smarty.const.LOGIN_NAME_TYPE != 1})
    2829★携帯アドレス<br>
    29 <textarea name="ktai_address" rows="1" istyle="3" mode="alphabet" maxlength="100"></textarea><br>
     30({else})
     31★ユーザID<br>
     32({/if})
     33<textarea name="username" rows="1" istyle="3" mode="alphabet" maxlength="100"></textarea><br>
    3034({/if})
    3135★パスワード<br>
     
    4145<a href="({t_url m=ktai a=page_o_login})">&gt;&gt;携帯アドレスを入力</a><br>
    4246({/if})
     47({if $smarty.const.LOGIN_NAME_TYPE != 1})
    4348<a href="({t_url m=ktai a=page_o_password_query})">&gt;&gt;パスワードを忘れた方</a><br>
     49({/if})
    4450<hr>
    4551
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/do/h_config_2.php

    r2 r1071  
    2121
    2222        $msg_list = array();
     23        if (LOGIN_NAME_TYPE == 1) $msg_list[] = "パスワード変更はできません";
    2324        if (!$new_password) $msg_list[] = "パスワードを入力してください";
    2425        if (!$new_password2) $msg_list[] = "パスワード(確認)を入力してください";
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/do/o_login.php

    r403 r1071  
    1919    {
    2020        $this->_login_params = $requests['login_params'];
    21         $options = array(
    22             'dsn'         => db_get_dsn(),
    23             'table'       => 'c_member_secure',
    24             'usernamecol' => 'pc_address',
    25             'passwordcol' => 'hashed_password',
    26             'cryptType'   => 'md5',
    27         );
    28         $auth = new OpenPNE_Auth('DB', $options);
     21        $auth_config = get_auth_config();
     22        $auth = new OpenPNE_Auth($auth_config['storage'], $auth_config['options']);
    2923        $this->_auth =& $auth;
    3024        $auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']);
     
    5145            $this->_fail_login();
    5246        }
     47       
     48        if (!($u = $auth->getUsername(LOGIN_NAME_TYPE))) {
     49            db_member_create_member($_POST['username']);
     50        }
    5351
    5452        db_api_update_token($auth->uid());
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/do/o_password_query.php

    r2 r1071  
    1414    function execute($requests)
    1515    {
     16        if (LOGIN_NAME_TYPE == 1) {
     17            exit;
     18        }
     19       
    1620        // --- リクエスト変数
    1721        $pc_address = $requests['pc_address'];
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/do/o_regist_prof.php

    r882 r1071  
    101101            $_REQUEST['err_msg'] = $errors;
    102102            $mode = 'input';
     103            @session_start();
     104            $_SESSION['prof'] = $_REQUEST;
     105            unset($_SESSION['password']);
    103106        }
    104107
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/page/o_password_query.php

    r2 r1071  
    1414    function execute($requests)
    1515    {
     16        if (LOGIN_NAME_TYPE == 1) {
     17            exit;
     18        }
     19       
    1620        //---- inc_ テンプレート用 変数 ----//
    1721        $this->set('inc_page_header', fetch_inc_page_header('public'));
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/page/o_tologin.php

    r403 r1071  
    5353            $msg = 'このURLは既に無効になっています。';
    5454            break;
     55        case 'regist_mail':
     56            $msg = 'メールアドレスを登録しました。';
     57            break;
    5558        }
    5659        $this->set('msg', $msg);
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/templates/h_config.tpl

    r397 r1071  
    136136</form>
    137137({*********})
    138 
     138({if $smarty.const.LOGIN_NAME_TYPE != 1})
    139139({t_form m=pc a=do_h_config_2})
    140140<input type="hidden" name="sessid" value="({$PHPSESSID})">
     
    238238</form>
    239239({*********})
    240 
     240({/if})
    241241({t_form m=pc a=do_h_config_3})
    242242<input type="hidden" name="sessid" value="({$PHPSESSID})">
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp/modules/pc/templates/o_login.tpl

    r401 r1071  
    3636<div class="msg lh_130">
    3737<input type="checkbox" tabindex="3" name="is_save" id="is_save" value="1" class="no_bg"><label for="is_save">次回から自動的にログイン</label><br>
     38({if $smarty.const.LOGIN_NAME_TYPE != 1})
    3839<span class="password_query"><a href="({t_url m=pc a=page_o_password_query})">&gt;パスワードを忘れた方はこちらへ</a></span>
     40({/if})
    3941({if $SSL_SELECT_URL})
    4042<br><a href="({$SSL_SELECT_URL})">({if $HTTPS})標準(http)({else})SSL(https)({/if})はこちら</a>
  • OpenPNE/branches/takanashi/prj_takanashi3/webapp_biz/modules/ktai_biz/auth.inc

    r312 r1071  
    4949    if ($c_member_id) {
    5050        $c_member_secure = db_common_c_member_secure4c_member_id($c_member_id);
    51         $p['kad'] = t_encrypt($c_member_secure['ktai_address']);
     51        $p['kad'] = t_encrypt(db_member_username4c_member_id($c_member_id, true));
    5252    }
    5353    openpne_redirect('ktai', 'page_o_login', $p);
Note: See TracChangeset for help on using the changeset viewer.