/**
  * @param $input
  *
  * @return bool
  */
 private function checkSign($input)
 {
     $terminal = Terminal::find($input['term']);
     if ($terminal == null) {
         return false;
     }
     if (!isset($input['sign'])) {
         return false;
     }
     $signature = md5('terminal=' . $input['term'] . '|event=' . $input['event'] . '|' . $terminal->key);
     return $signature == $input['sign'];
 }
 public function postChangeData()
 {
     $input = Input::only('username', 'url', 'queue', 'key', 'password', 'confirmPassword', 'oldPassword');
     //проверяем данные
     $errors = Validators::getErrorFromChangeData($input);
     if ($errors) {
         return $errors;
     }
     //Проверяем текущий пароль
     $termId = Config::get('ff-actions-calc::termId');
     $terminal = Terminal::find($termId);
     if ($input['oldPassword'] != $terminal->password) {
         $result['errors'] = array('termId' => '', 'username' => '', 'url' => '', 'queue' => '', 'key' => '', 'password' => '', 'confirmPassword' => '', 'oldPassword' => 'Неверный пароль');
         return $result;
     }
     //Изменяем данные
     $terminal->changeTerminal($input);
     $message = 'Данные изменены';
     return array('message' => $message);
 }
예제 #3
0
 /**
  * @return null|Terminal
  */
 public static function getTerm()
 {
     $termId = Config::get('ff-actions-calc::termId');
     $terminal = Terminal::find($termId);
     return $terminal;
 }