Commit e9e87d00 by Teeradone-PIM

teeradone eye icon

parent df16edbc
...@@ -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>
......
...@@ -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>
......
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