Commit f7e7521f by Prasong Putichanchai

Merge branch 'integration' into prasong

# Conflicts:
#	www/src/Template/Users/signup.ctp
parents 3584bfa3 3cd64980
...@@ -336,7 +336,7 @@ class UsersController extends AppController { ...@@ -336,7 +336,7 @@ class UsersController extends AppController {
//pr($user_personals);die; //pr($user_personals);die;
$data_notification = []; $data_notification = [];
$data_notification['email'] = $this->request->data['email']; $data_notification['email'] = $this->request->data['email'];
$data_notification['pin_code'] = $users['pin_pass']; $data_notification['pin_code'] = $users['pin_pass'].'<br>'." Username: ".$users['username'];
$this->notification($data_notification); $this->notification($data_notification);
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
$this->Users->save($users); $this->Users->save($users);
...@@ -372,7 +372,7 @@ class UsersController extends AppController { ...@@ -372,7 +372,7 @@ class UsersController extends AppController {
$this->set(array('token' => $token, '_serialize' => array('token'))); $this->set(array('token' => $token, '_serialize' => array('token')));
} }
public function changePassword($token=null) public function changePassword()
{ {
$id = $this->Auth->user('id'); $id = $this->Auth->user('id');
...@@ -387,12 +387,9 @@ class UsersController extends AppController { ...@@ -387,12 +387,9 @@ class UsersController extends AppController {
$this->request->data['password'] = $hasher->hash($this->request->data['password']); $this->request->data['password'] = $hasher->hash($this->request->data['password']);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)--------------------------- //------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
if (password_verify($oldpassword, $users['password'])) { if (password_verify($oldpassword, $users['password'])) {
$users = $this->Users->patchEntity($users, $this->request->getData()); $users = $this->Users->patchEntity($users, $this->request->getData());
$this->Users->save($users); $this->Users->save($users);
$this->Flash->success(__('change password success'));
$this->Flash->success(__('You are now logged out.')); $this->Flash->success(__('You are now logged out.'));
return $this->redirect(['action' => 'signout']); return $this->redirect(['action' => 'signout']);
...@@ -401,7 +398,6 @@ class UsersController extends AppController { ...@@ -401,7 +398,6 @@ class UsersController extends AppController {
return $this->redirect(['action' => 'change-password']); return $this->redirect(['action' => 'change-password']);
} }
} }
$this->set(array('token' => $token, '_serialize' => array('token')));
} }
public function changeForgotpassword($token=null) public function changeForgotpassword($token=null)
...@@ -421,6 +417,7 @@ class UsersController extends AppController { ...@@ -421,6 +417,7 @@ class UsersController extends AppController {
$users = $this->Users->patchEntity($users, $this->request->getData()); $users = $this->Users->patchEntity($users, $this->request->getData());
if($this->Users->save($users)){ if($this->Users->save($users)){
$this->Flash->success(__('change password success')); $this->Flash->success(__('change password success'));
$this->Flash->success(__('You are now logout'));
return $this->redirect(['action' => 'signin']); return $this->redirect(['action' => 'signin']);
} }
$this->Flash->error(__('Invalid password.')); $this->Flash->error(__('Invalid password.'));
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
<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 __('รหัสผ่านใหม่');?></label> <label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label>
<input type="password" value="" name="password" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'> <input data-toggle="password" data-placement="before" onkeyup="check();" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<span class="glyphicon glyphicon-eye-open form-control-feedback"></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -22,8 +21,7 @@ ...@@ -22,8 +21,7 @@
<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 __('ยืนยันรหัสผ่าน');?></label> <label class="label-text-sub"><?php echo __('ยืนยันรหัสผ่าน');?></label>
<input type="password" value="" name="confirm_password" placeholder="********" class="form-control-reg border-bottom-from" id="confirm_password" onkeyup='check();'> <input data-toggle="password" data-placement="before" onkeyup="check();" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -44,6 +42,25 @@ ...@@ -44,6 +42,25 @@
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script> <script>
$("#password").on('change',function(){
var elem = document.getElementById('password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
$("#confirm_password").on('change',function(){
var elem = document.getElementById('confirm_password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
function validateForm() { function validateForm() {
var password = document.forms["changeForgotpassword"]["password"].value; var password = document.forms["changeForgotpassword"]["password"].value;
......
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
<!-- <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' => 'changePassword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changePressword','role' => 'form', 'onsubmit' => 'return validateForm()']);?> <?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changePassword/'],'class' => 'form-horizontal','id' => '','name' => 'changePressword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Flash->render(); ?> <?php echo $this->Flash->render(); ?>
<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 __('รหัสผ่านเก่า');?></label> <label class="label-text-sub"><?php echo __('รหัสผ่านเก่า');?></label>
<input type="password" value="" name="oldpassword" placeholder="********" class="form-control-reg border-bottom-from" id="oldpassword" onkeyup='check();'> <input data-toggle="password" data-placement="before" onkeyup="check();" type="password" name="oldpassword" id="oldpassword" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -21,8 +20,7 @@ ...@@ -21,8 +20,7 @@
<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 __('รหัสผ่านใหม่');?></label> <label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label>
<input type="password" value="" name="password" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'> <input data-toggle="password" data-placement="before" onkeyup="check();" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<span class="glyphicon glyphicon-eye-open form-control-feedback"></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -30,8 +28,7 @@ ...@@ -30,8 +28,7 @@
<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 __('ยืนยันรหัสผ่าน');?></label> <label class="label-text-sub"><?php echo __('ยืนยันรหัสผ่าน');?></label>
<input type="password" value="" name="confirm_password" placeholder="********" class="form-control-reg border-bottom-from" id="confirm_password" onkeyup='check();'> <input data-toggle="password" data-placement="before" onkeyup="check();" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -52,6 +49,34 @@ ...@@ -52,6 +49,34 @@
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script> <script>
$("#oldpassword").on('change',function(){
var elem = document.getElementById('oldpassword').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
$("#password").on('change',function(){
var elem = document.getElementById('password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
$("#confirm_password").on('change',function(){
var elem = document.getElementById('confirm_password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
function validateForm() { function validateForm() {
var password = document.forms["changePressword"]["oldpassword"].value; var password = document.forms["changePressword"]["oldpassword"].value;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<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="firstname" id="firstname" value="" onkeypress="check_notnum();" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from"> <input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<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="lastname" id="lastname" value="" onkeypress="check_notnum();" placeholder="LASTNAME" class="form-control-reg border-bottom-from"> <input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<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="username" id="username" value="" onkeypress="checkeng();" placeholder="USERNAME" class="form-control-reg border-bottom-from"> <input type="text" name="username" id="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<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 data-toggle="password" data-placement="before" onkeypress="checkeng();" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>-->
</div> </div>
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
<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 data-toggle="password" data-placement="before" onkeypress="checkeng();" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>-->
<span id='message'></span> <span id='message'></span>
...@@ -176,38 +176,58 @@ ...@@ -176,38 +176,58 @@
}); });
</script> </script>
<script> <script>
// function check_key() {
// e_k=event.keyCode
// alert( 'asdasd')
// if ((k>=65 && k<=90) || (k>=97 && k<=122)){
// return true;
// }else{
// alert("thai");
// return false;
// }
// }
$(document).ready(function() { $(document).ready(function() {
// $("#username").on('keyup',function(){ $("#username").on('change',function(){
// var $this = $(this); var elem = document.getElementById('username').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาไทยหรือภาษาอังกฤษให้ถูกต้อง");
return false;
}
})
// if($this.val().length>=4){ $("#firstname").on('change',function(){
var elem = document.getElementById('firstname').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
// alert(check_key()); $("#lastname").on('change',function(){
// }else{ var elem = document.getElementById('lastname').value;
// //alert("กรุณากรอกชื่อผู้ใช้งานของท่าน"); // console.log(elem);
// // return false; if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
// } alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
// }); $("#password").on('change',function(){
var elem = document.getElementById('password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
$("#confirm_password").on('change',function(){
var elem = document.getElementById('confirm_password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น");
return false;
}
})
$("#fremail").on('change',function(){ $("#fremail").on('change',function(){
var email = document.getElementById("fremail").value; var email = document.getElementById("fremail").value;
$.post("/Checkemails/checkemail", {email: email}, function(data) { $.post("/Checkemails/checkemail", {email: email}, function(data) {
console.log(data); // console.log(data);
data = jQuery.parseJSON(data); data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){ if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว"); alert("อีเมลล์นี้มีในระบบแล้ว");
...@@ -217,9 +237,10 @@ ...@@ -217,9 +237,10 @@
}); });
}); });
function check_phone() { function check_phone() {
e_k=event.keyCode e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) { // if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k = 10 && (e_k < 48) || (e_k > 57)) { if (e_k = 10 && (e_k < 48) || (e_k > 59)) {
event.returnValue = false; event.returnValue = false;
alert("กรุณาใส่ข้อมูลที่หมายเลขโทรศัพท์ เป็นตัวเลขเท่านั้น"); alert("กรุณาใส่ข้อมูลที่หมายเลขโทรศัพท์ เป็นตัวเลขเท่านั้น");
} }
...@@ -312,19 +333,6 @@ function check_notnum() { ...@@ -312,19 +333,6 @@ function check_notnum() {
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
return false; return false;
} }
// var email = document.getElementById("fremail").value;
// $.post("/Checkemails/checkemailregister", {email: email}, function(data) {
// data = jQuery.parseJSON(data);
// if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีในระบบแล้ว");
// return false;
// } else {
// alert("ssss");
// return true;
// }
// });
var password = document.getElementById("password").value; var password = document.getElementById("password").value;
if (password == null || password == "") { if (password == null || password == "") {
...@@ -348,6 +356,11 @@ function check_notnum() { ...@@ -348,6 +356,11 @@ function check_notnum() {
return false; return false;
} }
if($("#accept:checked").length==0){
alert("กรุณายอมรับ เงื่อนไขการใช้งาน");
return false;
}
$("body").delegate(".is_active", "click", function () { $("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false); $('.is_active').not(this).prop('checked', false);
return true; return true;
......
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