リビジョン 304d523f
| app/Controller/AppController.php | ||
|---|---|---|
| 57 | 57 |
'username' => 'login_id', //Default is 'username' in the userModel |
| 58 | 58 |
'password' => 'password' //Default is 'password' in the userModel |
| 59 | 59 |
), |
| 60 |
// 'status' => 0, |
|
| 60 | 61 |
'passwordHasher' => 'Blowfish' |
| 61 | 62 |
) |
| 62 | 63 |
), |
| app/Controller/TopController.php | ||
|---|---|---|
| 47 | 47 |
* index |
| 48 | 48 |
*/ |
| 49 | 49 |
public function index() {
|
| 50 |
if($this->Auth->user()){
|
|
| 50 |
if($this->Auth->user('status')==1){
|
|
| 51 | 51 |
$this->redirect('/users/login_top');
|
| 52 | 52 |
} |
| 53 | 53 |
} |
| ... | ... | |
| 174 | 174 |
|
| 175 | 175 |
//formのパラメータ取得 |
| 176 | 176 |
$post = $this->request->data['ContactValidate']['postcode']; |
| 177 |
// var_dump($post); |
|
| 178 |
// exit; |
|
| 179 |
// $options = array( |
|
| 180 |
// 'conditions'=>array( |
|
| 181 |
// 'postcode like' => $post.'%' , |
|
| 182 |
// ) |
|
| 183 |
// ); |
|
| 184 |
$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
|
|
| 185 |
|
|
| 186 |
// データをjsonに変換して出力 |
|
| 187 |
echo json_encode($result); |
|
| 177 |
if(mb_strlen($post)>2){
|
|
| 178 |
$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
|
|
| 179 |
|
|
| 180 |
// データをjsonに変換して出力 |
|
| 181 |
echo json_encode($result); |
|
| 182 |
} |
|
| 188 | 183 |
|
| 189 | 184 |
} |
| 190 | 185 |
} |
| app/Controller/UsersController.php | ||
|---|---|---|
| 117 | 117 |
public function activate( $user_id = null, $in_hash = null) {
|
| 118 | 118 |
// UserモデルにIDをセット |
| 119 | 119 |
$this->User->id = $user_id; |
| 120 |
$mail = $this->Session->read('register.User.email');
|
|
| 121 |
|
|
| 122 |
$options = array('conditions' => array('User.email' => $mail, 'User.status' => 1));
|
|
| 123 |
$user = $this->User->find('count', $options);
|
|
| 124 |
if($user > 0){
|
|
| 125 |
// 本登録に無効なURL |
|
| 126 |
$this->Session->setFlash( 'このメールアドレスは登録済みです'); |
|
| 127 |
return $this->redirect(array('controller' => 'top', 'action' => 'error'));
|
|
| 128 |
} |
|
| 120 | 129 |
if ($this->User->exists() && $in_hash == $this->User->activationHash()) {
|
| 121 | 130 |
// 本登録に有効なURL |
| 122 | 131 |
// statusフィールドを1に更新 |
| 123 | 132 |
$this->User->saveField( 'status', 1); |
| 124 | 133 |
$this->Session->setFlash( 'Your account has been activated.'); |
| 125 | 134 |
|
| 126 |
$mail = $this->Session->read('register.User.email');
|
|
| 127 | 135 |
// exit; |
| 128 | 136 |
|
| 129 | 137 |
$Email = new CakeEmail(); |
| ... | ... | |
| 215 | 223 |
* @return void |
| 216 | 224 |
*/ |
| 217 | 225 |
public function login() {
|
| 218 |
if($this->Auth->user()){
|
|
| 226 |
if($this->Auth->user('status') == 1){
|
|
| 219 | 227 |
$this->redirect('/users/login_top');
|
| 220 | 228 |
} |
| 221 | 229 |
if ($this->request->is('post')) {
|
| ... | ... | |
| 264 | 272 |
if($this->User->validates()){
|
| 265 | 273 |
$this->Session->write('register',$this->request->data);
|
| 266 | 274 |
$this->redirect(array('action'=>'reset_pwd_confirm'));
|
| 267 |
}else{
|
|
| 268 |
$this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array(
|
|
| 269 |
'key' => 'positive', |
|
| 270 |
)); |
|
| 275 |
// }else{
|
|
| 276 |
// $this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array(
|
|
| 277 |
// 'key' => 'positive',
|
|
| 278 |
// ));
|
|
| 271 | 279 |
} |
| 272 | 280 |
} |
| 273 | 281 |
} |
| app/Model/ContactValidate.php | ||
|---|---|---|
| 55 | 55 |
'message' => 'メールアドレス(確認)を入力してください' |
| 56 | 56 |
), |
| 57 | 57 |
), |
| 58 |
|
|
| 58 |
'postcode' => array( |
|
| 59 |
array( |
|
| 60 |
'rule' => 'numeric', |
|
| 61 |
'message' => '数字のみ入力してください' |
|
| 62 |
), |
|
| 63 |
), |
|
| 59 | 64 |
'comment' => array( |
| 60 | 65 |
'notblank' => array( |
| 61 | 66 |
'rule' => array('notblank'),
|
| app/Model/User.php | ||
|---|---|---|
| 27 | 27 |
'rule' => 'isUnique', |
| 28 | 28 |
'message' => '既に登録されています' |
| 29 | 29 |
), |
| 30 |
array( |
|
| 31 |
'rule' => array('minLength', 3),
|
|
| 32 |
'message' => 'パスワードは3文字以上入力してください', |
|
| 33 |
), |
|
| 30 | 34 |
), |
| 31 | 35 |
'email' => array( |
| 32 | 36 |
array( |
| app/View/top/contact.ctp | ||
|---|---|---|
| 28 | 28 |
echo $this->Form->input('email',
|
| 29 | 29 |
array('placeholder'=>'半角英数字',
|
| 30 | 30 |
'label' => 'メールアドレス', |
| 31 |
'style'=>'ime-mode: disabled;', |
|
| 31 | 32 |
'maxlength' => '255', |
| 32 | 33 |
'type' => 'email')); |
| 33 | 34 |
echo $this->Form->input('email_confirm',
|
| 34 | 35 |
array('placeholder'=>'半角英数字',
|
| 35 | 36 |
'label' => 'メールアドレス(確認用)', |
| 37 |
'style'=>'ime-mode: disabled;', |
|
| 36 | 38 |
'maxlength' => '255', |
| 37 | 39 |
'type' => 'email')); |
| 38 | 40 |
echo $this->Form->input('postcode', array('label'=>'郵便番号(ハイフンなし)',
|
| 39 | 41 |
'onkeyup'=>'zipsearch()', |
| 40 |
'placeholder'=>'半角数字', |
|
| 42 |
'placeholder'=>'0000000', |
|
| 43 |
'style'=>'ime-mode: disabled;', |
|
| 44 |
'type' => 'text' |
|
| 41 | 45 |
)); |
| 42 | 46 |
echo $this->Form->input('prefecture', array('label'=>'ご住所',
|
| 43 | 47 |
'placeholder'=>'例) ○○県 ○○市○○町 ○丁目 ○‐○', |
| ... | ... | |
| 48 | 52 |
)); |
| 49 | 53 |
echo $this->Form->input('tel',
|
| 50 | 54 |
array('placeholder'=>'半角数字(00-0000-0000)',
|
| 55 |
'style'=>'ime-mode: disabled;', |
|
| 51 | 56 |
'label' => 'お電話番号', |
| 52 | 57 |
'maxlength' => '13', |
| 53 | 58 |
'type' => 'text')); |
| ... | ... | |
| 66 | 71 |
<a href="/top/index"><p class="button btn_back01"></p></a> |
| 67 | 72 |
<?php echo $this->Form->submit('',array('class'=>'button btn_check01')); ?>
|
| 68 | 73 |
<?php echo $this->Form->end(); ?> |
| 69 |
<!-- <a href="contact_check.html"><p class="button btn_check01"></p></a> |
|
| 70 |
--> </section> |
|
| 74 |
</section> |
|
| 71 | 75 |
</article> |
| 72 | 76 |
</main> |
| 73 | 77 |
|
| ... | ... | |
| 85 | 89 |
// 成功した場合 |
| 86 | 90 |
success: function(data){
|
| 87 | 91 |
console.log('data',data);
|
| 88 |
// console.log(data.Zipcode.cho); |
|
| 89 | 92 |
$('input#ContactValidatePrefecture').val(data[0].zipcodes.ken+' '+data[0].zipcodes.shi_ku+' '+data[0].zipcodes.cho);
|
| 90 |
// $('input#UserAddress').val(data.Zipcode.shi_ku+' '+data.Zipcode.cho);
|
|
| 91 |
//$('input#UserAddress').val(data.Zipcode.cho);
|
|
| 92 | 93 |
} |
| 93 |
// , |
|
| 94 |
// // // 通信できなかった場合(オプション) |
|
| 95 |
// // error: function(){
|
|
| 96 |
// // alert('なんかミスってる..');
|
|
| 97 |
// } |
|
| 98 | 94 |
}); |
| 99 | 95 |
// }); |
| 100 | 96 |
}; |
| app/View/users/_add.ctp | ||
|---|---|---|
| 1 |
<main role="main"> |
|
| 2 |
<article class="register"> |
|
| 3 |
<h2> |
|
| 4 |
<img src="/img/img_h1_register01.png" alt="PictCode登録 - 情報入力"> |
|
| 5 |
</h2> |
|
| 6 |
<ol> |
|
| 7 |
<li id="navigator01_on"></li> |
|
| 8 |
<li id="navigator02_off"></li> |
|
| 9 |
<li id="navigator03_off"></li> |
|
| 10 |
<li id="navigator04_off"></li> |
|
| 11 |
</ol> |
|
| 12 |
<p class="">PictCodeに新規登録を行います。登録の際にはご両親の付き添い、または管理のもと、お間違いのないよう入力を行ってください。</p> |
|
| 13 |
<div id="contents"> |
|
| 14 |
<?php echo $this->Form->create('User',array(
|
|
| 15 |
'div' => false, |
|
| 16 |
'type'=>'post', |
|
| 17 |
'action'=>'signup' |
|
| 18 |
'inputDefaults' => array( |
|
| 19 |
'before' => '<dt>', |
|
| 20 |
'between' => '</dt><dd>', |
|
| 21 |
'after' => '</dd>', |
|
| 22 |
'wrapInput' => false, |
|
| 23 |
), |
|
| 24 |
'class' => 'well')); ?> |
|
| 25 |
<fieldset> |
|
| 26 |
<section> |
|
| 27 |
<dl> |
|
| 28 |
<?php |
|
| 29 |
echo |
|
| 30 |
'<dt><label for="">ニックネーム</label></dt> |
|
| 31 |
<dd>'; |
|
| 32 |
echo $this->Form->text('login_id',
|
|
| 33 |
array( 'type' => 'text', |
|
| 34 |
'placeholder'=>'ニックネーム' |
|
| 35 |
)); |
|
| 36 |
echo |
|
| 37 |
'</dd> |
|
| 38 |
<dt><label for="">パスワード</label></dt> |
|
| 39 |
<dd>'; |
|
| 40 |
echo $this->Form->text('password',
|
|
| 41 |
array( 'placeholder'=>'パスワード', |
|
| 42 |
'maxlength' => '50', |
|
| 43 |
'type' => 'password' |
|
| 44 |
)); |
|
| 45 |
echo |
|
| 46 |
'</dd> |
|
| 47 |
<dt><label for="">パスワード(確認用)</label></dt> |
|
| 48 |
<dd>'; |
|
| 49 |
echo $this->Form->text('password_confirm',
|
|
| 50 |
array( 'placeholder'=>'パスワード(確認用)', |
|
| 51 |
'maxlength' => '50', |
|
| 52 |
'type' => 'password' |
|
| 53 |
)); |
|
| 54 |
echo |
|
| 55 |
'</dd> |
|
| 56 |
<dt><label for="">メールアドレス</label></dt> |
|
| 57 |
<dd>'; |
|
| 58 |
echo $this->Form->text( 'username', array( 'maxlength' => '255', 'type' => 'email')); |
|
| 59 |
|
|
| 60 |
|
|
| 61 |
$this->Form->input('user_flg',1);
|
|
| 62 |
$this->Form->input('status',1);
|
|
| 63 |
?> |
|
| 64 |
</dl> |
|
| 65 |
</section> |
|
| 66 |
</fieldset> |
|
| 67 |
<?php //echo $this->Form->end(__('Submit')); ?>
|
|
| 68 |
<?php echo $this->Form->end('Register'); ?>
|
|
| 69 |
</div> |
|
| 70 |
<section class="button_area01"> |
|
| 71 |
<a href="index.html"><p class="button btn_back01"></p></a> |
|
| 72 |
<a href="register_check.html"><p class="button btn_check01"></p></a> |
|
| 73 |
</section> |
|
| 74 |
</article> |
|
| 75 |
</main> |
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
<!-- <div class="users form"> |
|
| 83 |
<?php //echo $this->Form->create('User'); ?>
|
|
| 84 |
<fieldset> |
|
| 85 |
<legend><?php //echo __('Add User'); ?></legend>
|
|
| 86 |
<?php |
|
| 87 |
//echo $this->Form->input('login_id',array( 'type' => 'text'));
|
|
| 88 |
//echo $this->Form->input('password');
|
|
| 89 |
//echo $this->Form->input('user_flg');
|
|
| 90 |
//echo $this->Form->input('status', array(
|
|
| 91 |
//'options' => array('0' => 'Active', '1' => 'expire')));
|
|
| 92 |
?> |
|
| 93 |
</fieldset> |
|
| 94 |
<?php //echo $this->Form->end(__('Submit')); ?>
|
|
| 95 |
</div> --> |
|
| 96 |
<!-- <div class="actions"> |
|
| 97 |
<h3><?php //echo __('Actions'); ?></h3>
|
|
| 98 |
<ul> |
|
| 99 |
|
|
| 100 |
<li><?php //echo $this->Html->link(__('List Users'), array('action' => 'index')); ?></li>
|
|
| 101 |
<li><?php //echo $this->Html->link(__('List Logins'), array('controller' => 'logins', 'action' => 'index')); ?> </li>
|
|
| 102 |
<li><?php //echo $this->Html->link(__('New Login'), array('controller' => 'logins', 'action' => 'add')); ?> </li>
|
|
| 103 |
<li><?php //echo $this->Html->link(__('List Programs'), array('controller' => 'programs', 'action' => 'index')); ?> </li>
|
|
| 104 |
<li><?php //echo $this->Html->link(__('New Program'), array('controller' => 'programs', 'action' => 'add')); ?> </li>
|
|
| 105 |
</ul> |
|
| 106 |
</div> |
|
| 107 |
--> |
|
| app/View/users/_edit.ctp | ||
|---|---|---|
| 1 |
<div class="users form"> |
|
| 2 |
<?php echo $this->Form->create('User'); ?>
|
|
| 3 |
<fieldset> |
|
| 4 |
<legend><?php echo __('Edit User'); ?></legend>
|
|
| 5 |
<?php |
|
| 6 |
echo $this->Form->input('id' );
|
|
| 7 |
echo $this->Form->input('login_id',array( 'type' => 'text'));
|
|
| 8 |
echo $this->Form->input('password');
|
|
| 9 |
echo $this->Form->input('user_flg');
|
|
| 10 |
echo $this->Form->input('status');
|
|
| 11 |
?> |
|
| 12 |
</fieldset> |
|
| 13 |
<?php echo $this->Form->end(__('Submit')); ?>
|
|
| 14 |
</div> |
|
| 15 |
<div class="actions"> |
|
| 16 |
<h3><?php echo __('Actions'); ?></h3>
|
|
| 17 |
<ul> |
|
| 18 |
|
|
| 19 |
<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>
|
|
| 20 |
<li><?php echo $this->Html->link(__('List Users'), array('action' => 'index')); ?></li>
|
|
| 21 |
<li><?php echo $this->Html->link(__('List Logins'), array('controller' => 'logins', 'action' => 'index')); ?> </li>
|
|
| 22 |
<li><?php echo $this->Html->link(__('New Login'), array('controller' => 'logins', 'action' => 'add')); ?> </li>
|
|
| 23 |
<li><?php echo $this->Html->link(__('List Programs'), array('controller' => 'programs', 'action' => 'index')); ?> </li>
|
|
| 24 |
<li><?php echo $this->Html->link(__('New Program'), array('controller' => 'programs', 'action' => 'add')); ?> </li>
|
|
| 25 |
</ul> |
|
| 26 |
</div> |
|
| app/View/users/register.ctp | ||
|---|---|---|
| 23 | 23 |
)); ?> |
| 24 | 24 |
<fieldset> |
| 25 | 25 |
<section> |
| 26 |
<dl> |
|
| 26 |
<dl class="register_form">
|
|
| 27 | 27 |
<?php |
| 28 | 28 |
echo $this->Form->input('login_id',
|
| 29 | 29 |
array( 'type' => 'text', |
| app/webroot/css/main.css | ||
|---|---|---|
| 570 | 570 |
font-size: 24px; |
| 571 | 571 |
} |
| 572 | 572 |
|
| 573 |
article.register dl dd span{
|
|
| 573 |
article.register dl.register_form dd span{
|
|
| 574 | 574 |
margin:0px 0 0 120px; |
| 575 | 575 |
font-size: 14px; |
| 576 | 576 |
} |
| 577 | 577 |
|
| 578 | 578 |
article.register dl dd p {
|
| 579 |
margin:9px 0 0 0px; |
|
| 580 |
padding: 3px 0 3px 120px; |
|
| 579 |
padding: 3px 0 3px 120px; |
|
| 581 | 580 |
} |
| 582 | 581 |
|
| 583 | 582 |
article.register dl dt label{
|
| ... | ... | |
| 660 | 659 |
-webkit-border-radius: 5px; |
| 661 | 660 |
-moz-border-radius: 5px; |
| 662 | 661 |
border-radius: 5px; |
| 662 |
border: 2px inset #E4E4E4; |
|
| 663 | 663 |
} |
| 664 | 664 |
|
| 665 |
|
|
| 666 |
|
|
| 667 |
|
|
| 665 | 668 |
article.contact dl dd div input span, |
| 666 | 669 |
article.contact dl dd div textarea span{
|
| 667 | 670 |
margin: 0px; |
| 668 | 671 |
} |
| 669 |
article.contact dl dd div.input span{
|
|
| 670 |
margin: 0 0 0 120px; |
|
| 671 |
} |
|
| 672 |
|
|
| 673 | 672 |
|
| 674 | 673 |
article.contact dl dd textarea {
|
| 675 | 674 |
height: 180px; |
他の形式にエクスポート: Unified diff