private function check_user_password($user_id) { $condition = 'WHERE user_id=:user_id and password=:password'; $parameters = array('user_id' => $user_id, 'password' => $this->password); $match = $this->querier->row_exists(DB_TABLE_INTERNAL_AUTHENTICATION, $condition, $parameters, '*'); if ($match) { $this->connection_attempts = 0; } else { $this->connection_attempts++; } return $match; }
/** * {@inheritDoc} */ public function authenticate() { $data = $this->get_google_user_data(); $google_id = $data['id']; try { $condition = 'WHERE method=:method AND identifier=:identifier'; $parameters = array('method' => self::AUTHENTICATION_METHOD, 'identifier' => $google_id); return $this->querier->get_column_value(DB_TABLE_AUTHENTICATION_METHOD, 'user_id', $condition, $parameters); } catch (RowNotFoundException $e) { $email_exists = $this->querier->row_exists(DB_TABLE_MEMBER, 'WHERE email=:email', array('email' => $data['email'])); if ($email_exists) { $this->error_msg = LangLoader::get_message('external-auth.account-exists', 'user-common'); } else { $user = new User(); $user->set_display_name(utf8_decode($data['name'])); $user->set_level(User::MEMBER_LEVEL); $user->set_email($data['email']); $auth_method = new GoogleAuthenticationMethod(); $fields_data = array('user_avatar' => $data['picture']); return UserService::create($user, $auth_method, $fields_data); } } }
public function is_valid() { $condition = 'WHERE user_id=:user_id AND autoconnect_key=:key'; $parameters = array('user_id' => $this->user_id, 'key' => $this->key); return self::$querier->row_exists(DB_TABLE_MEMBER, $condition, $parameters); }