commit 304d523f157352bcc507b65e216f21bfc4b69756
Author: hasse <hasegawa@i-hearts.jp>
Date:   Wed Mar 16 22:22:42 2016 -0400

    バリデーションやログイン周り、CSSの修正

diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php
index d235739..6ee5731 100755
--- a/app/Controller/AppController.php
+++ b/app/Controller/AppController.php
@@ -57,6 +57,7 @@ class AppController extends Controller {
 					    'username' => 'login_id', //Default is 'username' in the userModel
 						'password' => 'password'  //Default is 'password' in the userModel
 					),
+					// 'status' => 0,
 					'passwordHasher' => 'Blowfish'
                 )
             ),
diff --git a/app/Controller/TopController.php b/app/Controller/TopController.php
index 77e2da3..7125dc1 100755
--- a/app/Controller/TopController.php
+++ b/app/Controller/TopController.php
@@ -47,7 +47,7 @@ class TopController extends AppController {
  * index
  */
 	public function index() {
-		if($this->Auth->user()){
+		if($this->Auth->user('status')==1){
 					$this->redirect('/users/login_top');                          
 		}
 	}
@@ -174,17 +174,12 @@ class TopController extends AppController {
             
             	//formのパラメータ取得
            	$post = $this->request->data['ContactValidate']['postcode'];
-           	// var_dump($post);
-           	// exit;
-			// $options = array(
-			// 'conditions'=>array(
-			// 	'postcode like' => $post.'%' ,
-			// )
-		// );
-		$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
-       
-		// データをjsonに変換して出力
-		echo json_encode($result);
+	           	if(mb_strlen($post)>2){
+					$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
+			       
+					// データをjsonに変換して出力
+					echo json_encode($result);
+	           	}
 
 		}
 	}
diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php
index 2ebbf4c..bb66114 100755
--- a/app/Controller/UsersController.php
+++ b/app/Controller/UsersController.php
@@ -117,13 +117,21 @@ class UsersController extends AppController {
 	public function activate( $user_id = null, $in_hash = null) {
 	    // UserモデルにIDをセット
 	    $this->User->id = $user_id;
+		$mail = $this->Session->read('register.User.email');
+
+		$options = array('conditions' => array('User.email' => $mail, 'User.status' => 1));
+		$user = $this->User->find('count', $options);
+		if($user > 0){
+	    // 本登録に無効なURL
+	        $this->Session->setFlash( 'このメールアドレスは登録済みです');
+			return $this->redirect(array('controller' => 'top', 'action' => 'error'));
+		}
 	    if ($this->User->exists() && $in_hash == $this->User->activationHash()) {
 	    // 本登録に有効なURL
 	        // statusフィールドを1に更新
 	        $this->User->saveField( 'status', 1);
 	        $this->Session->setFlash( 'Your account has been activated.');
 			
-			$mail = $this->Session->read('register.User.email');
 			// exit;
 
 			$Email = new CakeEmail();
@@ -215,7 +223,7 @@ class UsersController extends AppController {
  * @return void
  */
 	public function login() {
-		if($this->Auth->user()){
+		if($this->Auth->user('status') == 1){
 					$this->redirect('/users/login_top');                          
 		}
 		if ($this->request->is('post')) {
@@ -264,10 +272,10 @@ class UsersController extends AppController {
 			if($this->User->validates()){
 				$this->Session->write('register',$this->request->data);
 				$this->redirect(array('action'=>'reset_pwd_confirm'));
-			}else{
-				$this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array(
-				    'key' => 'positive',
-					));
+			// }else{
+			// 	$this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array(
+			// 	    'key' => 'positive',
+			// 		));
 			}
 		}
 	}
diff --git a/app/Model/ContactValidate.php b/app/Model/ContactValidate.php
index e6b1f95..1262cf5 100755
--- a/app/Model/ContactValidate.php
+++ b/app/Model/ContactValidate.php
@@ -55,7 +55,12 @@ class ContactValidate extends AppModel {
                 'message' => 'メールアドレス(確認)を入力してください'
             ), 
         ),
-
+        'postcode' => array(
+        	array(
+				'rule'    => 'numeric',
+                'message' => '数字のみ入力してください'
+            ),
+        ),
         'comment' => array(
 			'notblank' => array(
 				'rule' => array('notblank'),
diff --git a/app/Model/User.php b/app/Model/User.php
index b57767c..b68daa9 100755
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -27,6 +27,10 @@ class User extends AppModel {
                 'rule' => 'isUnique', 
                 'message' => '既に登録されています'
             ),
+            array( 
+                'rule' => array('minLength', 3), 
+                'message' => 'パスワードは3文字以上入力してください', 
+            ),
         ),
         'email' => array(
         	array(
diff --git a/app/View/top/contact.ctp b/app/View/top/contact.ctp
index b89da93..da33ff6 100755
--- a/app/View/top/contact.ctp
+++ b/app/View/top/contact.ctp
@@ -28,16 +28,20 @@
 								echo $this->Form->input('email',
 									array('placeholder'=>'半角英数字',
 											'label' => 'メールアドレス',
+											'style'=>'ime-mode: disabled;',
 											'maxlength' => '255',
 								 			'type' => 'email'));
 								echo $this->Form->input('email_confirm',
 									array('placeholder'=>'半角英数字',
 											'label' => 'メールアドレス(確認用)',
+											'style'=>'ime-mode: disabled;',
 											'maxlength' => '255',
 								 			'type' => 'email'));
 								echo $this->Form->input('postcode', array('label'=>'郵便番号（ハイフンなし）',
 											'onkeyup'=>'zipsearch()',
-											'placeholder'=>'半角数字',
+											'placeholder'=>'0000000',
+											'style'=>'ime-mode: disabled;',
+											'type' => 'text'
 											)); 
 								echo $this->Form->input('prefecture', array('label'=>'ご住所',
 											'placeholder'=>'例） ○○県 ○○市○○町 ○丁目 ○‐○',
@@ -48,6 +52,7 @@
 											)); 
 								echo $this->Form->input('tel',
 									array('placeholder'=>'半角数字(00-0000-0000)',
+											'style'=>'ime-mode: disabled;',
 											'label' => 'お電話番号',
 											'maxlength' => '13',
 								 			'type' => 'text'));
@@ -66,8 +71,7 @@
 				<a href="/top/index"><p class="button btn_back01"></p></a>
 				<?php echo $this->Form->submit('',array('class'=>'button btn_check01')); ?>
 				<?php echo $this->Form->end(); ?>
-<!-- 				<a href="contact_check.html"><p class="button btn_check01"></p></a>
- -->			</section>
+			</section>
 		</article>
 	</main>
 
@@ -85,16 +89,8 @@ function zipsearch(){
             // 成功した場合
             success: function(data){
 		console.log('data',data);
-		// console.log(data.Zipcode.cho);
 		$('input#ContactValidatePrefecture').val(data[0].zipcodes.ken+' '+data[0].zipcodes.shi_ku+' '+data[0].zipcodes.cho);
-		// $('input#UserAddress').val(data.Zipcode.shi_ku+' '+data.Zipcode.cho);
-		//$('input#UserAddress').val(data.Zipcode.cho);
             }
-            // ,
-            // // // 通信できなかった場合（オプション）
-            // // error: function(){
-            // //     alert('なんかミスってる..');
-            // }
         });
 //    });
 };
diff --git a/app/View/users/_add.ctp b/app/View/users/_add.ctp
new file mode 100755
index 0000000..a39d4dd
--- /dev/null
+++ b/app/View/users/_add.ctp
@@ -0,0 +1,107 @@
+<main role="main">
+		<article class="register">
+			<h2>
+				<img src="/img/img_h1_register01.png" alt="PictCode登録 - 情報入力">
+			</h2>
+			<ol>
+			<li id="navigator01_on"></li>
+			<li id="navigator02_off"></li>
+			<li id="navigator03_off"></li>
+			<li id="navigator04_off"></li>
+			</ol>
+			<p class="">PictCodeに新規登録を行います。登録の際にはご両親の付き添い、または管理のもと、お間違いのないよう入力を行ってください。</p>
+			<div id="contents">
+			<?php echo $this->Form->create('User',array(
+										'div' => false,
+										'type'=>'post',
+										'action'=>'signup'
+										'inputDefaults' => array(
+											'before' => '<dt>',
+										    'between' => '</dt><dd>',
+										    'after' => '</dd>',
+											'wrapInput' => false,
+										),
+											'class' => 'well')); ?>
+				<fieldset>
+					<section>
+						<dl>
+							<?php
+								echo 
+								'<dt><label for="">ニックネーム</label></dt>
+								<dd>';
+								echo $this->Form->text('login_id',
+									array( 'type' => 'text',
+											'placeholder'=>'ニックネーム'
+										));
+								echo 
+								'</dd>
+								<dt><label for="">パスワード</label></dt>
+								<dd>';
+								echo $this->Form->text('password',
+									array( 'placeholder'=>'パスワード',
+											'maxlength' => '50',
+											'type' => 'password'
+										));
+								echo 
+								'</dd>
+								<dt><label for="">パスワード（確認用）</label></dt>
+								<dd>';
+								 echo $this->Form->text('password_confirm',
+								  	array( 'placeholder'=>'パスワード（確認用）',
+								  		 'maxlength' => '50', 
+								  		  'type' => 'password'
+								  		));
+								 echo
+								'</dd>
+								<dt><label for="">メールアドレス</label></dt>
+								<dd>';
+								echo $this->Form->text( 'username', array( 'maxlength' => '255', 'type' => 'email'));
+
+
+								 $this->Form->input('user_flg',1);
+								 $this->Form->input('status',1);
+							?>
+						</dl>
+					</section>
+				</fieldset>
+			<?php //echo $this->Form->end(__('Submit')); ?>
+			<?php echo $this->Form->end('Register'); ?>
+			</div>
+				<section class="button_area01">
+					<a href="index.html"><p class="button btn_back01"></p></a>
+					<a href="register_check.html"><p class="button btn_check01"></p></a>
+				</section>
+		</article>
+	</main>
+
+
+
+
+
+
+<!-- <div class="users form">
+<?php //echo $this->Form->create('User'); ?>
+	<fieldset>
+		<legend><?php //echo __('Add User'); ?></legend>
+	<?php
+		//echo $this->Form->input('login_id',array( 'type' => 'text'));
+		//echo $this->Form->input('password');
+		//echo $this->Form->input('user_flg');
+		//echo $this->Form->input('status', array(
+		            //'options' => array('0' => 'Active', '1' => 'expire')));
+	?>
+	</fieldset>
+<?php //echo $this->Form->end(__('Submit')); ?>
+</div> -->
+<!-- <div class="actions">
+	<h3><?php //echo __('Actions'); ?></h3>
+	<ul>
+
+		<li><?php //echo $this->Html->link(__('List Users'), array('action' => 'index')); ?></li>
+		<li><?php //echo $this->Html->link(__('List Logins'), array('controller' => 'logins', 'action' => 'index')); ?> </li>
+		<li><?php //echo $this->Html->link(__('New Login'), array('controller' => 'logins', 'action' => 'add')); ?> </li>
+		<li><?php //echo $this->Html->link(__('List Programs'), array('controller' => 'programs', 'action' => 'index')); ?> </li>
+		<li><?php //echo $this->Html->link(__('New Program'), array('controller' => 'programs', 'action' => 'add')); ?> </li>
+	</ul>
+</div>
+ -->
\ No newline at end of file
diff --git a/app/View/users/_edit.ctp b/app/View/users/_edit.ctp
new file mode 100755
index 0000000..2e0308f
--- /dev/null
+++ b/app/View/users/_edit.ctp
@@ -0,0 +1,26 @@
+<div class="users form">
+<?php echo $this->Form->create('User'); ?>
+	<fieldset>
+		<legend><?php echo __('Edit User'); ?></legend>
+	<?php
+		echo $this->Form->input('id' );
+		echo $this->Form->input('login_id',array( 'type' => 'text'));
+		echo $this->Form->input('password');
+		echo $this->Form->input('user_flg');
+		echo $this->Form->input('status');
+	?>
+	</fieldset>
+<?php echo $this->Form->end(__('Submit')); ?>
+</div>
+<div class="actions">
+	<h3><?php echo __('Actions'); ?></h3>
+	<ul>
+
+		<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('User.id')), array('confirm' => __('Are you sure you want to delete # %s?', $this->Form->value('User.id')))); ?></li>
+		<li><?php echo $this->Html->link(__('List Users'), array('action' => 'index')); ?></li>
+		<li><?php echo $this->Html->link(__('List Logins'), array('controller' => 'logins', 'action' => 'index')); ?> </li>
+		<li><?php echo $this->Html->link(__('New Login'), array('controller' => 'logins', 'action' => 'add')); ?> </li>
+		<li><?php echo $this->Html->link(__('List Programs'), array('controller' => 'programs', 'action' => 'index')); ?> </li>
+		<li><?php echo $this->Html->link(__('New Program'), array('controller' => 'programs', 'action' => 'add')); ?> </li>
+	</ul>
+</div>
diff --git a/app/View/users/register.ctp b/app/View/users/register.ctp
index a0e01eb..1fa795e 100755
--- a/app/View/users/register.ctp
+++ b/app/View/users/register.ctp
@@ -23,7 +23,7 @@
 										)); ?>
 				<fieldset>
 					<section>
-						<dl>
+						<dl class="register_form">
 							<?php
 								echo $this->Form->input('login_id',
 									array( 'type' => 'text',
diff --git a/app/webroot/css/main.css b/app/webroot/css/main.css
index 2023278..118529b 100755
--- a/app/webroot/css/main.css
+++ b/app/webroot/css/main.css
@@ -570,14 +570,13 @@ article.register dl dd {
   font-size: 24px;
 }
 
-article.register dl dd span{
+article.register dl.register_form 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;
+  	padding: 3px 0 3px 120px;
 }
 
 article.register dl dt label{
@@ -660,16 +659,16 @@ article.contact dl dd textarea {
 	-webkit-border-radius: 5px;
 	-moz-border-radius: 5px;
 	border-radius: 5px;
+    border: 2px inset #E4E4E4;
 }
 
+
+
+
 article.contact dl dd div input span,
 article.contact dl dd div textarea span{
 	margin: 0px;
 }
-article.contact dl dd div.input span{
-	margin: 0 0 0 120px;
-}
-
 
 article.contact dl dd textarea {
 	height: 180px;
