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
62526bbc
authored
May 30, 2018
by
Teeradone-PIM
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'teeradone' into integration
parents
c818f456
37037e64
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
20 deletions
+14
-20
www/src/Controller/UsersController.php
+3
-7
www/src/Template/Users/change_forgotpassword.ctp
+6
-7
www/src/Template/Users/forgot_password.ctp
+1
-2
www/src/Template/Users/signup.ctp
+4
-4
No files found.
www/src/Controller/UsersController.php
View file @
62526bbc
...
@@ -411,18 +411,14 @@ class UsersController extends AppController {
...
@@ -411,18 +411,14 @@ class UsersController extends AppController {
if
(
$this
->
request
->
is
(
'post'
))
{
if
(
$this
->
request
->
is
(
'post'
))
{
$hasher
=
new
DefaultPasswordHasher
();
$hasher
=
new
DefaultPasswordHasher
();
$password
=
$this
->
request
->
data
[
'password'
];
$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'
]);
$this
->
request
->
data
[
'password'
]
=
$hasher
->
hash
(
$this
->
request
->
data
[
'password'
]);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
if
(
$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 logout'
));
return
$this
->
redirect
([
'action'
=>
'signin'
]);
return
$this
->
redirect
([
'action'
=>
'signin'
]);
}
}
$this
->
Flash
->
error
(
__
(
'Invalid password.'
));
return
$this
->
redirect
([
'action'
=>
'change_forgotpassword'
]);
}
$this
->
set
(
array
(
'token'
=>
$token
,
'_serialize'
=>
array
(
'token'
)));
$this
->
set
(
array
(
'token'
=>
$token
,
'_serialize'
=>
array
(
'token'
)));
}
}
...
...
www/src/Template/Users/change_forgotpassword.ctp
View file @
62526bbc
...
@@ -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' => 'change
Forgotpa
ssword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changeForgotpassword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'change
Pre
ssword','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["change
Forgotpa
ssword"]["password"].value;
var password = document.forms["change
Pre
ssword"]["password"].value;
if (password == null || password == "") {
if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านใหม่");
alert("กรุณากรอก รหัสผ่านใหม่");
return false;
return false;
}
}
if(document.forms["change
Forgotpa
ssword"]["password"].value.length < 8)
if(document.forms["change
Pre
ssword"]["password"].value.length < 8)
{
{
alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร');
alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร');
return false;
return false;
}
}
var confirm_password = document.forms["change
Forgotpa
ssword"][["confirm_password"]].value;
var confirm_password = document.forms["change
Pre
ssword"][["confirm_password"]].value;
if (confirm_password == null || confirm_password == "") {
if (confirm_password == null || confirm_password == "") {
alert("กรุณากรอก ยืนยันรหัสผ่าน");
alert("กรุณากรอก ยืนยันรหัสผ่าน");
return false;
return false;
}
}
if(document.forms["change
Forgotpa
ssword"]["confirm_password"].value.length < 8)
if(document.forms["change
Pre
ssword"]["confirm_password"].value.length < 8)
{
{
alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร');
alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร');
return false;
return false;
}
}
if(document.forms["change
Forgotpassword"]["password"].value != document.forms["changeForgotpa
ssword"]["confirm_password"].value){
if(document.forms["change
Pressword"]["password"].value != document.forms["changePre
ssword"]["confirm_password"].value){
alert('กรุณาระบุรหัสผ่านให้ตรงกัน');
alert('กรุณาระบุรหัสผ่านให้ตรงกัน');
//document.createAccount.confirm_password.focus();
//document.createAccount.confirm_password.focus();
return false;
return false;
...
...
www/src/Template/Users/forgot_password.ctp
View file @
62526bbc
...
@@ -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>
...
...
www/src/Template/Users/signup.ctp
View file @
62526bbc
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
<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>
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,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;
}
}
});
});
...
@@ -324,13 +324,13 @@ function check_notnum() {
...
@@ -324,13 +324,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;
}
}
...
...
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