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
4f81c251
authored
May 17, 2018
by
Zen-PC\Zen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zen : update big card
parent
a9028a7d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
83 deletions
+116
-83
www/src/Controller/ProfilesController.php
+3
-33
www/src/Controller/UsersController.php
+113
-50
www/src/Template/Profiles/index.ctp
+0
-0
www/src/Template/Profiles/index_backup.ctp
+0
-0
www/webroot/img/core/img/card-bg-front@3x-V2.png
+0
-0
No files found.
www/src/Controller/ProfilesController.php
View file @
4f81c251
...
...
@@ -24,8 +24,7 @@ class ProfilesController extends AppController
$this
->
loadModel
(
'MasterCountries'
);
$Country
=
$this
->
MasterCountries
->
find
(
'list'
,
[
'conditions'
=>
[
'is_used'
=>
true
,
'MasterCountries.id'
=>
1
],
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'valueField'
=>
'country_name_th'
]);
...
...
@@ -35,8 +34,7 @@ class ProfilesController extends AppController
$this
->
loadModel
(
'MasterProvinces'
);
$Province
=
$this
->
MasterProvinces
->
find
(
'list'
,
[
'conditions'
=>
[
'is_used'
=>
true
,
'master_country_id'
=>
1
],
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'valueField'
=>
'province_name_th'
]);
...
...
@@ -86,6 +84,7 @@ class ProfilesController extends AppController
$birthdate
=
explode
(
"/"
,
$this
->
request
->
data
[
'UserPersonals'
][
'birthdate'
]);
$birthdate
=
$birthdate
[
2
]
.
'-'
.
$birthdate
[
1
]
.
'-'
.
$birthdate
[
0
];
$userPersonals
=
$this
->
UserPersonals
->
patchEntity
(
$userPersonals
,
$data
[
'UserPersonals'
]);
$userPersonals
[
'firstname_th'
]
=
$this
->
request
->
data
[
'UserPersonals'
][
'firstname_th'
];
$userPersonals
[
'lastname_th'
]
=
$this
->
request
->
data
[
'UserPersonals'
][
'lastname_th'
];
...
...
@@ -110,9 +109,6 @@ class ProfilesController extends AppController
}
/*****************************************************************************/
/*****************************************************************************/
public
function
settingProfile
()
{
//prr($this->request->getHeaderLine('Accept-Language'));
...
...
@@ -593,30 +589,4 @@ if (!empty($SubjectEnrolls)) {
$this
->
viewBuilder
()
->
layout
(
'blank'
);
}
// public function getProvince() {
// $this->autoRender = false;
// $this->loadModel('MasterProvinces');
// $states = array();
// // pr($this->request->data);die;
// // echo 'jjjj';
// $states = $this->MasterProvinces->find('list', array(
// 'keyField' => 'id',
// 'valueField' => 'province_name_th',
// 'conditions' => array(
// 'master_country_id' => 2
// )
// ))->toArray();
// $arr = array();
// foreach($states as $key => $val){
// $arr[$key] = $val;
// }
// //pr($states);die;
// // $arr['1'] = "ไทยยยย";
// // $arr['2'] = "ไทยยยยยยยยยย";
// echo json_encode($arr);
// // $data = jQuery.parseJSON($f);
// // pr($data);die;
// }
}
www/src/Controller/UsersController.php
View file @
4f81c251
...
...
@@ -94,7 +94,7 @@ class UsersController extends AppController
$countries
=
$this
->
MasterCountries
->
find
(
'list'
,
[
'conditions'
=>
[
'is_used'
=>
true
,
'id'
=>
1
],
'conditions'
=>
[
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'valueField'
=>
[
'country_name_th'
]
]
...
...
@@ -103,7 +103,7 @@ class UsersController extends AppController
$provinces
=
$this
->
MasterProvinces
->
find
(
'list'
,
[
'conditions'
=>
[
'is_used'
=>
true
,
'master_country_id'
=>
1
],
'conditions'
=>
[
'is_used'
=>
true
],
'keyField'
=>
'id'
,
'valueField'
=>
'province_name_th'
]
...
...
@@ -217,7 +217,7 @@ class UsersController extends AppController
$user_personals
=
$this
->
UserPersonals
->
patchEntity
(
$user_personals
,
$this
->
request
->
getData
());
$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
([
'action'
=>
'signin'
]);
}
...
...
@@ -356,61 +356,124 @@ class UsersController extends AppController
#---------------------------------------------------------------------------------------------------
#Change Password
public
function
changePassword
()
{
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$data
=
$this
->
request
->
data
();
#debug($data);exit();
// pr($data);die;
// pr($this->validateAccount($data));die;
if
(
!
empty
(
$data
)){
// pr($data);die;
if
(
$this
->
validateAccount
(
$data
)){
$data
[
'data'
][
'ip'
]
=
$this
->
request
->
clientIp
();
#debug($data);exit();
// pr($data);die;
$api_core_change_password
=
Configure
::
read
(
'Config.apiCore.changePassword'
);
#debug($api_core_change_password);exit();
$http
=
new
Client
();
// pr($http);die;
#$response = json_decode($http->post($api_core_change_password,$data)->body(),'_full');
$response
=
$http
->
post
(
$api_core_change_password
,
$data
)
->
body
();
// pr($data);die;
#debug($response);exit();
$response
=
json_decode
(
$response
,
'_full'
);
// pr($response);die;
#debug($response);exit();
if
(
!
empty
(
$response
)){
// pr($response);die;
// public function changePassword()
// {
// $users = $this->Users->newEntity();
// // $this->viewBuilder()->layout('blank');
// $data = $this->request->data();#debug($data);exit();
// // pr($data);die;
// // if(!empty($data)){
// // if($this->validateAccount($data)){
// if ($this->request->is('post')) {
// $data['ip'] = $this->request->clientIp();#debug($data);exit();
// $hasher = new DefaultPasswordHasher();
// $data['id'] = 59445;
// $users = $this->Users->find('all',[
// 'conditions'=>[
// 'Users.id' => $data['id'],
// ]
// ])->first();
// // pr($data['password']);
// // pr($users['password']);die;
// // $sss = check( $data['password'] , $users['password'] );
// $user['password'] = $hasher->hash($data['password']);
// // pr($user);die;
// $users = $this->Users->patchEntity($users, $this->request->getData());
// $this->Users->save($users);
// $this->Flash->error(__('Change Password Success'));
// // return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// // $response = json_decode($users['password'],'_full');
// // pr($response);die;
// #debug($response);exit();
// // pr($data);die;
// // 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;
// //
#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'
]);
}
}
// //
$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
{
$this
->
Flash
->
error
(
__
(
'Data Empty'
));
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signin'
]);
}
}
}
// }else{
// $this->Flash->error(__('Data Empty'));
// return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// }
// // }
// }
public
function
changePassword
()
{
// $users = $this->Users->newEntity();
if
(
$this
->
request
->
is
(
'post'
))
{
$hasher
=
new
DefaultPasswordHasher
();
$confirm_password
=
$this
->
request
->
data
[
'confirm_password'
];
$this
->
request
->
data
[
'password'
]
=
$hasher
->
hash
(
$this
->
request
->
data
[
'password'
]);
$userid
=
59445
;
$users
=
$this
->
Users
->
find
(
'all'
,[
'conditions'
=>
[
'Users.id'
=>
$userid
]
])
->
first
();
// if($this->request->data['old']!=$users['password'])
$users
=
$this
->
Users
->
patchEntity
(
$users
,
$this
->
request
->
getData
());
$this
->
Users
->
save
(
$users
);
pr
(
$users
);
die
;
// return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]);
return
$this
->
redirect
([
'action'
=>
'signin'
]);
// }
// $this->Flash->error(__('Username or Email Address already used by others.'));
// return $this->redirect(['action' => 'signup']);
// $this->Flash->error(__('The article could not be saved. Please, try again.'));
}
}
#---------------------------------------------------------------------------------------------------
public
function
signout
()
{
$this
->
checkToken
();
}
}
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/Profiles/index.ctp
View file @
4f81c251
This diff is collapsed.
Click to expand it.
www/src/Template/Profiles/index_backup.ctp
View file @
4f81c251
This diff is collapsed.
Click to expand it.
www/webroot/img/core/img/card-bg-front@3x-V2.png
0 → 100644
View file @
4f81c251
27.9 KB
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