Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function post_recoverPass()
- {
- try
- {
- if ( empty($_POST['newpass']) || empty($_POST['repeatPass']))
- {
- $json = $this->response(array(
- 'code' => 400,
- 'message' => 'Existen campos vacíos',
- 'data' => []
- ));
- return $json;
- }
- if(($_POST['newpass']) == ($_POST['repeatPass']))
- {
- $input = $_POST;
- $user = new Model_Users();
- $user->password = $input['newpass'];
- $user->save();
- $json = $this->response(array(
- 'code' => 200,
- 'message' => 'Contraseña cambiada',
- 'data' => []
- ));
- return $json;
- }
- else
- {
- $json = $this->response(array(
- 'code' => 400,
- 'message' => 'Los campos no coinciden',
- 'data' => []
- ));
- return $json;
- }
- }
- catch (Exception $e)
- {
- $json = $this->response(array(
- 'code' => 500,
- 'message' => $e->getMessage()
- ));
- return $json;
- }
- }
Add Comment
Please, Sign In to add comment