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
fe787816
authored
May 30, 2018
by
Teeradone-PIM
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'teeradone' into integration
parents
f0730d60
7a1d7643
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
15 deletions
+88
-15
www/src/Controller/UsersController.php
+60
-1
www/src/Template/Users/pin_code.ctp
+12
-0
www/src/Template/Users/pin_codepassword.ctp
+13
-0
www/src/Template/Users/signup.ctp
+3
-14
No files found.
www/src/Controller/UsersController.php
View file @
fe787816
...
@@ -18,7 +18,7 @@ class UsersController extends AppController {
...
@@ -18,7 +18,7 @@ class UsersController extends AppController {
*/
*/
public
function
initialize
()
{
public
function
initialize
()
{
parent
::
initialize
();
parent
::
initialize
();
$this
->
Auth
->
allow
([
'signin'
,
'signout'
,
'signup'
,
'verify'
,
'forgotPassword'
,
'createAccount'
,
'pinCode'
,
'pinCodepassword'
,
'changeForgotpassword'
]);
$this
->
Auth
->
allow
([
'signin'
,
'signout'
,
'signup'
,
'verify'
,
'forgotPassword'
,
'createAccount'
,
'pinCode'
,
'pinCodepassword'
,
'
registersendpin'
,
'forgotsendpin'
,
'
changeForgotpassword'
]);
}
}
public
function
index
()
{
public
function
index
()
{
...
@@ -440,6 +440,65 @@ class UsersController extends AppController {
...
@@ -440,6 +440,65 @@ class UsersController extends AppController {
return
$this
->
redirect
(
$this
->
Auth
->
logout
());
return
$this
->
redirect
(
$this
->
Auth
->
logout
());
}
}
public
function
forgotsendpin
(
$token
=
null
)
{
$this
->
loadModel
(
'UserPersonals'
);
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
'Users.token'
=>
$token
]
])
->
first
();
$digits
=
4
;
$users
[
'pin_pass'
]
=
str_pad
(
rand
(
0
,
pow
(
10
,
$digits
)
-
1
),
$digits
,
'0'
,
STR_PAD_LEFT
);
$user_personals
=
$this
->
UserPersonals
->
find
(
'all'
,[
'conditions'
=>
[
'UserPersonals.user_id'
=>
$users
[
'id'
]
]
])
->
first
();
//--------------------ตัวส่ง Email ---------------------------------------------------------
//pr($user_personals);die;
$data_notification
=
[];
$data_notification
[
'email'
]
=
$user_personals
[
'email'
];
$data_notification
[
'pin_code'
]
=
$users
[
'pin_pass'
]
.
'<br>'
.
" Username: "
.
$users
[
'username'
];
$this
->
notification
(
$data_notification
);
//----------------------------------------------------------------------------------------
if
(
$this
->
Users
->
save
(
$users
)){
$this
->
Flash
->
success
(
__
(
'send pin success.'
));
return
$this
->
redirect
([
'action'
=>
'pin_codepassword/'
.
$token
]);
}
$this
->
Flash
->
success
(
__
(
'send pin false.'
));
return
$this
->
redirect
([
'action'
=>
'pin_codepassword/'
.
$token
]);
}
public
function
registersendpin
(
$token
=
null
)
{
$this
->
loadModel
(
'UserPersonals'
);
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
'Users.token'
=>
$token
]
])
->
first
();
$digits
=
4
;
$users
[
'pin_pass'
]
=
str_pad
(
rand
(
0
,
pow
(
10
,
$digits
)
-
1
),
$digits
,
'0'
,
STR_PAD_LEFT
);
$user_personals
=
$this
->
UserPersonals
->
find
(
'all'
,[
'conditions'
=>
[
'UserPersonals.user_id'
=>
$users
[
'id'
]
]
])
->
first
();
//--------------------ตัวส่ง Email ---------------------------------------------------------
//pr($user_personals);die;
$data_notification
=
[];
$data_notification
[
'email'
]
=
$user_personals
[
'email'
];
$data_notification
[
'pin_code'
]
=
$users
[
'pin_pass'
]
.
'<br>'
.
" Username: "
.
$users
[
'username'
];
$this
->
notification
(
$data_notification
);
//----------------------------------------------------------------------------------------
if
(
$this
->
Users
->
save
(
$users
)){
$this
->
Flash
->
success
(
__
(
'send pin success.'
));
return
$this
->
redirect
([
'action'
=>
'pin_code/'
.
$token
]);
}
$this
->
Flash
->
success
(
__
(
'send pin false.'
));
return
$this
->
redirect
([
'action'
=>
'pin_code/'
.
$token
]);
}
...
...
www/src/Template/Users/pin_code.ctp
View file @
fe787816
...
@@ -31,6 +31,18 @@
...
@@ -31,6 +31,18 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class=" row center">
<?php
echo $this->Html->link('ส่ง pin ใหม่อีกครั้ง', ['controller' => 'Users', 'action' => 'registersendpin/'.$token]);
?>
</div>
</div>
</div>
</div>
<?php echo $this->Form->end(); ?>
<?php echo $this->Form->end(); ?>
</div>
</div>
</div>
</div>
...
...
www/src/Template/Users/pin_codepassword.ctp
View file @
fe787816
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'pinCodepassword/'.$token],
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'pinCodepassword/'.$token],
'id' => 'PinCode', 'name' => 'PinCode', 'role' => 'form']);
'id' => 'PinCode', 'name' => 'PinCode', 'role' => 'form']);
?>
?>
<div style="padding: 5px;">
<?php echo $this->Flash->render(); ?>
<?php echo $this->Flash->render(); ?>
</div>
<div class="row">
<div class="row">
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
...
@@ -30,6 +32,17 @@
...
@@ -30,6 +32,17 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class=" row center">
<?php
echo $this->Html->link('ส่ง pin ใหม่อีกครั้ง', ['controller' => 'Users', 'action' => 'forgotsendpin/'.$token]);
?>
</div>
</div>
</div>
</div>
<?php echo $this->Form->end(); ?>
<?php echo $this->Form->end(); ?>
</div>
</div>
</div>
</div>
...
...
www/src/Template/Users/signup.ctp
View file @
fe787816
...
@@ -91,8 +91,8 @@
...
@@ -91,8 +91,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" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="1
2
" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
<input type="text" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="1
0
" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -164,17 +164,6 @@
...
@@ -164,17 +164,6 @@
</div>
</div>
</div>
</div>
<!-- ------------------------------- popup ----------------------------------- -->
<!-- ------------------------------- popup ----------------------------------- -->
<script type="text/javascript">
$(function () {
$('#phone_no').inputmask('999-999-9999');
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
</script>
<script>
<script>
$(document).ready(function() {
$(document).ready(function() {
...
@@ -316,7 +305,7 @@ function check_notnum() {
...
@@ -316,7 +305,7 @@ function check_notnum() {
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false;
return false;
}
}
if(document.getElementById("phone_no").value.length != 1
2
)
if(document.getElementById("phone_no").value.length != 1
0
)
{
{
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
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