コード例 #1
0
 public function login()
 {
     if (Input::has('email') && Input::has('password')) {
         $email = Input::get('email');
         $password = Input::get('password');
         $user = UserModel::whereRaw('email = ? and secure_key = md5(concat(salt, ?))', array($email, $password))->get();
         if (count($user) != 0) {
             return Response::json(['user_id' => $user[0]->id, 'result' => 'success', 'msg' => '']);
         } else {
             return Response::json(['result' => 'failed', 'msg' => 'Email and Password is incorrect']);
         }
     } else {
         return Response::json(['result' => 'failed', 'msg' => 'Invalid Request']);
     }
 }