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
7a1d7643
authored
May 30, 2018
by
Teeradone-PIM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teeradone
parent
37037e64
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
16 deletions
+89
-16
www/src/Controller/UsersController.php
+60
-1
www/src/Template/Users/pin_code.ctp
+12
-0
www/src/Template/Users/pin_codepassword.ctp
+14
-1
www/src/Template/Users/signup.ctp
+3
-14
No files found.
www/src/Controller/UsersController.php
View file @
7a1d7643
...
...
@@ -18,7 +18,7 @@ class UsersController extends AppController {
*/
public
function
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
()
{
...
...
@@ -440,7 +440,66 @@ class UsersController extends AppController {
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 @
7a1d7643
...
...
@@ -31,6 +31,18 @@
</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(); ?>
</div>
</div>
...
...
www/src/Template/Users/pin_codepassword.ctp
View file @
7a1d7643
...
...
@@ -8,7 +8,9 @@
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'pinCodepassword/'.$token],
'id' => 'PinCode', 'name' => 'PinCode', 'role' => 'form']);
?>
<?php echo $this->Flash->render(); ?>
<div style="padding: 5px;">
<?php echo $this->Flash->render(); ?>
</div>
<div class="row">
<div class="form-group has-feedback">
<div class="col-md-12">
...
...
@@ -30,6 +32,17 @@
</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(); ?>
</div>
</div>
...
...
www/src/Template/Users/signup.ctp
View file @
7a1d7643
...
...
@@ -91,8 +91,8 @@
<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" 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">
<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
0
" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
</div>
</div>
</div>
...
...
@@ -164,17 +164,6 @@
</div>
</div>
<!-- ------------------------------- popup ----------------------------------- -->
<script type="text/javascript">
$(function () {
$('#phone_no').inputmask('999-999-9999');
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
</script>
<script>
$(document).ready(function() {
...
...
@@ -316,7 +305,7 @@ function check_notnum() {
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false;
}
if(document.getElementById("phone_no").value.length != 1
2
)
if(document.getElementById("phone_no").value.length != 1
0
)
{
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
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