Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login_mobile()
- {
- if (isset($this->request->query['mobile']) && $this->request->query['mobile'] != null) {
- $mobile = $this->request->query['mobile'];
- }
- else
- {
- $mobile = null;
- }
- $admin = $this->Admin->findByMobile($mobile);
- if ($admin) {
- $otp = mt_rand(1111, 9999);
- // $sms = new Sms();
- // $send = $sms->send_otp($mobile, $otp);
- $admin['Admin']['otp'] = $otp;
- $res = new ResponseObject();
- $res->status = 'success';
- $res->message = 'Sent.';
- $res->data = $admin;
- $this->response->body(json_encode($res));
- return $this->response;
- } else {
- $res = new ResponseObject();
- $res->status = 'error';
- $res->message = 'User not found.';
- $res->data = [];
- $this->response->body(json_encode($res));
- return $this->response;
- }
- }
Add Comment
Please, Sign In to add comment