Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
smart_core_connect
/
core-connect
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8f72160e
authored
May 24, 2018
by
Teeradone-PIM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teeradone: change password
parent
03600516
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
36 deletions
+26
-36
www/src/Controller/UsersController.php
+0
-7
www/src/Template/Users/change_password.ctp
+0
-18
www/src/Template/Users/signup.ctp
+26
-11
No files found.
www/src/Controller/UsersController.php
View file @
8f72160e
...
...
@@ -399,22 +399,15 @@ class UsersController extends AppController {
]
])
->
first
();
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
(
__
(
'change password success'
));
return
$this
->
redirect
([
'action'
=>
'signin'
]);
}
else
{
$this
->
Flash
->
error
(
__
(
'Invalid password.'
));
return
$this
->
redirect
([
'action'
=>
'change-password/'
.
$token
]);
}
}
$this
->
set
(
array
(
'token'
=>
$token
,
'_serialize'
=>
array
(
'token'
)));
}
...
...
www/src/Template/Users/change_password.ctp
View file @
8f72160e
...
...
@@ -8,14 +8,6 @@
</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->Flash->render(); ?>
<div>
<div class="form-group has-feedback">
<div class="col-md-12">
<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();'>
<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>
</div>
</div>
</div>
<div>
<div class="form-group has-feedback">
...
...
@@ -54,16 +46,6 @@
<script>
function validateForm() {
var password = document.forms["changePressword"]["oldpassword"].value;
if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านเก่า");
return false;
}
if(document.forms["changePressword"]["oldpassword"].value.length < 8)
{
alert('กรุณาระบุรหัสผ่านเก่าอย่างน้อย 8 ตัวอักษร');
return false;
}
var password = document.forms["changePressword"]["password"].value;
if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านใหม่");
...
...
www/src/Template/Users/signup.ctp
View file @
8f72160e
...
...
@@ -11,7 +11,7 @@
<div class="form-group has-feedback">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('ชื่อ');?><em>* </em></label>
<input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from">
<input type="text" name="firstname" id="firstname" value=""
onkeypress="check_notnum();"
placeholder="FIRSTNAME" class="form-control-reg border-bottom-from">
</div>
</div>
...
...
@@ -20,7 +20,7 @@
<div class="form-group has-feedback">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('นามสกุล');?><em>* </em></label>
<input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from">
<input type="text" name="lastname" id="lastname" value=""
onkeypress="check_notnum();"
placeholder="LASTNAME" class="form-control-reg border-bottom-from">
</div>
</div>
...
...
@@ -29,7 +29,7 @@
<div class="form-group has-feedback">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('ชื่อผู้ใช้งาน');?><em>* </em></label>
<input type="text" name="username" id="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from">
<input type="text" name="username" id="username" value=""
onkeypress="check_notnum();"
placeholder="USERNAME" class="form-control-reg border-bottom-from">
</div>
</div>
...
...
@@ -190,6 +190,21 @@
});
});
});
function check_phone() {
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k = 10 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ขออภัยหมายเลขโทรศัพท์ ต้องเป็นตัวเลขเท่านั้น");
}
}
function check_notnum() {
e_k=event.keyCode
if ((e_k== 13 || e_k== 110) && (e_k > 48) || (e_k< 57)) {
event.returnValue = false;
alert("ข้อมูลผิดพลาด กรุณาใส่ข้อมูลที่เป็นตัวอักษรภาษาไทย [ก-ฮ] หรือภาษาอังกฤษให้ถูกต้อง");
}
}
function validateForm() {
var firstname = document.getElementById("firstname").value;
...
...
@@ -489,14 +504,14 @@
<script>
function check_phone() {
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k = 10 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ขออภัยหมายเลขโทรศัพท์ ต้องเป็นตัวเลขเท่านั้น");
}
}
//
function check_phone() {
//
e_k=event.keyCode
//
//
if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
//
if (e_k = 10 && (e_k < 48) || (e_k > 57)) {
//
event.returnValue = false;
//
alert("ขออภัยหมายเลขโทรศัพท์ ต้องเป็นตัวเลขเท่านั้น");
//
}
//
}
/*var check = function() {
if (document.getElementById('password').value ==
document.getElementById('confirm_password').value) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment