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

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

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)) {
