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
6648f3eb
authored
May 17, 2018
by
Teeradone-PIM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teeradone: users
parent
bf301f15
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
293 deletions
+186
-293
www/src/Controller/UsersController.php
+128
-74
www/src/Template/Users/change_password.ctp
+39
-86
www/src/Template/Users/forgot_password.ctp
+3
-93
www/src/Template/Users/pin_code.ctp
+1
-1
www/src/Template/Users/signup.ctp
+15
-39
No files found.
www/src/Controller/UsersController.php
View file @
6648f3eb
...
@@ -8,6 +8,7 @@ use Cake\Routing\Router;
...
@@ -8,6 +8,7 @@ use Cake\Routing\Router;
use
Cake\I18n\Time
;
use
Cake\I18n\Time
;
use
Cake\Mailer\Email
;
use
Cake\Mailer\Email
;
use
Cake\Utility\Security
;
use
Cake\Utility\Security
;
use
Cake\Auth\AbstractPasswordHasher
;
class
UsersController
extends
AppController
class
UsersController
extends
AppController
{
{
...
@@ -94,7 +95,7 @@ class UsersController extends AppController
...
@@ -94,7 +95,7 @@ class UsersController extends AppController
$countries
=
$this
->
MasterCountries
->
find
(
'list'
,
$countries
=
$this
->
MasterCountries
->
find
(
'list'
,
[
[
'conditions'
=>
[
'is_used'
=>
true
,
'id'
=>
1
],
'conditions'
=>
[
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'keyField'
=>
'id'
,
'valueField'
=>
[
'country_name_th'
]
'valueField'
=>
[
'country_name_th'
]
]
]
...
@@ -103,7 +104,7 @@ class UsersController extends AppController
...
@@ -103,7 +104,7 @@ class UsersController extends AppController
$provinces
=
$this
->
MasterProvinces
->
find
(
'list'
,
$provinces
=
$this
->
MasterProvinces
->
find
(
'list'
,
[
[
'conditions'
=>
[
'is_used'
=>
true
,
'master_country_id'
=>
1
],
'conditions'
=>
[
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'keyField'
=>
'id'
,
'valueField'
=>
'province_name_th'
'valueField'
=>
'province_name_th'
]
]
...
@@ -217,7 +218,7 @@ class UsersController extends AppController
...
@@ -217,7 +218,7 @@ class UsersController extends AppController
$user_personals
=
$this
->
UserPersonals
->
patchEntity
(
$user_personals
,
$this
->
request
->
getData
());
$user_personals
=
$this
->
UserPersonals
->
patchEntity
(
$user_personals
,
$this
->
request
->
getData
());
$this
->
UserPersonals
->
save
(
$user_personals
);
$this
->
UserPersonals
->
save
(
$user_personals
);
$this
->
Flash
->
success
(
__
(
'The register success.'
));
//
$this->Flash->success(__('The register success.'));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'pinCode/'
.
$users
[
'token'
]]);
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'pinCode/'
.
$users
[
'token'
]]);
return
$this
->
redirect
([
'action'
=>
'signin'
]);
return
$this
->
redirect
([
'action'
=>
'signin'
]);
}
}
...
@@ -317,94 +318,123 @@ class UsersController extends AppController
...
@@ -317,94 +318,123 @@ class UsersController extends AppController
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
#Forgot Password
#Forgot Password
public
function
forgotPassword
()
// public function forgotPassword()
{
// {
$this
->
viewBuilder
()
->
layout
(
'blank'
);
// $this->viewBuilder()->layout('blank');
$data
=
$this
->
request
->
data
();
#$data['data']['ip'] = $this->request->clientIp();
if
(
!
empty
(
$data
)){
if
(
!
empty
(
$data
[
'data'
][
'username'
])){
$data
[
'data'
][
'ip'
]
=
$this
->
request
->
clientIp
();
#prr($data);
$api_core_forgotPassword
=
Configure
::
read
(
'Config.apiCore.forgotPassword'
);
// $data = $this->request->data();
$http
=
new
Client
();
// #$data['data']['ip'] = $this->request->clientIp();
$response
=
$http
->
post
(
$api_core_forgotPassword
,
$data
[
'data'
])
->
body
();
$response
=
json_decode
(
$response
,
'_full'
);
#debug($response);
// if(!empty($data)){
// if(!empty($data['data']['username'])){
// $data['data']['ip'] = $this->request->clientIp();#prr($data);
// $api_core_forgotPassword = Configure::read('Config.apiCore.forgotPassword');
// $http = new Client();
// $response = $http->post($api_core_forgotPassword,$data['data'])->body();
// $response = json_decode($response,'_full');#debug($response);
// if(!empty($response)){
// if(trim($response['status']) == 'Success'){
// $this->Flash->success(__('Completed.'));
// return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// }else{
// $this->Flash->error(__('Forgot Password Fail'));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
// }
// }else{
// $this->Flash->error(__('Forgot Password Fail'));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
// }
if
(
!
empty
(
$response
)){
// }else{
if
(
trim
(
$response
[
'status'
])
==
'Success'
){
// $this->Flash->error(__('Data Empty'));
$this
->
Flash
->
success
(
__
(
'Completed.'
));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signin'
]);
// }
}
else
{
// }
$this
->
Flash
->
error
(
__
(
'Forgot Password Fail'
));
// }
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'forgotPassword'
]);
}
}
else
{
$this
->
Flash
->
error
(
__
(
'Forgot Password Fail'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'forgotPassword'
]);
}
public
function
forgotPassword
()
{
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$this
->
loadModel
(
'UserPersonals'
);
if
(
$this
->
request
->
is
(
'post'
))
{
$hasher
=
new
DefaultPasswordHasher
();
$email
=
$this
->
request
->
data
[
'email'
];
//-------------------Random---------------------------------------------------------------
$alphabet
=
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
;
$pass
=
array
();
$alphaLength
=
strlen
(
$alphabet
)
-
1
;
for
(
$i
=
0
;
$i
<
8
;
$i
++
)
{
$n
=
rand
(
0
,
$alphaLength
);
$pass
[]
=
$alphabet
[
$n
];
}
$password
=
implode
(
$pass
);
//------------------------------------------------------------------------------------------
$users
[
'password'
]
=
$hasher
->
hash
(
$password
);
$user_personals
=
$this
->
UserPersonals
->
find
(
'all'
,[
'conditions'
=>
[
'UserPersonals.email'
=>
$email
]
])
->
first
();
pr
(
$password
);
if
(
!
empty
(
$user_personals
)){
//--------------------ตัวส่ง Email ---------------------------------------------------------
// pr($user_personals);die;
// $data_notification = [];
// $data_notification['email'] = $this->request->data['email'];
// $data_notification['pin_code'] = $password;
// $this->notification($data_notification);
//----------------------------------------------------------------------------------------
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
'Users.id'
=>
$user_personals
[
'user_id'
]
]
])
->
first
();
pr
(
$users
);
die
;
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
$this
->
Users
->
save
(
$users
);
$this
->
Flash
->
success
(
__
(
'send password to email success'
));
return
$this
->
redirect
([
'action'
=>
'signin'
]);
}
else
{
}
else
{
$this
->
Flash
->
error
(
__
(
'Data Empty
'
));
$this
->
Flash
->
error
(
__
(
'Invalid Email.
'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'forgotPassword'
]);
return
$this
->
redirect
([
'action'
=>
'forgot-password'
]);
}
}
}
}
}
}
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
#Change Password
public
function
changePassword
()
public
function
changePassword
()
{
{
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$this
->
viewBuilder
()
->
layout
(
'blank'
);
if
(
$this
->
request
->
is
(
'post'
))
{
$data
=
$this
->
request
->
data
();
#debug($data);exit();
$hasher
=
new
DefaultPasswordHasher
();
// pr($data);die;
$password
=
$this
->
request
->
data
[
'password'
];
// pr($this->validateAccount($data));die;
$confirm_password
=
$this
->
request
->
data
[
'confirm_password'
];
if
(
!
empty
(
$data
)){
$oldpassword
=
$this
->
request
->
data
[
'oldpassword'
];
// pr($data);die;
$this
->
request
->
data
[
'password'
]
=
$hasher
->
hash
(
$this
->
request
->
data
[
'password'
]);
if
(
$this
->
validateAccount
(
$data
)){
$userid
=
59445
;
$data
[
'data'
][
'ip'
]
=
$this
->
request
->
clientIp
();
#debug($data);exit();
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
// pr($data);die;
'Users.id'
=>
$userid
$api_core_change_password
=
Configure
::
read
(
'Config.apiCore.changePassword'
);
#debug($api_core_change_password);exit();
]
$http
=
new
Client
();
])
->
first
();
// pr($http);die;
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
#$response = json_decode($http->post($api_core_change_password,$data)->body(),'_full');
if
(
password_verify
(
$oldpassword
,
$users
[
'password'
]))
{
$response
=
$http
->
post
(
$api_core_change_password
,
$data
)
->
body
();
if
(
$password
==
$confirm_password
){
// pr($data);die;
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
#debug($response);exit();
$this
->
Users
->
save
(
$users
);
$response
=
json_decode
(
$response
,
'_full'
);
$this
->
Flash
->
success
(
__
(
'change password success'
));
// pr($response);die;
return
$this
->
redirect
([
'action'
=>
'signin'
]);
#debug($response);exit();
if
(
!
empty
(
$response
)){
// pr($response);die;
#if(trim($response['status']) == 'Success' && !empty($response['result']['type'])){
if
(
trim
(
$response
[
'status'
])
==
'Success'
){
#$this->response->withHeader('Authorization', 'Bearer '.$response['result']['token']);
#$url = $this->Url->build(['controller' => 'Homes', 'action' => 'index'], true);
$url
=
Router
::
url
([
'controller'
=>
'Users'
,
'action'
=>
'signup'
],
true
);
#echo "<script>Login.onLogin('".$response['result']['token']."','".$url."');</script>";die;
$this
->
Flash
->
success
(
__
(
'change Password completed.'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signin'
]);
}
else
{
$this
->
Flash
->
error
(
__
(
'change Password Fail'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signup'
]);
}
}
}
}
else
{
}
else
{
$this
->
Flash
->
error
(
__
(
'Invalid password.'
));
$this
->
Flash
->
error
(
__
(
'Data Empty'
));
return
$this
->
redirect
([
'action'
=>
'change-password'
]);
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signin'
]);
}
}
}
}
}
}
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
public
function
signout
()
public
function
signout
()
...
@@ -413,4 +443,28 @@ class UsersController extends AppController
...
@@ -413,4 +443,28 @@ class UsersController extends AppController
}
}
public
function
getProvince
()
{
$this
->
autoRender
=
false
;
$this
->
loadModel
(
'MasterProvinces'
);
$states
=
array
();
$id
=
$this
->
request
->
data
(
'id'
);
$states
=
$this
->
MasterProvinces
->
find
(
'list'
,
array
(
'keyField'
=>
'id'
,
'valueField'
=>
'province_name_th'
,
'conditions'
=>
array
(
'master_country_id'
=>
$id
)
))
->
toArray
();
$arr
=
array
();
if
(
!
empty
(
$states
)){
echo
'<option value=""> ---Select--- </option>'
;
foreach
(
$states
as
$key
=>
$val
){
echo
'<option value="'
.
$key
.
'">'
.
$val
.
'</option>'
;
}
}
else
{
return
false
;
}
}
}
}
www/src/Template/Users/change_password.ctp
View file @
6648f3eb
<div class="row">
<div class="row">
<div class="center">
<div class="center">
<div class="title_header" style="padding-top: 20px;"><a href="javascript:history.go(-1)"><?php echo $this->Html->image('/img/core/img/back-icon@3x.png', ['style' => 'float: left;padding-left: 15px;padding-top: 5px;']); ?></a><?php echo __('
สร้าง
รหัสผ่าน');?></div>
<div class="title_header" style="padding-top: 20px;"><a href="javascript:history.go(-1)"><?php echo $this->Html->image('/img/core/img/back-icon@3x.png', ['style' => 'float: left;padding-left: 15px;padding-top: 5px;']); ?></a><?php echo __('
เปลี่ยน
รหัสผ่าน');?></div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<!-- <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;">
...
@@ -8,20 +8,21 @@
...
@@ -8,20 +8,21 @@
</div>-->
</div>-->
<?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->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="text" value="" name="data[confirm_email]" maxlength="4" pattern="\d{4}" placeholder="********" class="form-control-reg border-bottom-from" id="inputSuccess">
<input type="password" value="" name="oldpassword" placeholder="********" class="form-control-reg border-bottom-from" id="oldpassword" onkeyup='check();'>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>
</div>
</div>
</div>
</div>
</div>
</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">
<label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label>
<label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label>
<input type="text" value="" name="
data[password]
" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'>
<input type="text" value="" name="
password
" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'>
<span class="glyphicon glyphicon-eye-open form-control-feedback"></span>
<span class="glyphicon glyphicon-eye-open form-control-feedback"></span>
</div>
</div>
</div>
</div>
...
@@ -30,7 +31,7 @@
...
@@ -30,7 +31,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="
data[confirm_password]
" placeholder="********" class="form-control-reg border-bottom-from" id="confirm_password" onkeyup='check();'>
<input type="password" value="" name="
confirm_password
" placeholder="********" class="form-control-reg border-bottom-from" id="confirm_password" 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>
</div>
</div>
</div>
</div>
...
@@ -51,24 +52,46 @@
...
@@ -51,24 +52,46 @@
</div>
</div>
<!--
------------------------------- popup -----------------------------------
-->
<!--
------------------------------- popup -----------------------------------
-->
<script>
<script>
function validateForm() {
function validateForm() {
var confirm_email = document.forms["changePressword"]["data[confirm_email]"].value;
if (confirm_email == null || confirm_email == "") {
var password = document.forms["changePressword"]["oldpassword"].value;
alert("กรุณากรอกรหัสจากอีเมลล์ของท่าน 4 หลัก");
if (password == null || password == "") {
alert("กรุณากรอก รหัสผ่านเก่า");
return false;
return false;
}
}
var password = document.forms["changePressword"]["data[password]"].value;
if(document.forms["changePressword"]["oldpassword"].value.length < 8)
{
alert('กรุณาระบุรหัสผ่านเก่าอย่างน้อย 8 ตัวอักษร');
return false;
}
var password = document.forms["changePressword"]["password"].value;
if (password == null || password == "") {
if (password == null || password == "") {
alert("กรุณากรอก password");
alert("กรุณากรอก รหัสผ่านใหม่");
return false;
}
if(document.forms["changePressword"]["password"].value.length < 8)
{
alert('กรุณาระบุรหัสผ่านใหม่อย่างน้อย 8 ตัวอักษร');
return false;
return false;
}
}
var confirm_password = document.forms["changePressword"][
"data[confirm_password]"
].value;
var confirm_password = document.forms["changePressword"][
["confirm_password"]
].value;
if (confirm_password == null || confirm_password == "") {
if (confirm_password == null || confirm_password == "") {
alert("กรุณากรอก confirm_password");
alert("กรุณากรอก ยืนยันรหัสผ่าน");
return false;
}
if(document.forms["changePressword"]["confirm_password"].value.length < 8)
{
alert('กรุณาระบุยืนยันรหัสผ่านอย่างน้อย 8 ตัวอักษร');
return false;
}
if(document.forms["changePressword"]["password"].value != document.forms["changePressword"]["confirm_password"].value){
alert('กรุณาระบุรหัสผ่านให้ตรงกัน');
//document.createAccount.confirm_password.focus();
return false;
return false;
}
}
}
}
</script>
</script>
<style>
<style>
...
@@ -177,72 +200,3 @@
...
@@ -177,72 +200,3 @@
color:green;
color:green;
}
}
</style>
</style>
<script>
var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok";
if (document.getElementById) {
window.alert = function (txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
d = document;
if (d.getElementById("modalContainer"))
return;
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
mObj.style.height = d.documentElement.scrollHeight + "px";
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
if (d.all && !window.opera)
alertObj.style.top = document.documentElement.scrollTop + "px";
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth) / 2 + "px";
alertObj.style.visiblity = "visible";
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
msg = alertObj.appendChild(d.createElement("p"));
//msg.appendChild(d.createTextNode(txt));
msg.innerHTML = txt;
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
btn.focus();
btn.onclick = function () {
removeCustomAlert();
return false;
}
alertObj.style.display = "block";
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function ful() {
alert('Alert this pages');
}
</script>
<!--------------------------------- confirm password -------------------------------->
<script>
var check = function() {
if (document.getElementById('password').value ==
document.getElementById('confirm_password').value) {
document.getElementById('message').style.color = 'green';
document.getElementById('message').innerHTML = '';
} else {
document.getElementById('message').style.color = 'red';
document.getElementById('message').innerHTML = '';
}
}
</script>
\ No newline at end of file
www/src/Template/Users/forgot_password.ctp
View file @
6648f3eb
...
@@ -11,27 +11,8 @@
...
@@ -11,27 +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>
<input type="text" value="" name="data[username]" placeholder="USERNAME" class="form-control-reg border-bottom-from" id="inputSuccess">
</div>
</div>
</div>
<div>
<div class="form-group has-feedback">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('วันเกิด');?><em>* </em></label>
<input type="text" value="" name="data[birthdate]" placeholder="กรุณาระบุวันเดือนปีเกิด" class="form-control-reg border-bottom-from" id="date">
<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div>
</div>
</div>
<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="
data[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>
...
@@ -49,26 +30,10 @@
...
@@ -49,26 +30,10 @@
<?php echo $this->Form->end(); ?>
<?php echo $this->Form->end(); ?>
</div>
</div>
</div>
</div>
<!--
------------------------------- popup -----------------------------------
-->
<!--
------------------------------- popup -----------------------------------
-->
<script>
<script>
function validateForm() {
function validateForm() {
var username = document.forms["forgotPressword"]["data[username]"].value;
var email = document.forms["forgotPressword"]["email"].value;
if (username == null || username == "") {
alert("กรุณากรอกชื่อผู้ใช้งานของท่าน");
return false;
}
if(document.forms["forgotPressword"]["data[username]"].value.length < 5)
{
alert('กรุณาระบุชื่อผู้ใช้งานอย่างน้อย 5 ตัวอักษร');
return false;
}
var birthdate = document.forms["forgotPressword"]["data[birthdate]"].value;
if (birthdate == null || birthdate == "") {
alert("กรุณากรอก วันเดือนปีเกิดของท่าน");
return false;
}
var email = document.forms["forgotPressword"]["data[email]"].value;
if (email == null || email == "") {
if (email == null || email == "") {
alert("กรุณากรอกอีเมลล์");
alert("กรุณากรอกอีเมลล์");
return false;
return false;
...
@@ -188,61 +153,6 @@
...
@@ -188,61 +153,6 @@
}
}
</style>
</style>
<script>
var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok";
if (document.getElementById) {
window.alert = function (txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
d = document;
if (d.getElementById("modalContainer"))
return;
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
mObj.style.height = d.documentElement.scrollHeight + "px";
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
if (d.all && !window.opera)
alertObj.style.top = document.documentElement.scrollTop + "px";
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth) / 2 + "px";
alertObj.style.visiblity = "visible";
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
msg = alertObj.appendChild(d.createElement("p"));
//msg.appendChild(d.createTextNode(txt));
msg.innerHTML = txt;
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
btn.focus();
btn.onclick = function () {
removeCustomAlert();
return false;
}
alertObj.style.display = "block";
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function ful() {
alert('Alert this pages');
}
</script>
<!--------------------------------- date ------------------------------------->
<!--------------------------------- date ------------------------------------->
<script>
<script>
$(document).ready(function(){
$(document).ready(function(){
...
...
www/src/Template/Users/pin_code.ctp
View file @
6648f3eb
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<div class=" row center">
<div class=" row center">
<?php echo __('รหัส PIN 4 หลัก
เพื่อเข้าใช้งาน Connect App
');?>
<?php echo __('รหัส PIN 4 หลัก
ในอีเมลล์ที่ระบุเพื่อเข้าใช้งาน
');?>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
www/src/Template/Users/signup.ctp
View file @
6648f3eb
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,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 __('เบอร์โทรศัพท์');?></label>
<label class="label-text-sub"><?php echo __('เบอร์โทรศัพท์');?><
em>* </em><
/label>
<input type="text" name="phone_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="0000000000" class="mask form-control-reg border-bottom-from" id="inputSuccess">
<input type="text" name="phone_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="0000000000" class="mask form-control-reg border-bottom-from" id="inputSuccess">
</div>
</div>
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,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 __('รหัสผ่าน');?></label>
<label class="label-text-sub"><?php echo __('รหัสผ่าน');?><
em>* </em><
/label>
<input data-toggle="password" data-placement="before" type="password" name="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" id="FALSE" style="padding:0px 0px !important;">
<input data-toggle="password" data-placement="before" type="password" name="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" id="FALSE" 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>-->
...
@@ -190,11 +190,11 @@
...
@@ -190,11 +190,11 @@
var birthdate = document.forms["createAccount"]["birthdate"].value;
//
var birthdate = document.forms["createAccount"]["birthdate"].value;
if (birthdate == null || birthdate == "") {
//
if (birthdate == null || birthdate == "") {
alert("กรุณากรอก วันเดือนปีเกิดของท่าน");
//
alert("กรุณากรอก วันเดือนปีเกิดของท่าน");
return false;
//
return false;
}
//
}
// var person_card_no = document.forms["createAccount"]["person_card_no"].value;
// var person_card_no = document.forms["createAccount"]["person_card_no"].value;
// if (person_card_no == null || person_card_no == "") {
// if (person_card_no == null || person_card_no == "") {
// alert("กรุณากรอกเลขบัตรประชาชน");
// alert("กรุณากรอกเลขบัตรประชาชน");
...
@@ -431,53 +431,29 @@
...
@@ -431,53 +431,29 @@
</script>
</script>
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function() {
$(document).ready(function () {
$(document).ready(function() {
$("#master_country_id").on('change', function () {
$("#loding1").hide();
$("#loding2").hide();
$("#master_country_id").on('change',function() {
var id = $(this).val();
var id = $(this).val();
$("#loding1").show();
$("#master_province_id").find('option').remove();
// alert('dddd');
if (id) {
if (id) {
var dataString = 'id='
+ id;
var dataString = 'id='
+ id;
$.ajax({
$.ajax({
type: "POST",
type: "POST",
url: 'users/getStates'
,
url: '/users/getProvince'
,
data: dataString,
data: dataString,
cache: false,
cache: false,
success: function(html) {
success: function (html) {
$("#loding1").hide();
$("#master_province_id").html(html);
$.each(html, function(key, value) {
$('<option>').val('').text('---Select---');
$('<option>').val(key).text(value).appendTo($("#master_province_id"));
});
}
}
});
});
}
}
});
});
});
});
});
</script>
</script>
<!--------------------------------- confirm password ------------------------------ -->
<!--------------------------------- confirm password ------------------------------ -->
<script>
<script>
function check_number() {
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k = 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ขออภัยหมายเลขบัตรประจำตัวประชาชน ต้องเป็นตัวเลขเท่านั้น");
}
}
function check_phone() {
function check_phone() {
e_k=event.keyCode
e_k=event.keyCode
...
...
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