Commit dfd654f4 by Prasong Putichanchai

Merge branch 'integration' into prasong

# Conflicts:
#	www/src/Controller/UsersController.php
parents d39b375e fe787816
...@@ -105,6 +105,8 @@ class ProfilesController extends AppController ...@@ -105,6 +105,8 @@ class ProfilesController extends AppController
$userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']); $userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th']; $userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th']; $userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th'];
$userPersonals['firstname_en'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_en'] = $this->request->data['UserPersonals']['lastname_th'];
$userPersonals['email'] = $this->request->data['email']; $userPersonals['email'] = $this->request->data['email'];
$userPersonals['birthdate'] = $birthdate; $userPersonals['birthdate'] = $birthdate;
$userPersonals['user_id'] = $data['Users']['user_id']; $userPersonals['user_id'] = $data['Users']['user_id'];
......
...@@ -306,11 +306,11 @@ class UserCardsController extends AppController ...@@ -306,11 +306,11 @@ class UserCardsController extends AppController
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']); return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
} }
}else{ }else{
$this->Flash->success(__('ลงทะเบียนไว้อยู่แล้ว')); $this->Flash->error(__('ลงทะเบียนไว้อยู่แล้ว'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']); return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
} }
}else{ }else{
$this->Flash->success(__('ไม่พบข้อมูล')); $this->Flash->error(__('ไม่พบข้อมูล'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']); return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
} }
} }
......
...@@ -20,7 +20,11 @@ class UsersController extends AppController { ...@@ -20,7 +20,11 @@ class UsersController extends AppController {
*/ */
public function initialize() { public function initialize() {
parent::initialize(); parent::initialize();
$this->Auth->allow(['signin', 'signout', 'signup', 'verify', 'forgotPassword', 'createAccount', 'pinCode', 'pinCodepassword', 'changeForgotpassword']);
// $this->Auth->allow(['signin', 'signout', 'signup', 'verify', 'forgotPassword', 'createAccount', 'pinCode', 'pinCodepassword', 'changeForgotpassword']);
$this->Auth->allow(['signin', 'signout', 'signup', 'verify','forgotPassword','createAccount','pinCode','pinCodepassword','registersendpin','forgotsendpin','changeForgotpassword']);
} }
public function index() { public function index() {
...@@ -354,13 +358,87 @@ class UsersController extends AppController { ...@@ -354,13 +358,87 @@ class UsersController extends AppController {
} }
} }
public function pinCodepassword($token = null) {
$this->viewBuilder()->layout('blank'); // public function pinCodepassword($token = null) {
$users = $this->Users->find('all', [ // $this->viewBuilder()->layout('blank');
'conditions' => [ // $users = $this->Users->find('all', [
'Users.token' => $token // 'conditions' => [
] // 'Users.token' => $token
])->first(); // ]
// ])->first();
public function pinCodepassword($token=null)
{
$this->viewBuilder()->layout('blank');
$users = $this->Users->find('all',[
'conditions'=>[
'Users.token'=>$token
]
])->first();
if($this->request->is('post')){
$data = $this->request->data();
$data['pin_pass'] = $data['pin_code_1'].$data['pin_code_2'].$data['pin_code_3'].$data['pin_code_4'];
if($data['pin_pass']==$users['pin_pass']){
$this->Flash->success(__('Pin Completed.'));
return $this->redirect(['controller' => 'Users', 'action' => 'changeForgotpassword/'.$token]);
}
$this->Flash->error(__('Pin Invalid'));
return $this->redirect(['controller' => 'Users', 'action' => 'pinCodepassword/'.$token]);
}
$this->set(array('token' => $token, '_serialize' => array('token')));
}
public function changePassword()
{
$id = $this->Auth->user('id');
$this->viewBuilder()->layout('blank');
$users = $this->Users->get($id);
if ($this->request->is('post')) {
$hasher = new DefaultPasswordHasher();
$password = $this->request->data['password'];
$confirm_password = $this->request->data['confirm_password'];
$oldpassword = $this->request->data['oldpassword'];
$this->request->data['password'] = $hasher->hash($this->request->data['password']);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
if (password_verify($oldpassword, $users['password'])) {
$users = $this->Users->patchEntity($users, $this->request->getData());
$this->Users->save($users);
$this->Flash->success(__('You are now logged out.'));
return $this->redirect(['action' => 'signout']);
} else {
$this->Flash->error(__('Invalid password.'));
return $this->redirect(['action' => 'change-password']);
}
}
}
public function changeForgotpassword($token=null)
{
$this->viewBuilder()->layout('blank');
$users = $this->Users->find('all',[
'conditions' => [
'Users.token' => $token
]
])->first();
if ($this->request->is('post')) {
$hasher = new DefaultPasswordHasher();
$password = $this->request->data['password'];
$confirm_password = $this->request->data['confirm_password'];
$this->request->data['password'] = $hasher->hash($this->request->data['password']);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
$users = $this->Users->patchEntity($users, $this->request->getData());
$this->Users->save($users);
$this->Flash->success(__('You are now logged out.'));
return $this->redirect(['action' => 'signin']);
}
$this->set(array('token' => $token, '_serialize' => array('token')));
}
if ($this->request->is('post')) { if ($this->request->is('post')) {
$data = $this->request->data(); $data = $this->request->data();
...@@ -446,4 +524,66 @@ class UsersController extends AppController { ...@@ -446,4 +524,66 @@ class UsersController extends AppController {
return $this->redirect($this->Auth->logout()); return $this->redirect($this->Auth->logout());
} }
public function forgotsendpin($token=null) {
$this->loadModel('UserPersonals');
$users = $this->Users->find('all',[
'conditions'=>[
'Users.token'=>$token
]
])->first();
$digits = 4;
$users['pin_pass'] = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);
$user_personals = $this->UserPersonals->find('all',[
'conditions'=>[
'UserPersonals.user_id'=>$users['id']
]
])->first();
//--------------------ตัวส่ง Email ---------------------------------------------------------
//pr($user_personals);die;
$data_notification = [];
$data_notification['email'] = $user_personals['email'];
$data_notification['pin_code'] = $users['pin_pass'].'<br>'." Username: ".$users['username'];
$this->notification($data_notification);
//----------------------------------------------------------------------------------------
if($this->Users->save($users)){
$this->Flash->success(__('send pin success.'));
return $this->redirect(['action' => 'pin_codepassword/'.$token]);
}
$this->Flash->success(__('send pin false.'));
return $this->redirect(['action' => 'pin_codepassword/'.$token]);
}
public function registersendpin($token=null) {
$this->loadModel('UserPersonals');
$users = $this->Users->find('all',[
'conditions'=>[
'Users.token'=>$token
]
])->first();
$digits = 4;
$users['pin_pass'] = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);
$user_personals = $this->UserPersonals->find('all',[
'conditions'=>[
'UserPersonals.user_id'=>$users['id']
]
])->first();
//--------------------ตัวส่ง Email ---------------------------------------------------------
//pr($user_personals);die;
$data_notification = [];
$data_notification['email'] = $user_personals['email'];
$data_notification['pin_code'] = $users['pin_pass'].'<br>'." Username: ".$users['username'];
$this->notification($data_notification);
//----------------------------------------------------------------------------------------
if($this->Users->save($users)){
$this->Flash->success(__('send pin success.'));
return $this->redirect(['action' => 'pin_code/'.$token]);
}
$this->Flash->success(__('send pin false.'));
return $this->redirect(['action' => 'pin_code/'.$token]);
}
} }
...@@ -48,11 +48,17 @@ ...@@ -48,11 +48,17 @@
<div style="clear: both"></div> <div style="clear: both"></div>
</div><!--/row--> </div><!--/row-->
<br><br> <br><br>
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?> <?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?>
<?php echo $this->Flash->render() ?> <?php echo $this->Flash->render() ?>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<h3> <?php echo __('ข้อมูลสมาชิก');?></h3>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?> <?php echo $this->Form->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME', 'readonly']); ?> <?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME', 'readonly']); ?>
...@@ -117,14 +123,14 @@ ...@@ -117,14 +123,14 @@
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('เบอร์โทรศัพท์');?><em>* </em> <?php echo __('เบอร์โทรศัพท์(มือถือ)');?><em>* </em>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'placeholder' => '000-000-0000']); ?> <?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'placeholder' => 'หมายเลขโทรศัพท์(มือถือ)']); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('อีเมลล์');?><em>* </em> <?php echo __('อีเมล');?><em>* </em>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, 'placeholder' => 'mail@xxx.com']); ?> --> <!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, 'placeholder' => 'mail@xxx.com']); ?> -->
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from"> <input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from">
...@@ -222,12 +228,21 @@ ...@@ -222,12 +228,21 @@
// console.log(data); // console.log(data);
data = jQuery.parseJSON(data); data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){ if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว"); alert("อีเมลนี้มีในระบบแล้ว");
return false; return false;
} }
}); });
}); });
$("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value;
// console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert("กรอกเฉพาะตัวเลข");
return false;
}
})
}); });
function validateForm() { function validateForm() {
var firstname_th = document.getElementById("firstname_th").value; var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") { if (firstname_th == null || firstname_th == "") {
...@@ -251,7 +266,7 @@ ...@@ -251,7 +266,7 @@
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน"); alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false; return false;
} }
if(document.getElementById("moblieNo").value.length != 12) if(document.getElementById("moblieNo").value.length != 10)
{ {
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก'); alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
return false; return false;
...@@ -461,8 +476,6 @@ ...@@ -461,8 +476,6 @@
<?php $this->append('scriptBottom'); ?> <?php $this->append('scriptBottom'); ?>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('#moblieNo').inputmask('999-999-9999');
$('#officePhone').inputmask('99-999-9999');
//================================================== //==================================================
// CHANGE Date Times // CHANGE Date Times
//================================================== //==================================================
......
...@@ -141,11 +141,13 @@ use Cake\I18n\Time; ...@@ -141,11 +141,13 @@ use Cake\I18n\Time;
<img src="/img/core/img/bloc-plus@3x.png" class="img-responsive" style="width: 100%"> <img src="/img/core/img/bloc-plus@3x.png" class="img-responsive" style="width: 100%">
</div> </div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow"></div> <div class="col-xs-1 col-sm-1 col-md-1 box-arrow"></div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserCards', ['id' => 'frmSignIn', 'type' => 'file', 'onsubmit' => 'return check();']); ?> <?php echo $this->Form->create('UserCards', ['id' => 'frmSignIn', 'type' => 'file', 'onsubmit' => 'return check();']); ?>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Flash->render(); ?>
<?php echo $this->Form->hidden('UserCards.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'userId', 'type' => 'text', 'placeholder' => 'USERNAME']); ?> <?php echo $this->Form->hidden('UserCards.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'userId', 'type' => 'text', 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->hidden('UserCards.organize_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_id', 'type' => 'text', 'label' => __('ไอดีใช้งาน'), 'placeholder' => 'USERNAME', 'required']); ?> <?php echo $this->Form->hidden('UserCards.organize_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_id', 'type' => 'text', 'label' => __('ไอดีใช้งาน'), 'placeholder' => 'USERNAME', 'required']); ?>
<?php echo $this->Form->input('UserCards.organize_code', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_code', 'type' => 'text', 'label' => __('Company Code'), 'placeholder' => 'Company Code', 'required']); ?> <?php echo $this->Form->input('UserCards.organize_code', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_code', 'type' => 'text', 'label' => __('Company Code'), 'placeholder' => 'Company Code', 'required']); ?>
......
...@@ -6,9 +6,8 @@ ...@@ -6,9 +6,8 @@
<!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;"> <!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;">
<strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong> <strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong>
</div>--> </div>-->
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changeForgotpassword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changeForgotpassword','role' => 'form', 'onsubmit' => 'return validateForm()']);?> <?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changeForgotpassword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changePressword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Flash->render(); ?> <?php echo $this->Flash->render(); ?>
</div>
<div> <div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
...@@ -63,27 +62,27 @@ ...@@ -63,27 +62,27 @@
function validateForm() { function validateForm() {
var password = document.forms["changeForgotpassword"]["password"].value; var password = document.forms["changePressword"]["password"].value;
if (password == null || password == "") { if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านใหม่"); alert("กรุณากรอก รหัสผ่านใหม่");
return false; return false;
} }
if(document.forms["changeForgotpassword"]["password"].value.length < 8) if(document.forms["changePressword"]["password"].value.length < 8)
{ {
alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร'); alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร');
return false; return false;
} }
var confirm_password = document.forms["changeForgotpassword"][["confirm_password"]].value; var confirm_password = document.forms["changePressword"][["confirm_password"]].value;
if (confirm_password == null || confirm_password == "") { if (confirm_password == null || confirm_password == "") {
alert("กรุณากรอก ยืนยันรหัสผ่าน"); alert("กรุณากรอก ยืนยันรหัสผ่าน");
return false; return false;
} }
if(document.forms["changeForgotpassword"]["confirm_password"].value.length < 8) if(document.forms["changePressword"]["confirm_password"].value.length < 8)
{ {
alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร'); alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร');
return false; return false;
} }
if(document.forms["changeForgotpassword"]["password"].value != document.forms["changeForgotpassword"]["confirm_password"].value){ if(document.forms["changePressword"]["password"].value != document.forms["changePressword"]["confirm_password"].value){
alert('กรุณาระบุรหัสผ่านให้ตรงกัน'); alert('กรุณาระบุรหัสผ่านให้ตรงกัน');
//document.createAccount.confirm_password.focus(); //document.createAccount.confirm_password.focus();
return false; return false;
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
<div> <div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('อีเมลล์');?><em>* </em></label> <label class="label-text-sub"><?php echo __('อีเมล');?><em>* </em></label>
<input type="text" value="" name="email" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from" id="fremail"> <input type="text" value="" name="email" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from" id="fremail">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -31,6 +31,18 @@ ...@@ -31,6 +31,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class=" row center">
<?php
echo $this->Html->link('ส่ง pin ใหม่อีกครั้ง', ['controller' => 'Users', 'action' => 'registersendpin/'.$token]);
?>
</div>
</div>
</div>
</div>
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
</div> </div>
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'pinCodepassword/'.$token], <?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'pinCodepassword/'.$token],
'id' => 'PinCode', 'name' => 'PinCode', 'role' => 'form']); 'id' => 'PinCode', 'name' => 'PinCode', 'role' => 'form']);
?> ?>
<?php echo $this->Flash->render(); ?> <div style="padding: 5px;">
<?php echo $this->Flash->render(); ?>
</div>
<div class="row"> <div class="row">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
...@@ -30,6 +32,17 @@ ...@@ -30,6 +32,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class=" row center">
<?php
echo $this->Html->link('ส่ง pin ใหม่อีกครั้ง', ['controller' => 'Users', 'action' => 'forgotsendpin/'.$token]);
?>
</div>
</div>
</div>
</div>
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
</div> </div>
......
...@@ -91,15 +91,15 @@ ...@@ -91,15 +91,15 @@
<div> <div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('เบอร์โทรศัพท์');?><em>* </em></label> <label class="label-text-sub"><?php echo __('เบอร์โทรศัพท์(มือถือ)');?><em>* </em></label>
<input type="text" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="12" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from"> <input type="text" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
</div> </div>
</div> </div>
</div> </div>
<div> <div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('อีเมลล์');?><em>* </em></label> <label class="label-text-sub"><?php echo __('อีเมล');?><em>* </em></label>
<input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from"> <input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from">
</div> </div>
...@@ -164,17 +164,6 @@ ...@@ -164,17 +164,6 @@
</div> </div>
</div> </div>
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script type="text/javascript">
$(function () {
$('#phone_no').inputmask('999-999-9999');
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
</script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
...@@ -230,7 +219,7 @@ ...@@ -230,7 +219,7 @@
// console.log(data); // console.log(data);
data = jQuery.parseJSON(data); data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){ if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว"); alert("อีเมลนี้มีในระบบแล้ว");
return false; return false;
} }
}); });
...@@ -316,7 +305,7 @@ function check_notnum() { ...@@ -316,7 +305,7 @@ function check_notnum() {
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน"); alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false; return false;
} }
if(document.getElementById("phone_no").value.length != 12) if(document.getElementById("phone_no").value.length != 10)
{ {
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก'); alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
return false; return false;
...@@ -324,13 +313,13 @@ function check_notnum() { ...@@ -324,13 +313,13 @@ function check_notnum() {
var email = document.getElementById("fremail").value; var email = document.getElementById("fremail").value;
if (email == null || email == "") { if (email == null || email == "") {
alert("กรุณากรอกอีเมลล์"); alert("กรุณากรอกอีเมล");
return false; return false;
} }
// Validate Email // Validate Email
var email = $("#fremail").val(); var email = $("#fremail").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else { if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลผิด กรุณากรอกให้ถูกต้อง");
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment