commit 8b8631af7b37dd12bf5f7bf7665647c98ffecdc7
Author: hasse <hasegawa@i-hearts.jp>
Date:   Fri Mar 4 05:42:22 2016 -0500

    ユーザー登録95％　メールの内容はまだ未定　

diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php
index 0f51375..ff94eb0 100755
--- a/app/Controller/AppController.php
+++ b/app/Controller/AppController.php
@@ -50,7 +50,6 @@ class AppController extends Controller {
             'logoutRedirect' => array(
                 'controller' => 'users',
                 'action' => 'login',
-                'home'
             ),
             'authenticate' => array(
 				'Form' => array(
diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php
index 8195f77..df60ecc 100755
--- a/app/Controller/UsersController.php
+++ b/app/Controller/UsersController.php
@@ -10,10 +10,11 @@ class UsersController extends AppController {
 
 	public $layout = 'procedure';
 	public $name = 'users';
+	public $uses = array('User');
 
     public function beforeFilter() {
         parent::beforeFilter();
-        $this->Auth->allow('register','activate','confirm','sent');
+        $this->Auth->allow('register','activate','confirm','sent','login');
     }
 
 /**
@@ -88,7 +89,7 @@ class UsersController extends AppController {
 		$this->set('register',$this->Session->read('register'));
 		$name = $this->Session->read('register.User.login_id');
 		$mail = $this->Session->read('register.User.email');
-        // ユーザアクティベート(本登録)用URLの作成
+        // ユーザアクティベート(本登録)用URLの作成 DSはスラッシュの意味
         $url = 
             DS . 'users' .          // コントローラ
             DS . 'activate' .                       // アクション
@@ -102,8 +103,8 @@ class UsersController extends AppController {
 		$Email->emailFormat('text');
 		$Email->template('user_register');
 		$Email->viewVars(array('name'=>$name,'comment'=>$comment));
-		$Email->from($mail);
-		$Email->to('hasegawa@i-hearts.jp');
+		$Email->from('hasegawa@i-hearts.jp');
+		$Email->to($mail);
 		$Email->subject('[PICT CODE]問い合わせ');
 		$Email->send();
 	    }
diff --git a/app/Model/User.php b/app/Model/User.php
index 1ec00e2..359fb53 100755
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -19,35 +19,46 @@ class User extends AppModel {
  */
 	public $validate = array(
 		'login_id' => array(
-			'notBlank' => array(
 				'rule' => array('notBlank'),
-				//'message' => 'Your custom message here',
-				//'allowEmpty' => false,
-				//'required' => false,
-				//'last' => false, // Stop validation after this rule
-				//'on' => 'create', // Limit validation to 'create' or 'update' operations
+                'message' => 'この項目は入力必須です'
 			),
-		),
         'email' => array(
+        	array(
+				'rule' => array('notBlank'),
+                'message' => 'メールアドレスを入力してください'
+            ),
             // メールアドレスであること。
-            'validEmail' => array( 'rule' => array( 'email', true), 'message' => 'アドレスを入力して下さい'),
+            'isEmail' => array( 
+				'rule' => 'Email',
+            	'message' => '正しいメールアドレスを入力してください'
+            ),
+            array(
+                'rule' => 'DuplicateEmailCheck', 
+                'message' => 'このメールアドレスは既に登録されています'
+            ), 
             // 一意性チェック
             // 'emailExists' => array( 'rule' => 'isUnique', 'message' => '既に登録されています'),
         ),
         'password' => array(
-             // パスワード・確認用パスワードの一致
-             'match' => array( 'rule' => array( 'confirmPassword', 'password_confirm'), 'message' => '一致しません'),
+            array(
+				'rule' => array('notBlank'),
+                'message' => 'パスワードを入力してください'
+            ), 
+            array(
+                'rule' => array('minLength', 8), 
+                'message' => 'パスワードは8文字以上入力してください', 
+            ),
+            array(
+                'rule' => 'passwordConfirm', 
+                'message' => 'パスワードが一致していません'
+            ), 
+        ),
+        'password_confirm' => array(
+            array(
+				'rule' => array('notBlank'),
+                'message' => 'パスワード(確認)を入力してください'
+            ), 
         ),
-		// 'password' => array(
-		// 	'notBlank' => array(
-		// 		'rule' => array('notBlank'),
-		// 		//'message' => 'Your custom message here',
-		// 		//'allowEmpty' => false,
-		// 		//'required' => false,
-		// 		//'last' => false, // Stop validation after this rule
-		// 		//'on' => 'create', // Limit validation to 'create' or 'update' operations
-		// 	),
-		// ),
 		'status' => array(
 			'numeric' => array(
 				'rule' => array('numeric'),
@@ -61,15 +72,32 @@ class User extends AppModel {
 	);
 
 
+	public function DuplicateEmailCheck(){
+		$query = array('conditions' => array('User.email' => $this->data['User']['email'],'User.status' => 1));
+		$num = $this->find('count',$query);
+		//$this->log($recodes);
+		//var_dump($num);
+		//exit;
+		if($num > 0){
+            return false;	//登録済み		
+		} else{
+            return true;	//未登録	
+		}
+	}
 
-    public function confirmPassword( $field, $password_confirm) {
-        if ($field['password'] === $this->data[$this->name][$password_confirm]) {
+    public function passwordConfirm($check){
+        //２つのパスワードフィールドが一致する事を確認する
+        if($this->data['User']['password'] === $this->data['User']['password_confirm']){
             // パスワードハッシュ化
-            $this->data[$this->name]['password'] = Security::hash( $plain, 'sha512', true);
+            $this->data[$this->name]['password'] = Security::hash( $password, 'sha512', true);
             return true;
+        }else{
+            return false;
         }
+
     }
 
+
 	public function getActivationHash() {
 	    // ユーザIDの有無確認
 	    if (!isset($this->id)) {
diff --git a/app/View/Layouts/procedure.ctp b/app/View/Layouts/procedure.ctp
index 5879866..81740d1 100755
--- a/app/View/Layouts/procedure.ctp
+++ b/app/View/Layouts/procedure.ctp
@@ -44,7 +44,7 @@
 	<header>
 		<a href="/top/index"><img class="header_button left" type="button" src="/img/btn_header_004.png" alt=""></a>
 		<img class="center" src="/img/header_title.png" alt="Pict Code">
-		<a href=""><img class="header_button right" type="button" src="/img/btn_header_014.png" alt=""></a>
+		<a href="/users/logout"><img class="header_button right" type="button" src="/img/btn_header_014.png" alt=""></a>
 	</header>
 
 
diff --git a/app/View/users/activate.ctp b/app/View/users/activate.ctp
index b4521e7..03fb73e 100755
--- a/app/View/users/activate.ctp
+++ b/app/View/users/activate.ctp
@@ -13,16 +13,10 @@
 				<section>
 				<h3>登録が完了しました！</h3>
 				<p>この度は、PictCodeにご登録いただき誠にありがとうございます。<br>PictCodeは、これからIT技術を担っていくお子様達に、プログラミングを楽しんでもらうと同時に、プログラムを組む上で必要な「計画性」と「組織性」、そして「想像力」を育むツールでもあります。プログラミングにおいて、この無限大の可能性を持つツールを用いる事で、お子様の想像力を最大限に発揮させ、さらには世界を代表するような逸材に育てていきましょう！</p>
-				</section>
-
-
-			<?php 
-    echo $this->Session->flash();
-    echo $this->Html->link( 'ログイン画面へ', '/users/login');
-?>	
+				</section>	
 			</div>
 				<section class="button_area01">
-					<a href="index.html"><p class="button btn_top02"></p></a>
+					<a href="/top/index"><p class="button btn_top02"></p></a>
 				</section>
 		</article>
 	</main>
diff --git a/app/View/users/confirm.ctp b/app/View/users/confirm.ctp
index feeb172..6ea7a14 100755
--- a/app/View/users/confirm.ctp
+++ b/app/View/users/confirm.ctp
@@ -25,7 +25,7 @@
 				</section>
 			</div>
 				<section class="button_area01">
-					<a href="register.html"><p class="button btn_alter01"></p></a>
+					<a href="javascript:history.back();"><p class="button btn_alter01"></p></a>
 					<a href="/users/sent"><p class="button btn_register"></p></a>
 				</section>
 		</article>
diff --git a/app/View/users/login.ctp b/app/View/users/login.ctp
index f84c81c..33d074f 100755
--- a/app/View/users/login.ctp
+++ b/app/View/users/login.ctp
@@ -8,45 +8,41 @@
             <p class="">ほぞんデータを かんりするためには、ニックネームと パスワードを 入力して ログインする ひつようが あります。 入力に まちがいがないように 注意してください。</p>
             <?php echo $this->Form->create('User',array(
                                         'div' => false,
-                                        'type'=>'post',
+                                        'novalidate' => true,
+                                        'inputDefaults' => array(
+                                            'before'  => '<dt>',
+                                            'between' => '</dt><dd>',
+                                            'after' => '</dd>',
+                                            'div' => false
+                                            )
                                         )); ?>
                 <fieldset>
                     <section>
                     <dl>
                             <?php
-                                echo 
-                                '<dt><label for="">ニックネーム</label></dt>
-                                <dd>';
-                                echo $this->Form->text('login_id',
+                                echo $this->Form->input('login_id',
                                     array( 'type' => 'text',
+                                            'label' => 'ニックネーム',
                                             'placeholder'=>'ニックネーム'
                                         ));
-                                echo 
-                                '</dd>
-                                <dt><label for="">パスワード</label></dt>
-                                <dd>';
-                                echo $this->Form->text('password',
+                                echo $this->Form->input('password',
                                     array( 'placeholder'=>'パスワード',
+                                            'label' => 'パスワード',
                                             'maxlength' => '50',
                                             'type' => 'password'
                                         ));
-                                echo 
-                                '</dd>';
                             ?>
                         </dl>
                     </section>
-                </fieldset>
-                <?php  $this->Form->submit('送信する',array('class'=>'btn btn-info')); ?>
-                <?php  $this->Form->end(); ?>
-                
-                    <?php echo $this->Flash->render('auth'); ?>
-                
+                </fieldset>   
+                <?php  echo $this->Session->flash(); ?>             
                 <section>
                     <p>ニックネームや パスワードを 忘れたばあいには お父さんや お母さんに 相談して、<br><a href="reminder.html"><span class="link_reminder">コチラ</span></a>を　クリックして　パスワードを　再はっこうしてもらってね！</p>
                 </section>
                 <section class="button_area01">
                     <a href="/top/index"><p class="button btn_back02"></p></a>
-                    <a href="login_top"><p class="button btn_login"></p></a>
+                <?php  echo $this->Form->submit('',array('class'=>'button btn_check01')); ?>
+                <?php  echo $this->Form->end(); ?>
                 </section>
         </article>
     </main>
diff --git a/app/View/users/register.ctp b/app/View/users/register.ctp
index c5e442e..1122d1d 100755
--- a/app/View/users/register.ctp
+++ b/app/View/users/register.ctp
@@ -13,67 +13,65 @@
 			<div id="contents">
 			<?php echo $this->Form->create('User',array(
 										'div' => false,
-										'type'=>'post',
-										//action'=>'register',
+										'novalidate' => true,
+										'inputDefaults' => array(
+									        'before'  => '<dt>',
+									        'between' => '</dt><dd>',
+									        'after' => '</dd>',
+									        'div' => false
+									        )
 										)); ?>
 				<fieldset>
 					<section>
 						<dl>
 							<?php
-								echo 
-								'<dt><label for="">ニックネーム</label></dt>
-								<dd>';
-								echo $this->Form->text('login_id',
+								echo $this->Form->input('login_id',
 									array( 'type' => 'text',
+											'label' => 'ニックネーム',
 											'placeholder'=>'ニックネーム'
 										));
-								echo 
-								'</dd>
-								<dt><label for="">パスワード</label></dt>
-								<dd>';
-								echo $this->Form->text('password',
+								echo $this->Form->input('password',
 									array( 'placeholder'=>'パスワード',
+											'label' => 'パスワード',
 											'maxlength' => '50',
 											'type' => 'password'
 										));
-								echo 
-								'</dd>
-								<dt><label for="">パスワード（確認用）</label></dt>
-								<dd>';
-								 echo $this->Form->text('password_confirm',
+								 echo $this->Form->input('password_confirm',
 								  	array( 'placeholder'=>'パスワード（確認用）',
+											'label' => 'パスワード（確認用）',
 								  		 'maxlength' => '50', 
 								  		  'type' => 'password'
 								  		));
-								 echo
-								'</dd>
-								<dt><label for="">メールアドレス</label></dt>
-								<dd>';
-								echo $this->Form->text( 'email', array('placeholder'=>'メールアドレス',
+								echo $this->Form->input( 'email',
+									array('placeholder'=>'メールアドレス',
+											'label' => 'メールアドレス',
 											'maxlength' => '255',
 								 			'type' => 'email'));
 
 
-								 $this->Form->input('user_flg',1);
-								 $this->Form->input('status',1);
+								echo $this->Form->input('user_flg',
+								 	array(	'type' => 'hidden',
+										 	'value' => 0,	
+								 		));
+								echo $this->Form->input('status',
+								 	array(	'type' => 'hidden',
+										 	'value' => 0,	
+								 		));
 							?>
 						</dl>
 					</section>
 				</fieldset>
-				<?php  $this->Form->submit('送信する',array('class'=>'btn btn-info')); ?>
-				<?php  $this->Form->end(); ?>
-			<?php //echo $this->Form->end(__('Submit')); ?>
-			<?php //echo $this->Form->end('Register'); ?>
-			<?php //echo $this->Form->end(); ?>
 			</div>
 				<section class="button_area01">
 					<a href="javascript:history.back();">
 						<p class="button btn_back01"></p>
 					</a>
-					<a href="/users/confirm">
+				<?php  echo $this->Form->submit('',array('class'=>'button btn_check01')); ?>
+				<?php  echo $this->Form->end(); ?>
+<!-- 					<a href="/users/confirm">
 						<p class="button btn_check01"></p>
 					</a>
-				</section>
+ -->				</section>
 		</article>
 	</main>
 
diff --git a/app/webroot/css/main.css b/app/webroot/css/main.css
index a7b368d..70665c4 100755
--- a/app/webroot/css/main.css
+++ b/app/webroot/css/main.css
@@ -570,6 +570,11 @@ article.register dl dd {
   font-size: 24px;
 }
 
+article.register dl dd span{
+	margin:0px 0 0 120px;
+  	font-size: 14px;
+}
+
 article.register dl dd p {
 	margin:9px 0 0 0px;
   padding: 3px 0 3px 120px;
@@ -603,6 +608,11 @@ article.register dl dd input:focus{
 	border: 1px solid #1abc9c;
 }
 
+div.submit input {
+    border: none;
+}
+
+
 
 /* Contact Form */
 
@@ -966,4 +976,4 @@ article.admin section.save_data ul li a {
 article.admin section.save_data ul li a:hover {
 	display: block;
 	box-shadow:none;
-}
\ No newline at end of file
+}
