13 m_needs_access_data =
true;
14 m_needs_change_settings =
true;
18 bool MRequestHandler::needsLogin(HttpRequest& request, HttpResponse& response) {
19 if (!m_needs_access_data && !m_needs_change_settings) {
23 if ((m_needs_access_data && !session.contains(
"can_access_data")) ||
24 (m_needs_change_settings && !session.contains(
"can_change_settings"))) {
26 QByteArray path = request.getPath();
27 QString location = QString(
"/login?returnPath=%1").arg(QString(path.toPercentEncoding()));
28 response.setStatus(301,
"Moved Permanently");
29 response.setHeader(
"Location", location.toUtf8());
30 response.setHeader(
"Content-Type",
"text/html; charset=utf-8");
31 response.write(tr(
"<h1>Moved Permanently</h1><p>The document has moved <a href=\"%1\">here</a>.</p>\n").arg(location).toUtf8());
static HttpSessionStore * sessionStore