Commit 37037e64 by Teeradone-PIM

แก้ไขรูปตากดไม่แสดงpasswordและคำว่าอีเมล

parent f7e7521f
......@@ -411,18 +411,14 @@ class UsersController extends AppController {
if ($this->request->is('post')) {
$hasher = new DefaultPasswordHasher();
$password = $this->request->data['password'];
//$confirm_password = $this->request->data['confirm_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());
if($this->Users->save($users)){
$this->Flash->success(__('change password success'));
$this->Flash->success(__('You are now logout'));
$this->Users->save($users);
$this->Flash->success(__('You are now logged out.'));
return $this->redirect(['action' => 'signin']);
}
$this->Flash->error(__('Invalid password.'));
return $this->redirect(['action' => 'change_forgotpassword']);
}
$this->set(array('token' => $token, '_serialize' => array('token')));
}
......
......@@ -6,9 +6,8 @@
<!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;">
<strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong>
</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(); ?>
</div>
<div>
<div class="form-group has-feedback">
<div class="col-md-12">
......@@ -63,27 +62,27 @@
function validateForm() {
var password = document.forms["changeForgotpassword"]["password"].value;
var password = document.forms["changePressword"]["password"].value;
if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านใหม่");
return false;
}
if(document.forms["changeForgotpassword"]["password"].value.length < 8)
if(document.forms["changePressword"]["password"].value.length < 8)
{
alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร');
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 == "") {
alert("กรุณากรอก ยืนยันรหัสผ่าน");
return false;
}
if(document.forms["changeForgotpassword"]["confirm_password"].value.length < 8)
if(document.forms["changePressword"]["confirm_password"].value.length < 8)
{
alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร');
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('กรุณาระบุรหัสผ่านให้ตรงกัน');
//document.createAccount.confirm_password.focus();
return false;
......
......@@ -11,9 +11,8 @@
<div>
<div class="form-group has-feedback">
<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">
</div>
</div>
</div>
......
......@@ -99,7 +99,7 @@
<div>
<div class="form-group has-feedback">
<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">
</div>
......@@ -230,7 +230,7 @@
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว");
alert("อีเมลนี้มีในระบบแล้ว");
return false;
}
});
......@@ -324,13 +324,13 @@ function check_notnum() {
var email = document.getElementById("fremail").value;
if (email == null || email == "") {
alert("กรุณากรอกอีเมลล์");
alert("กรุณากรอกอีเมล");
return false;
}
// Validate Email
var email = $("#fremail").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
alert("รูปแบบที่อยู่อีเมลผิด กรุณากรอกให้ถูกต้อง");
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