| Line 263... |
Line 263... |
| 263 |
$this->User->recursive = -1;
|
263 |
$this->User->recursive = -1;
|
| 264 |
if (!$this->User->exists($id)) {
|
264 |
if (!$this->User->exists($id)) {
|
| 265 |
$result = array('success'=>false,'message'=>'Invalid user');
|
265 |
$result = array('success'=>false,'message'=>'Invalid user');
|
| 266 |
} else {
|
266 |
} else {
|
| 267 |
if ($this->request->is('post') || $this->request->is('put')) {
|
267 |
if ($this->request->is('post') || $this->request->is('put')) {
|
| 268 |
if(!empty($this->request->data['mobile_number'])){
|
268 |
if(!empty($this->request->data['mobile_number']) && empty($this->request->data['mobile_verified'])){
|
| - |
|
269 |
$options = array('conditions'=>array('User.id'=>$id),'fields'=>array('mobile_number'),'recursive'=>-1);
|
| - |
|
270 |
$oldMobile = $this->User->find('first',$options);
|
| - |
|
271 |
if($this->request->data['mobile_number'] != $oldMobile['User']['mobile_number']) {
|
| 269 |
$this->request->data['mobile_verified'] = 0;
|
272 |
$this->request->data['mobile_verified'] = 0;
|
| - |
|
273 |
}
|
| 270 |
}
|
274 |
}
|
| 271 |
if ($this->User->save($this->request->data)) {
|
275 |
if ($this->User->save($this->request->data)) {
|
| 272 |
$result = array('success'=>true,'message'=>'Your profile has been saved');
|
276 |
$result = array('success'=>true,'message'=>'Your profile has been saved');
|
| 273 |
} else {
|
277 |
} else {
|
| 274 |
$result = array('success'=>false,'message'=> 'The user could not be saved. Please, try again.');
|
278 |
$result = array('success'=>false,'message'=> 'The user could not be saved. Please, try again.');
|