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

Changeset 5059


Ignore:
Timestamp:
Jan 27, 2008, 10:17:11 PM (12 years ago)
Author:
ogawa
Message:

#1843:ログイン機能実装

Location:
OpenPNE/branches/work/ogawa/symfony
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/ogawa/symfony/apps/admin/config/factories.yml

    r5051 r5059  
    1111    class: sfSessionTestStorage
    1212
    13 #all:
     13all:
    1414#  controller:
    1515#    class: sfFrontWebController
     
    2424#    class: myUser
    2525#
    26 #  storage:
    27 #    class: sfSessionStorage
    28 #    param:
    29 #      session_name: symfony
    30 #
     26  storage:
     27    class: sfSessionStorage
     28    param:
     29      session_name: openpneadmin
     30
    3131#  view_cache:
    3232#    class: sfFileCache
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/config/factories.yml

    r5050 r5059  
    1111    class: sfSessionTestStorage
    1212
    13 #all:
     13all:
    1414#  controller:
    1515#    class: sfFrontWebController
     
    2424#    class: myUser
    2525#
    26 #  storage:
    27 #    class: sfSessionStorage
    28 #    param:
    29 #      session_name: symfony
    30 #
     26  storage:
     27    class: sfSessionStorage
     28    param:
     29      session_name: openpnepc
     30
    3131#  view_cache:
    3232#    class: sfFileCache
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/config/routing.yml

    r5050 r5059  
    22homepage:
    33  url:   /
    4   param: { module: default, action: index }
     4  param: { module: home, action: index }
    55
    66default_symfony:
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/config/security.yml

    r5050 r5059  
    11default:
    2   is_secure: off
     2  is_secure: on
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/config/settings.yml

    r5050 r5059  
    2121    etag:                   off
    2222
    23 #all:
    24 #  .actions:
     23all:
     24  .actions:
    2525#    default_module:         default   # Default module and action to be called when
    2626#    default_action:         index     # A routing rule doesn't set it
     
    2929#    error_404_action:       error404  # Or when the requested URL doesn't match any route
    3030#
    31 #    login_module:           default   # To be called when a non-authenticated user
    32 #    login_action:           login     # Tries to access a secure page
    33 #
     31    login_module:           login   # To be called when a non-authenticated user
     32    login_action:           index     # Tries to access a secure page
     33
    3434#    secure_module:          default   # To be called when a user doesn't have
    3535#    secure_action:          secure    # The credentials required for an action
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/config/view.yml

    r5050 r5059  
    44
    55  metas:
    6     title:        symfony project
    7     robots:       index, follow
    8     description:  symfony project
    9     keywords:     symfony, project
    10     language:     en
     6    title:        <?php echo sfConfig::get('app_sns_name'); ?>
     7#    robots:       index, follow
     8#    description:  symfony project
     9#    keywords:     symfony, project
     10#    language:     en
    1111
    1212  stylesheets:    [main]
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/modules/home/actions/actions.class.php

    r5058 r5059  
    1717  public function executeIndex()
    1818  {
    19     $this->forward('default', 'module');
     19    return sfView::SUCCESS;
    2020  }
    2121}
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/modules/home/templates/indexSuccess.php

    r5058 r5059  
     1login ok.
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/modules/login/actions/actions.class.php

    r5058 r5059  
    44 * login actions.
    55 *
    6  * @package    openpne
     6 * @package    OpenPNE
    77 * @subpackage login
    88 * @author     Your name here
     
    1717  public function executeIndex()
    1818  {
    19     $this->forward('default', 'module');
     19    return sfView::SUCCESS;
     20  }
     21
     22  public function executeLogin()
     23  {
     24    $this->getUser()->setAuthenticated(true);
     25    $this->redirect('/');
     26  }
     27
     28  public function executeLogout()
     29  {
     30    $this->getUser()->setAuthenticated(false);
     31    $this->redirect('login');
     32  }
     33
     34  public function validateLogin()
     35  {
     36    $username = $this->getRequestParameter('username');
     37    $password = $this->getRequestParameter('password');
     38
     39    $member = MemberPeer::retrieveByMailAddress($username);
     40    if ($member) {
     41      if ($member->getPassword() === md5($password . $member->getPasswordSalt())) {
     42        return true;
     43      }
     44    }
     45    return false;
     46  }
     47
     48  public function handleErrorLogin()
     49  {
     50    $this->forward('login', 'index');
    2051  }
    2152}
  • OpenPNE/branches/work/ogawa/symfony/apps/pc/modules/login/templates/indexSuccess.php

    r5058 r5059  
     1<h2>ログイン</h2>
     2
     3<?php echo form_tag('login/login', array('method' => 'post')); ?>
     4
     5<dl>
     6  <dt>メールアドレス</dt>
     7  <dd><?php echo input_tag('username'); ?></dd>
     8  <dt>パスワード</dt>
     9  <dd><?php echo input_password_tag('password'); ?></dd>
     10  <dd><?php echo submit_tag('ログイン'); ?></dd>
     11</dl>
     12</form>
  • OpenPNE/branches/work/ogawa/symfony/lib/model/MemberPeer.php

    r5052 r5059  
    1010class MemberPeer extends BaseMemberPeer
    1111{
     12  static public function retrieveByMailAddress($mailAddress)
     13  {
     14    $c = new Criteria();
     15    $c->add(self::MAIL_ADDRESS, $mailAddress);
     16    return self::doSelectOne($c);
     17  }
    1218}
Note: See TracChangeset for help on using the changeset viewer.