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

Changeset 9804


Ignore:
Timestamp:
Dec 31, 2008, 3:18:43 PM (13 years ago)
Author:
ebihara
Message:

#3240:changed InviteForm? to accepts PCAddress and MobileAddress?

Location:
OpenPNE3/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_frontend/templates/_requestRegisterURLMail.php

    r9802 r9804  
    11以下のURLから<?php echo OpenPNEConfig::get('sns_name') ?>に登録してください。
    22
    3 <?php echo url_for(sprintf('pcAddress/register?token=%s&authMode=%s', $token, $authMode), true) ?>
     3<?php if ($isMobile) : ?>
     4<?php echo app_url_for('mobile_frontend', sprintf('mobileAddress/register?token=%s&authMode=%s', $token, $authMode), true) ?>
     5<?php else: ?>
     6<?php echo app_url_for('pc_frontend', sprintf('pcAddress/register?token=%s&authMode=%s', $token, $authMode), true) ?>
     7<?php endif; ?>
  • OpenPNE3/trunk/lib/form/InviteForm.class.php

    r9802 r9804  
    1212  public function configure()
    1313  {
    14     parent::configure();
    15     $this->isAutoGenerate = false;
    16     $this->memberConfigSettings['pc_address']['IsConfirm'] = false;
    17     $this->setMemberConfigWidget('pc_address');
     14    $this->setWidget('mail_address', new sfWidgetFormInput());
     15    $this->setValidator('mail_address', new sfValidatorEmail());
     16
     17    $this->validatorSchema->setPostValidator(new sfValidatorCallback(array(
     18        'callback' => array($this, 'validate'),
     19    )));
    1820  }
    1921
    20   public function getToken()
     22  public function validate($validator, $values, $arguments = array())
    2123  {
    22     $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address_token', $this->member->getId());
    23     if ($memberConfig) {
    24       return $memberConfig->getValue();
     24    if (opToolkit::isMobileEmailAddress($values['mail_address']))
     25    {
     26      $mailValidator = new sfValidatorMobileEmail();
     27      $values['mobile_address'] = $mailValidator->clean($values['mail_address']);
    2528    }
     29    else
     30    {
     31      $mailValidator = new opValidatorPCEmail();
     32      $values['pc_address'] = $mailValidator->clean($values['mail_address']);
     33    }
     34
     35    return $values;
    2636  }
    2737
    28   public function getMailAddress()
     38  public function saveConfig($name, $value)
    2939  {
    30     $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address_pre', $this->member->getId());
    31     if ($memberConfig) {
    32       return $memberConfig->getValue();
     40    if ('pc_address' === $name || 'mobile_address' === $name)
     41    {
     42      $this->savePreConfig($name, $value);
     43      $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId($name.'_token', $this->member->getId());
     44      $token = $memberConfig->getValue();
     45      $this->sendConfirmMail($token, $value, array(
     46        'id'   => $this->member->getId(),
     47        'type' => $name,
     48      ));
    3349    }
    3450  }
     
    3955      'token'    => $token,
    4056      'authMode' => sfContext::getInstance()->getUser()->getCurrentAuthMode(),
     57      'isMobile' => opToolkit::isMobileEmailAddress($to),
    4158    );
    4259
Note: See TracChangeset for help on using the changeset viewer.