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
507e8354
authored
May 24, 2018
by
Wittaya-PIM
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'integration' into wittaya
parents
90b5d05b
7785f907
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
57 deletions
+104
-57
www/src/Controller/ProfilesController.php
+6
-1
www/src/Controller/UsersController.php
+36
-3
www/src/Template/UserCards/view_card.ctp
+61
-52
www/src/Template/Users/change_forgotpassword.ctp
+1
-1
No files found.
www/src/Controller/ProfilesController.php
View file @
507e8354
...
...
@@ -53,7 +53,12 @@ class ProfilesController extends AppController
if
(
!
empty
(
$Province
))
$Province
=
$Province
->
toArray
();
$res
=
$responseUserPersonal
[
'birthdate'
];
$dateNow
=
$res
->
i18nFormat
(
'dd/MM/yyyy'
);
if
(
$res
){
$dateNow
=
@
$res
->
i18nFormat
(
'dd/MM/yyyy'
);
}
else
{
$dateNow
=
""
;
}
if
(
$this
->
request
->
is
([
'patch'
,
'post'
,
'put'
]))
{
$data
=
$this
->
request
->
data
;
...
...
www/src/Controller/UsersController.php
View file @
507e8354
...
...
@@ -18,7 +18,7 @@ class UsersController extends AppController {
*/
public
function
initialize
()
{
parent
::
initialize
();
$this
->
Auth
->
allow
([
'signin'
,
'signout'
,
'signup'
,
'verify'
,
'forgotPassword'
,
'createAccount'
,
'pinCode'
,
'pinCodepassword'
]);
$this
->
Auth
->
allow
([
'signin'
,
'signout'
,
'signup'
,
'verify'
,
'forgotPassword'
,
'createAccount'
,
'pinCode'
,
'pinCodepassword'
,
'changeForgotpassword'
]);
}
public
function
index
()
{
...
...
@@ -383,7 +383,7 @@ class UsersController extends AppController {
$data
[
'pin_pass'
]
=
$data
[
'pin_code_1'
]
.
$data
[
'pin_code_2'
]
.
$data
[
'pin_code_3'
]
.
$data
[
'pin_code_4'
];
if
(
$data
[
'pin_pass'
]
==
$users
[
'pin_pass'
]){
$this
->
Flash
->
success
(
__
(
'Pin Completed.'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'change
P
assword/'
.
$token
]);
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'change
Forgotp
assword/'
.
$token
]);
}
$this
->
Flash
->
error
(
__
(
'Pin Invalid'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'pinCodepassword/'
.
$token
]);
...
...
@@ -393,6 +393,38 @@ class UsersController extends AppController {
public
function
changePassword
(
$token
=
null
)
{
$id
=
$this
->
Auth
->
user
(
'id'
);
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$users
=
$this
->
Users
->
get
(
$id
);
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'
));
$this
->
Flash
->
success
(
__
(
'You are now logged out.'
));
return
$this
->
redirect
([
'action'
=>
'signout'
]);
}
else
{
$this
->
Flash
->
error
(
__
(
'Invalid password.'
));
return
$this
->
redirect
([
'action'
=>
'change-password'
]);
}
}
$this
->
set
(
array
(
'token'
=>
$token
,
'_serialize'
=>
array
(
'token'
)));
}
public
function
changeForgotpassword
(
$token
=
null
)
{
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
...
...
@@ -402,7 +434,7 @@ class UsersController extends AppController {
if
(
$this
->
request
->
is
(
'post'
))
{
$hasher
=
new
DefaultPasswordHasher
();
$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'
]);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
...
...
@@ -413,6 +445,7 @@ class UsersController extends AppController {
$this
->
set
(
array
(
'token'
=>
$token
,
'_serialize'
=>
array
(
'token'
)));
}
#---------------------------------------------------------------------------------------------------
/**
...
...
www/src/Template/UserCards/view_card.ctp
View file @
507e8354
...
...
@@ -10,11 +10,11 @@ use Cake\I18n\Time;
</div>
</div>
<div class="col-xs-9 col-sm-9 col-md-9 box-card">
<div data-toggle="modal" data-target="#defaultModal" style="
text-align: center; cursor: pointer
;">
<div data-toggle="modal" data-target="#defaultModal" style="
cursor: pointer; padding-right: 10px; padding-left: 10px
;">
<div class="row">
<div class="col-xs-1">
</div>
<div class="col-xs-
6
">
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-
8
">
<div style="font-size: 17px">
<br>
<label>id<label>
...
...
@@ -26,30 +26,29 @@ use Cake\I18n\Time;
<label style="font-size: 17px">ชื่อ</label> <?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row">
<div class="col-xs-1">
</div>
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-10">
<label style="font-size: 17px">ตำแหน่ง</label> <?php echo $value['position_name'] ?>
</div>
</div>
<div class="row">
<div class="col-xs-1">
</div>
<div class="col-xs-5">
<div class="row text-center">
<!-- <div class="col-xs-1">
</div> -->
<br>
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-
5
">
<div class="col-xs-
6
">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
...
...
@@ -57,13 +56,13 @@ use Cake\I18n\Time;
?>
</div>
</div>
<div class="row">
<div class="col-xs-1">
</div>
<div class="col-xs-
5
">
<div class="row
text-center
">
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-
6
">
<label style="font-size: 17px">วันออกบัตร</label>
</div>
<div class="col-xs-
5
">
<div class="col-xs-
6
">
<label style="font-size: 17px">วันหมดออายุ</label>
</div>
</div>
...
...
@@ -188,18 +187,18 @@ use Cake\I18n\Time;
<div class = "row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="row date-name">
<div class="col-xs-1">
</div>
<div class="col-xs-
6
">
<
div style="font-size: 17px"
>
<br
>
<label>id<label>
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-
8
">
<
br
>
<div
>
<label>id<
/
label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<labe
l style="font-size: 17px"
>ชื่อ</label> <?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
<labe>ชื่อ</label> <?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
...
...
@@ -207,23 +206,23 @@ use Cake\I18n\Time;
</div>
</div>
<div class="row date-position">
<div class="col-xs-1">
</div>
<div class="col-xs-1
0
">
<label
style="font-size: 17px"
>ตำแหน่ง</label> <?php echo $value['position_name'] ?>
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-1
2
">
<label>ตำแหน่ง</label> <?php echo $value['position_name'] ?>
</div>
</div>
<div class="row date-time">
<div class="col-xs-1">
</div>
<div class="col-xs-
5
">
<div class="row
text-center
date-time">
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-
6
">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-
5
">
<div class="col-xs-
6
">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
...
...
@@ -231,14 +230,14 @@ use Cake\I18n\Time;
?>
</div>
</div>
<div class="row date-label">
<div class="col-xs-1">
</div>
<div class="col-xs-
5
">
<label
style="font-size: 17px"
>วันออกบัตร</label>
<div class="row
text-center
date-label">
<
!-- <
div class="col-xs-1">
</div>
-->
<div class="col-xs-
6
">
<label>วันออกบัตร</label>
</div>
<div class="col-xs-
5
">
<label
style="font-size: 17px"
>วันหมดออายุ</label>
<div class="col-xs-
6
">
<label>วันหมดออายุ</label>
</div>
</div>
</div>
...
...
@@ -413,27 +412,37 @@ use Cake\I18n\Time;
-o-transform: rotate(270deg);
writing-mode: rl-tb;
position: absolute;
font-size:
2
0px;
font-size:
3
0px;
}
.form_1 .date-name{
width: 350px;
margin: 70% 0% 0% -20%;
width: 500px;
margin: 55% 0% 0% -40%;
border-bottom:0px solid red;
}
.date-name div div{
height:35px;
}
.form_1 .date-position{
width: 350px;
margin: 55% 0% 0% 5%;
width: 500px;
margin: 70% 0% 0% -15%;
border-bottom:0px solid #000;
}
.form_1 .date-time{
width: 350px;
margin: 70% 0% 0% 17%;
width: 500px;
margin: 70% 0% 0% 10%;
border-bottom:0px solid #000;
}
.form_1 .date-label{
width: 350px;
margin: 70% 0% 0% 25%;
width: 500px;
margin: 70% 0% 0% 20%;
border-bottom:0px solid #000;
}
</style>
...
...
www/src/Template/Users/change_forgotpassword.ctp
View file @
507e8354
...
...
@@ -6,7 +6,7 @@
<!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;">
<strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong>
</div>-->
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'change
P
assword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changeForgotpassword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'change
Forgotp
assword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changeForgotpassword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Flash->render(); ?>
</div>
<div>
...
...
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