OSDN Git Service

メールアドレス登録時の仮登録修正
authorCake <cake_67@users.sourceforge.jp>
Wed, 11 Aug 2010 03:14:29 +0000 (12:14 +0900)
committerCake <cake_67@users.sourceforge.jp>
Wed, 11 Aug 2010 03:14:29 +0000 (12:14 +0900)
app/controllers/components/auth_plus.php
app/controllers/regist_mails_controller.php
app/controllers/users_controller.php
app/locale/jpn/LC_MESSAGES/default.po
app/models/app_model.php
app/views/elements/pc_mainnav.ctp
app/views/regist_mails/add.ctp

index 9a11644..b8b8213 100644 (file)
@@ -38,6 +38,7 @@ class AuthPlusComponent extends AuthComponent {
                } else {
                        $this->loginRedirect = Configure::read('Routing.basePath');
                }
+
                if ("/".$this->loginRedirect == Router::normalize(Configure::read('Routing.loginPath'))) {
                        $this->loginRedirect = Router::normalize(Configure::read('Routing.basePath'));
                        if (Configure::read('mobileUserAgent')) {
index 8e3e9a5..e080b58 100644 (file)
@@ -124,6 +124,11 @@ class RegistMailsController extends AppController {
                        }
                }
 
+               if (isset($this->user['User']['pcmail']) && !empty($this->user['User']['pcmail'])) {
+                       $this->user['User']['pcmail'] = $this->Crypt->decrypt($this->user['User']['pcmail']);
+               }
+               $this->set('user', $this->user);
+
                $this->pageTitle .= " - ". __('Regist Mail', true);
        }
 
index d71836a..8711a7a 100644 (file)
@@ -216,10 +216,12 @@ class UsersController extends ModuleController {
 
        function edit_mail($code = null) {
                if (empty($code)) {
-                               $this->Session->setFlash(__('Invalid URL.', true));
+                       $this->Session->setFlash(__('Invalid URL.', true));
                        $this->redirect(array('controller' => 'users', 'action'=>'login'));
                }
+
                $registData = $this->{$this->modelClass}->getRegistData4code($code);
+
                // $codeに該当するデータなし、user_idが異なる
                if (empty($registData) || empty($registData['RegistMail']['user_id']) || $registData['RegistMail']['user_id'] != $this->user_id) {
                        $this->Session->setFlash(__('Invalid URL.', true));
@@ -591,7 +593,6 @@ class UsersController extends ModuleController {
                                $this->{$this->modelClass}->deleteRegistData4mail($registData['RegistMail']['mail']);
                        }
 
-
                        $this->redirect(array('controller' => 'users', 'action'=>'index'));
                }
        }
@@ -621,7 +622,7 @@ class UsersController extends ModuleController {
                        $fields = array('pcmail');
                }
 
-               // バリデーション
+               // validate
                $data['User']['id'] = $this->user_id;
                if ($this->User->save($data, array('fieldList' => $fields, 'validate' => false))) {
                                $this->{$this->modelClass}->deleteRegistData4mail($registData['RegistMail']['mail']);
index ef3e350..0d6ea8f 100644 (file)
@@ -1865,8 +1865,16 @@ msgid "Regist Mail"
 msgstr "メールアドレス登録"
 
 #: /views/regist_mails/add.ctp:
-msgid "Input your mail address."
-msgstr "メールアドレスを入力してください。"
+msgid "Change Mail"
+msgstr "メールアドレス変更"
+
+#: /views/regist_mails/add.ctp:
+msgid "Your Address"
+msgstr "現在のアドレス"
+
+#: /views/regist_mails/add.ctp:
+msgid "New address"
+msgstr "登録するアドレス"
 
 #: /controllers/regist_mails_controller.php:
 msgid "This Address has been registed."
index 3a4fab2..a94f7a0 100644 (file)
@@ -286,6 +286,20 @@ class AppModel extends Model {
                return $this->RegistMail->deleteAll($conditions);
        }
 
+       function deleteRegistData4user_id($user_id)
+       {
+               if (!$user_id) {
+                       return null;
+               }
+
+               $this->RegistMail = CorePlus::set_model('RegistMail');
+               $conditions = array(
+                       'RegistMail.user_id' => $user_id,
+               );
+
+               return $this->RegistMail->deleteAll($conditions);
+       }
+
        function isUniquePcMail($data)
        {
                // usersチェック
index 6b3e542..4549cb6 100644 (file)
@@ -1,3 +1,4 @@
+<?php if ($this->action != 'regist_end'): ?>
 <?php if (isset($site_configs['Site.outerHome']['value']) && $site_configs['Site.outerHome']['value']): ?>
        <li><?php echo $html->link($site_configs['Site.outerHomeLinkname']['value'], $site_configs['Site.outerHome']['value']); ?>
 <?php endif; ?>
@@ -25,3 +26,4 @@
 <?php echo $html->link(__('Login', true), array('controller' => 'users', 'action' => 'login')); ?>
 <?php endif; ?>
 </li>
+<?php endif; ?>
\ No newline at end of file
index c9134ac..bc20046 100644 (file)
@@ -1,14 +1,32 @@
 <div class="registMails form">
 <?php echo $form->create('RegistMail');?>
 <fieldset>
-<legend><?php __('Regist Mail');?></legend>
-<?php
-       echo $html->div('attention', __('Input your mail address.', true));
-       echo $form->input('mail', array(
-               'label' => false,
-       ));
 
-       echo $token->create();
+<?php 
+if (isset($user['User']['pcmail']) && !empty($user['User']['pcmail'])) {
+       echo $html->tag('legend', __('Change Mail', true));
+} else {
+       echo $html->tag('legend', __('Regist Mail', true));
+}
+
+if (isset($user['User']['pcmail']) && !empty($user['User']['pcmail'])) {
+       echo $html->div('input', 
+               $html->tag('label', 
+                       __('Your Address', true),
+                       array(
+                       )
+               ).
+               $html->div('', 
+                       $user['User']['pcmail']
+               )
+       );
+}
+
+echo $form->input('mail', array(
+       'label' =>  __('New address', true),
+));
+
+echo $token->create();
 ?>
 </fieldset>
 <?php echo $form->end(array('label' => __('Submit', true)));?>