diff --git a/src/components/common/Alert.test.js b/src/components/common/Alert.test.js
index 5b2c9bf..5f33193 100644
--- a/src/components/common/Alert.test.js
+++ b/src/components/common/Alert.test.js
@@ -8,23 +8,27 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { shallow } from 'enzyme';
-import Alert from './Alert';
+import React from "react";
+import { shallow } from "enzyme";
+import Alert from "./Alert";
-it('renders an alert correctly', () => {
+it("renders an alert correctly", () => {
const message = "test message";
const onClick = jest.fn();
- const wrapper = shallow();
+ const wrapper = shallow(
+
+ );
expect(wrapper).toHaveClassName("alert-info");
expect(wrapper).toIncludeText(message);
});
-it('calls onClick when clicked', () => {
+it("calls onClick when clicked", () => {
const message = "test message";
const onClick = jest.fn();
- const wrapper = shallow();
+ const wrapper = shallow(
+
+ );
wrapper.find("button").simulate("click");
expect(onClick).toBeCalled();
diff --git a/src/components/common/BoxedLayoutButton.js b/src/components/common/BoxedLayoutButton.js
index 4618ec7..252002f 100755
--- a/src/components/common/BoxedLayoutButton.js
+++ b/src/components/common/BoxedLayoutButton.js
@@ -8,24 +8,24 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
+import React from "react";
const boxedLayoutToggle = () => {
- document.body.classList.toggle('boxcontainer');
- document.body.classList.toggle('background-image');
+ document.body.classList.toggle("boxcontainer");
+ document.body.classList.toggle("background-image");
};
export default () => {
return (
-
- )
-}
-
-
-
+ );
+};
diff --git a/src/components/common/BoxedLayoutButton.test.js b/src/components/common/BoxedLayoutButton.test.js
index 26c8f6a..8785a9f 100644
--- a/src/components/common/BoxedLayoutButton.test.js
+++ b/src/components/common/BoxedLayoutButton.test.js
@@ -8,16 +8,16 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { shallow } from 'enzyme';
-import BoxedLayoutButton from './BoxedLayoutButton';
+import React from "react";
+import { shallow } from "enzyme";
+import BoxedLayoutButton from "./BoxedLayoutButton";
it("renders without crashing", () => {
- shallow();
+ shallow();
});
it("toggles boxed layout", () => {
- const wrapper = shallow();
+ const wrapper = shallow();
expect(document.body.classList).not.toContain("boxcontainer");
expect(document.body.classList).not.toContain("background-image");
diff --git a/src/components/common/Footer.js b/src/components/common/Footer.js
index 4930b1e..fc0f7b9 100644
--- a/src/components/common/Footer.js
+++ b/src/components/common/Footer.js
@@ -8,7 +8,7 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
+import React from "react";
import { translate } from "react-i18next";
const Footer = props => {
@@ -17,12 +17,14 @@ const Footer = props => {
return (
@@ -85,9 +91,7 @@ class SummaryStats extends Component {
{this.state.blockedQueries}
-
- {t("Queries Blocked")}
-
+
{t("Queries Blocked")}
@@ -100,9 +104,7 @@ class SummaryStats extends Component {
{this.state.percentBlocked}
-
- {t("Percent Blocked")}
-
+
{t("Percent Blocked")}
@@ -110,14 +112,12 @@ class SummaryStats extends Component {
);
diff --git a/src/config.development.js b/src/config.development.js
index f7fc5d4..534a6ef 100644
--- a/src/config.development.js
+++ b/src/config.development.js
@@ -11,4 +11,4 @@
export default {
developmentMode: true,
fakeAPI: false
-};
\ No newline at end of file
+};
diff --git a/src/config.js b/src/config.js
index 8f502e9..d28c7ef 100644
--- a/src/config.js
+++ b/src/config.js
@@ -8,16 +8,13 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import developmentConfig from './config.development';
-import productionConfig from './config.production';
+import developmentConfig from "./config.development";
+import productionConfig from "./config.production";
let config;
-if(process.env.NODE_ENV === "development")
- config = developmentConfig;
-else
- config = productionConfig;
+if (process.env.NODE_ENV === "development") config = developmentConfig;
+else config = productionConfig;
-if(process.env.REACT_APP_FAKE_API)
- config.fakeAPI = true;
+if (process.env.REACT_APP_FAKE_API) config.fakeAPI = true;
-export default config;
\ No newline at end of file
+export default config;
diff --git a/src/config.production.js b/src/config.production.js
index c02ae07..11036ab 100644
--- a/src/config.production.js
+++ b/src/config.production.js
@@ -11,4 +11,4 @@
export default {
developmentMode: false,
fakeAPI: false
-};
\ No newline at end of file
+};
diff --git a/src/containers/Full.js b/src/containers/Full.js
index 3b96f8c..ead2fcf 100644
--- a/src/containers/Full.js
+++ b/src/containers/Full.js
@@ -8,29 +8,29 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { Switch, Route, Redirect } from 'react-router-dom'
-import Header, { mobileSidebarHide } from '../components/common/Header';
-import Sidebar from '../components/common/Sidebar';
-import Footer from '../components/common/Footer';
+import React from "react";
+import { Switch, Route, Redirect } from "react-router-dom";
+import Header, { mobileSidebarHide } from "../components/common/Header";
+import Sidebar from "../components/common/Sidebar";
+import Footer from "../components/common/Footer";
import { api } from "../utils";
import { nav } from "../routes";
export default props => (
-
+
-
+
-
+
-
+
{nav.map(createRoute)}
-
+
);
@@ -41,13 +41,23 @@ export default props => (
* @param routeData the route data (see routes.js)
*/
const createRoute = routeData => {
- if(routeData.children) {
+ if (routeData.children) {
return routeData.children.map(createRoute);
}
- return routeData.auth
- ?
- : ;
+ return routeData.auth ? (
+
+ ) : (
+
+ );
};
/**
@@ -76,4 +86,3 @@ const AuthRoute = ({ component: Component, ...rest }) => (
}
/>
);
-
diff --git a/src/i18n.js b/src/i18n.js
index 7069032..26b4e54 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -1,8 +1,8 @@
-import i18n from 'i18next';
-import XHR from 'i18next-xhr-backend';
-import LanguageDetector from 'i18next-browser-languagedetector';
-import { reactI18nextModule } from 'react-i18next';
-import config from './config';
+import i18n from "i18next";
+import XHR from "i18next-xhr-backend";
+import LanguageDetector from "i18next-browser-languagedetector";
+import { reactI18nextModule } from "react-i18next";
+import config from "./config";
export function setupI18n() {
i18n
@@ -11,9 +11,17 @@ export function setupI18n() {
.use(reactI18nextModule)
.init({
fallbackLng: "en",
- ns: ['common'],
+ ns: ["common"],
defaultNS: "common",
- fallbackNS: ["dashboard", "footer", "lists", "location", "login", "query-log", "settings"],
+ fallbackNS: [
+ "dashboard",
+ "footer",
+ "lists",
+ "location",
+ "login",
+ "query-log",
+ "settings"
+ ],
nsSeparator: false,
keySeparator: false,
debug: config.developmentMode,
diff --git a/src/index.js b/src/index.js
index 01ff80a..78fd6b3 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,16 +8,16 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { BrowserRouter, Route, Switch } from 'react-router-dom'
+import React from "react";
+import ReactDOM from "react-dom";
+import { BrowserRouter, Route, Switch } from "react-router-dom";
import "ionicons/dist/css/ionicons.min.css";
import "font-awesome/css/font-awesome.min.css";
import "simple-line-icons/css/simple-line-icons.css";
-import './scss/style.css';
-import Full from './containers/Full';
+import "./scss/style.css";
+import Full from "./containers/Full";
import { api } from "./utils";
-import { setupI18n } from './i18n';
+import { setupI18n } from "./i18n";
// Before rendering anything, check if there is a session cookie.
// Note: the user could have an old session, so the first API call
@@ -27,12 +27,10 @@ api.loggedIn = document.cookie.includes("user_id=");
setupI18n();
ReactDOM.render(
- (
-
-
-
-
-
- ),
- document.getElementById('root')
+
+
+
+
+ ,
+ document.getElementById("root")
);
diff --git a/src/routes.js b/src/routes.js
index 9165897..ec02a41 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -19,96 +19,96 @@ import Login from "./views/Login";
import Logout from "./views/Logout";
export const routes = t => ({
- '/dashboard': t('Dashboard'),
- '/query-log': t('Query Log'),
- '/whitelist': t('Whitelist'),
- '/blacklist/exact': `${t('Blacklist')} (${t('Exact')})`,
- '/blacklist/regex': `${t('Blacklist')} (${t('Regex')})`,
- '/settings/versions': t('Versions'),
- '/settings/networking': t('Networking'),
- '/login': t('Login'),
- '/logout': t('Logout')
+ "/dashboard": t("Dashboard"),
+ "/query-log": t("Query Log"),
+ "/whitelist": t("Whitelist"),
+ "/blacklist/exact": `${t("Blacklist")} (${t("Exact")})`,
+ "/blacklist/regex": `${t("Blacklist")} (${t("Regex")})`,
+ "/settings/versions": t("Versions"),
+ "/settings/networking": t("Networking"),
+ "/login": t("Login"),
+ "/logout": t("Logout")
});
export const nav = [
{
- name: 'Dashboard',
- url: '/dashboard',
+ name: "Dashboard",
+ url: "/dashboard",
component: Dashboard,
- icon: 'fa fa-dashboard',
+ icon: "fa fa-dashboard",
auth: false
},
{
- name: 'Query Log',
- url: '/query-log',
+ name: "Query Log",
+ url: "/query-log",
component: QueryLog,
- icon: 'fa fa-database',
+ icon: "fa fa-database",
auth: true
},
{
- name: 'Whitelist',
- url: '/whitelist',
+ name: "Whitelist",
+ url: "/whitelist",
component: Whitelist,
- icon: 'fa fa-check-circle-o',
+ icon: "fa fa-check-circle-o",
auth: false
},
{
- name: 'Blacklist',
+ name: "Blacklist",
url: "/blacklist",
- icon: 'fa fa-ban',
+ icon: "fa fa-ban",
auth: false,
children: [
{
- name: 'Exact',
- url: '/blacklist/exact',
+ name: "Exact",
+ url: "/blacklist/exact",
component: Blacklist,
- icon: 'fa fa-ban',
+ icon: "fa fa-ban",
auth: false
},
{
- name: 'Regex',
- url: '/blacklist/regex',
+ name: "Regex",
+ url: "/blacklist/regex",
component: Regexlist,
- icon: 'fa fa-ban',
+ icon: "fa fa-ban",
auth: false
}
]
},
{
- name: 'Settings',
+ name: "Settings",
url: "/settings",
- icon: 'fa fa-wrench',
+ icon: "fa fa-wrench",
auth: true,
children: [
- {
- name: 'Versions',
- url: '/settings/versions',
+ {
+ name: "Versions",
+ url: "/settings/versions",
component: Versions,
- icon: 'fa fa-download',
+ icon: "fa fa-download",
auth: true
},
{
- name: 'Networking',
- url: '/settings/networking',
+ name: "Networking",
+ url: "/settings/networking",
component: Networking,
- icon: 'fa fa-sitemap',
- auth: true,
+ icon: "fa fa-sitemap",
+ auth: true
}
]
},
{
- name: 'Login',
- url: '/login',
+ name: "Login",
+ url: "/login",
component: Login,
- icon: 'fa fa-user',
+ icon: "fa fa-user",
auth: false,
authStrict: true
},
{
- name: 'Logout',
- url: '/logout',
+ name: "Logout",
+ url: "/logout",
component: Logout,
- icon: 'fa fa-user-times',
+ icon: "fa fa-user-times",
auth: true,
authStrict: true
}
diff --git a/src/setupTests.js b/src/setupTests.js
index 19d9443..6dba3f4 100644
--- a/src/setupTests.js
+++ b/src/setupTests.js
@@ -8,9 +8,9 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import { configure } from 'enzyme';
-import Adapter from 'enzyme-adapter-react-16';
-import 'jest-enzyme';
+import { configure } from "enzyme";
+import Adapter from "enzyme-adapter-react-16";
+import "jest-enzyme";
import { api } from "./utils";
import fetchMock from "fetch-mock";
@@ -18,12 +18,12 @@ import fetchMock from "fetch-mock";
configure({ adapter: new Adapter() });
// Mock out react-i18next
-jest.mock('react-i18next', () => ({
+jest.mock("react-i18next", () => ({
// This mock makes sure any components using the translate HoC receive the t function as a prop
translate: () => component => {
component.defaultProps = { ...component.defaultProps, t: key => key };
return component;
- },
+ }
}));
// Temporary fix to reset logged in state for each test.
diff --git a/src/utils.js b/src/utils.js
index 40ff7fa..d53e52c 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -8,27 +8,26 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import config from './config';
+import config from "./config";
-export const padNumber = (num) => {
- return ("00" + num).substr(-2,2);
+export const padNumber = num => {
+ return ("00" + num).substr(-2, 2);
};
-export const makeCancelable = (promise, { repeat = null, interval = 0 } = {}) => {
+export const makeCancelable = (
+ promise,
+ { repeat = null, interval = 0 } = {}
+) => {
let hasCanceled = false;
let repeatId = null;
const handle = (resolve, reject, val, isError) => {
- if(hasCanceled)
- reject({ isCanceled: true });
+ if (hasCanceled) reject({ isCanceled: true });
else {
- if(isError)
- reject(val);
- else
- resolve(val);
+ if (isError) reject(val);
+ else resolve(val);
- if(repeat)
- repeatId = setTimeout(repeat, interval);
+ if (repeat) repeatId = setTimeout(repeat, interval);
}
};
@@ -44,13 +43,12 @@ export const makeCancelable = (promise, { repeat = null, interval = 0 } = {}) =>
cancel() {
clearTimeout(repeatId);
hasCanceled = true;
- },
+ }
};
};
export const ignoreCancel = err => {
- if(!err.isCanceled)
- throw err;
+ if (!err.isCanceled) throw err;
};
export const api = {
@@ -73,13 +71,13 @@ export const api = {
return api.get("stats/overTime/history");
},
getClientsGraph() {
- return api.get("stats/overTime/clients")
+ return api.get("stats/overTime/clients");
},
getQueryTypes() {
- return api.get("stats/query_types")
+ return api.get("stats/query_types");
},
getForwardDestinations() {
- return api.get("stats/forward_destinations")
+ return api.get("stats/forward_destinations");
},
getTopDomains() {
return api.get("stats/top_domains");
@@ -103,13 +101,13 @@ export const api = {
return api.get("dns/regexlist");
},
addWhitelist(domain) {
- return api.post("dns/whitelist", { "domain": domain });
+ return api.post("dns/whitelist", { domain: domain });
},
addBlacklist(domain) {
- return api.post("dns/blacklist", { "domain": domain });
+ return api.post("dns/blacklist", { domain: domain });
},
addRegexlist(domain) {
- return api.post("dns/regexlist", { "domain": domain });
+ return api.post("dns/regexlist", { domain: domain });
},
removeWhitelist(domain) {
return api.delete("dns/whitelist/" + domain);
@@ -121,7 +119,7 @@ export const api = {
return api.delete("dns/regexlist/" + encodeURIComponent(domain));
},
getStatus() {
- return api.get("dns/status")
+ return api.get("dns/status");
},
get(url) {
return fetch(api.urlFor(url), {
@@ -152,42 +150,41 @@ export const api = {
.then(api.checkForErrors);
},
getNetworkInfo() {
- return api.get("settings/network")
+ return api.get("settings/network");
},
getVersion() {
- return api.get("version")
+ return api.get("version");
},
getFTLdb() {
- return api.get("settings/ftldb")
+ return api.get("settings/ftldb");
},
getDNSInfo() {
- return api.get("settings/dns")
+ return api.get("settings/dns");
},
getDHCPInfo() {
- return api.get("settings/dhcp")
+ return api.get("settings/dhcp");
},
/**
* If the user is logged in, check if the user's session has lapsed.
* If so, log them out and refresh the page.
*/
checkIfLoggedOut(response) {
- if(api.loggedIn && response.status === 401) {
+ if (api.loggedIn && response.status === 401) {
// Clear the user's old session and refresh the page
- document.cookie = 'user_id=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
+ document.cookie =
+ "user_id=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
window.location.reload();
- return Promise.reject({ isCanceled: true })
+ return Promise.reject({ isCanceled: true });
}
return Promise.resolve(response);
},
async convertJSON(data) {
- if(!data.ok)
- return Promise.reject({ data, json: await data.json() });
- else
- return data.json();
+ if (!data.ok) return Promise.reject({ data, json: await data.json() });
+ else return data.json();
},
checkForErrors(data) {
- if(data.error) {
+ if (data.error) {
return Promise.reject(data.error);
}
return Promise.resolve(data);
@@ -195,10 +192,8 @@ export const api = {
urlFor(endpoint) {
let apiLocation;
- if(config.fakeAPI)
- apiLocation = process.env.PUBLIC_URL + "/fakeAPI";
- else
- apiLocation = "/admin/api";
+ if (config.fakeAPI) apiLocation = process.env.PUBLIC_URL + "/fakeAPI";
+ else apiLocation = "/admin/api";
return apiLocation + "/" + endpoint;
},
diff --git a/src/utils.test.js b/src/utils.test.js
index 7e83d20..4d2355c 100644
--- a/src/utils.test.js
+++ b/src/utils.test.js
@@ -12,13 +12,12 @@ import { api } from "./utils";
// This is a dumb test used to set up the next test,
// which checks that the logged in state is reset before each test
-it('sets logged in to true', () => {
+it("sets logged in to true", () => {
api.loggedIn = true;
expect(api.loggedIn).toBeTruthy();
});
-it('resets the logged in state for each test', () => {
+it("resets the logged in state for each test", () => {
expect(api.loggedIn).toBeFalsy();
});
-
diff --git a/src/views/Blacklist.js b/src/views/Blacklist.js
index 64706b5..ede888d 100644
--- a/src/views/Blacklist.js
+++ b/src/views/Blacklist.js
@@ -8,8 +8,8 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { translate } from 'react-i18next';
+import React from "react";
+import { translate } from "react-i18next";
import { api } from "../utils";
import ListPage from "../components/list/ListPage";
import { isValidDomain } from "../validate";
@@ -28,7 +28,7 @@ const Blacklist = props => {
validationErrorMsg={t("Not a valid domain")}
{...props}
/>
- )
+ );
};
export default translate("location")(Blacklist);
diff --git a/src/views/Dashboard.js b/src/views/Dashboard.js
index 5a625b7..88f1150 100644
--- a/src/views/Dashboard.js
+++ b/src/views/Dashboard.js
@@ -8,56 +8,54 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React, { Fragment } from 'react';
-import SummaryStats from '../components/dashboard/SummaryStats';
-import QueriesGraph from '../components/dashboard/QueriesGraph';
-import ClientsGraph from '../components/dashboard/ClientsGraph';
+import React, { Fragment } from "react";
+import SummaryStats from "../components/dashboard/SummaryStats";
+import QueriesGraph from "../components/dashboard/QueriesGraph";
+import ClientsGraph from "../components/dashboard/ClientsGraph";
import QueryTypesChart from "../components/dashboard/QueryTypesChart";
import ForwardDestinationsChart from "../components/dashboard/ForwardDestinationsChart";
-import TopDomains from '../components/dashboard/TopDomains';
-import TopBlocked from '../components/dashboard/TopBlocked';
-import TopClients from '../components/dashboard/TopClients';
+import TopDomains from "../components/dashboard/TopDomains";
+import TopBlocked from "../components/dashboard/TopBlocked";
+import TopClients from "../components/dashboard/TopClients";
import { api } from "../utils";
export default () => (
-
+
-
+
- {
- api.loggedIn ?
-
-
-
-
-
+ {api.loggedIn ? (
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
- : null
- }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ) : null}
);
diff --git a/src/views/Login.js b/src/views/Login.js
index c00666d..aa055f8 100644
--- a/src/views/Login.js
+++ b/src/views/Login.js
@@ -27,8 +27,7 @@ class Login extends Component {
componentWillMount() {
// Check if cookies are enabled
- if(navigator.cookieEnabled)
- this.setState({ cookiesEnabled: true });
+ if (navigator.cookieEnabled) this.setState({ cookiesEnabled: true });
}
/**
@@ -39,10 +38,8 @@ class Login extends Component {
* @param e the event
*/
handlePasswordChange = e => {
- if(e.keyCode === 13)
- this.authenticate();
- else
- this.setState({ password: e.target.value });
+ if (e.keyCode === 13) this.authenticate();
+ else this.setState({ password: e.target.value });
};
/**
@@ -53,17 +50,22 @@ class Login extends Component {
e.preventDefault();
// Hash the password twice before sending to the API
- let hashedPassword = sha("sha256").update(this.state.password).digest("hex");
- hashedPassword = sha("sha256").update(hashedPassword).digest("hex");
+ let hashedPassword = sha("sha256")
+ .update(this.state.password)
+ .digest("hex");
+ hashedPassword = sha("sha256")
+ .update(hashedPassword)
+ .digest("hex");
// Clear the state
this.setState({ password: "", error: false });
// Send the password to the API to authenticate the user
- api.authenticate(hashedPassword)
+ api
+ .authenticate(hashedPassword)
.then(data => {
// Verify status
- if(data.status !== "success") {
+ if (data.status !== "success") {
console.log("Failed to log in:");
console.log(data);
return;
@@ -71,7 +73,7 @@ class Login extends Component {
api.loggedIn = true;
- if(config.fakeAPI) {
+ if (config.fakeAPI) {
// When using the fake API, set the cookie ourselves
document.cookie = "user_id=;";
}
@@ -86,76 +88,86 @@ class Login extends Component {
render() {
// If the user is already logged in, then go to the home page
- if(api.loggedIn)
- return ;
+ if (api.loggedIn) return ;
const { t } = this.props;
return (
-
+
-
-
+
+
-
+
-
-
- Pi-hole
+
+
+ Pi-
+ hole
{t("Sign in to start your session")}
- {
- // If the user tried to go to a protected page and is not logged in,
- // tell them they will be redirected once login is successful
- this.props.location.state && this.props.location.state.from.pathname in routes(t) ?
- (
-
-
- {t(
- "You will be transferred to the \"{{page}}\" page",
- { page: routes(t)[this.props.location.state.from.pathname] }
- )}
-
- ) : null
- }
- {
- // If cookies are not enabled (or detected), show a warning
- !this.state.cookiesEnabled ?
-
- {t("Verify that cookies are allowed for {{host}}", { host: window.location.host })}
-
- : null
- }
-
- {
- this.state.error
- ?
-
-
+ {// If the user tried to go to a protected page and is not logged in,
+ // tell them they will be redirected once login is successful
+ this.props.location.state &&
+ this.props.location.state.from.pathname in routes(t) ? (
+
+
+ {t('You will be transferred to the "{{page}}" page', {
+ page: routes(t)[this.props.location.state.from.pathname]
+ })}
+
+ ) : null}
+ {// If cookies are not enabled (or detected), show a warning
+ !this.state.cookiesEnabled ? (
+
+ {t("Verify that cookies are allowed for {{host}}", {
+ host: window.location.host
+ })}
- : null
- }
+ ) : null}
+
+ {this.state.error ? (
+
+
+
+ ) : null}
@@ -164,4 +176,4 @@ class Login extends Component {
}
}
-export default translate(["login", "location"])(Login);
\ No newline at end of file
+export default translate(["login", "location"])(Login);
diff --git a/src/views/Logout.js b/src/views/Logout.js
index eddda78..8760779 100644
--- a/src/views/Logout.js
+++ b/src/views/Logout.js
@@ -8,8 +8,8 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React, { Component } from 'react';
-import { Redirect } from 'react-router-dom';
+import React, { Component } from "react";
+import { Redirect } from "react-router-dom";
import { api } from "../utils";
import config from "../config";
@@ -17,16 +17,17 @@ export default class Logout extends Component {
componentWillMount() {
api.loggedIn = false;
- if(config.fakeAPI) {
+ if (config.fakeAPI) {
// When using the fake API, don't try deleting the resource
// (it results in an error). Instead, delete the cookie.
- document.cookie = 'user_id=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
+ document.cookie =
+ "user_id=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
} else {
api.logout();
}
}
render() {
- return ;
+ return ;
}
}
diff --git a/src/views/Networking.js b/src/views/Networking.js
index 80547ac..5402e4d 100644
--- a/src/views/Networking.js
+++ b/src/views/Networking.js
@@ -27,7 +27,7 @@ class Networking extends Component {
* @param tab the tab ID to switch to
*/
setTab = tab => {
- if(this.state.activeTab !== tab) {
+ if (this.state.activeTab !== tab) {
this.setState({
activeTab: tab
});
@@ -43,7 +43,10 @@ class Networking extends Component {
*/
tab = (id, name) => (
- this.setTab(id)}>
+ this.setTab(id)}
+ >
{name}
@@ -56,9 +59,7 @@ class Networking extends Component {
* @param component the component to render in the tab
* @returns {TabPane} the tab content component
*/
- tabContent = (id, component) => (
- {component}
- );
+ tabContent = (id, component) => {component};
render() {
const { t } = this.props;
@@ -72,10 +73,10 @@ class Networking extends Component {
{this.tab("ftl", t("FTL"))}
- {this.tabContent("network", )}
- {this.tabContent("dhcp", )}
- {this.tabContent("dns", )}
- {this.tabContent("ftl", )}
+ {this.tabContent("network", )}
+ {this.tabContent("dhcp", )}
+ {this.tabContent("dns", )}
+ {this.tabContent("ftl", )}
);
diff --git a/src/views/Regexlist.js b/src/views/Regexlist.js
index e254450..9852580 100644
--- a/src/views/Regexlist.js
+++ b/src/views/Regexlist.js
@@ -8,8 +8,8 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { translate } from 'react-i18next';
+import React from "react";
+import { translate } from "react-i18next";
import ListPage from "../components/list/ListPage";
import { api } from "../utils";
diff --git a/src/views/Versions.js b/src/views/Versions.js
index 1f2e993..0436879 100644
--- a/src/views/Versions.js
+++ b/src/views/Versions.js
@@ -8,13 +8,13 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import VersionInfo from '../components/settings/VersionInfo';
+import React from "react";
+import VersionInfo from "../components/settings/VersionInfo";
export default () => (
-
+
);
diff --git a/src/views/Whitelist.js b/src/views/Whitelist.js
index f0ccf24..5f641c0 100644
--- a/src/views/Whitelist.js
+++ b/src/views/Whitelist.js
@@ -8,8 +8,8 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
-import React from 'react';
-import { translate } from 'react-i18next';
+import React from "react";
+import { translate } from "react-i18next";
import ListPage from "../components/list/ListPage";
import { api } from "../utils";
import { isValidDomain } from "../validate";
@@ -28,7 +28,7 @@ const Whitelist = props => {
validationErrorMsg={t("Not a valid domain")}
{...props}
/>
- )
+ );
};
export default translate(["location", "lists"])(Whitelist);