diff --git a/backend/src/Backend.ts b/backend/src/Backend.ts
index fcd9be5..e46817f 100644
--- a/backend/src/Backend.ts
+++ b/backend/src/Backend.ts
@@ -79,7 +79,6 @@ class Backend extends Server {
*/
buildAPI() {
var self = this;
- var loginCheck = super.requireLogin;
this.app.use('/dashboard', (new DashboardRouter(self.goalInstanceRepository, self.goalInstanceFactory, self.goalDefinitionRepository, self.userRepository,self.badgeRepository, new Middleware())).getRouter());
@@ -88,7 +87,7 @@ class Backend extends Server {
this.app.use("/goals", (new GoalDefinitionRouter(self.goalDefinitionRepository, self.goalDefinitionFactory, self.goalInstanceRepository, self.userRepository)).getRouter());
this.app.use("/challenges", (new GoalInstanceRouter(self.goalInstanceRepository, self.goalInstanceFactory, self.goalDefinitionRepository, self.userRepository)).getRouter());
*/
-
+
this.app.get('/test', function (req, res) {
self.storingHandler.save(
function (result) {
diff --git a/backend/src/Server.ts b/backend/src/Server.ts
index ee25530..c286105 100644
--- a/backend/src/Server.ts
+++ b/backend/src/Server.ts
@@ -67,14 +67,6 @@ class Server {
this.app.use(bodyParser.json()); // for parsing application/json
this.app.use(bodyParser.urlencoded({extended: true})); // for parsing application/x-www-form-urlencoded
- // Handle client session with mozilla library
- this.app.use(session({
- cookieName: 'session',
- secret: 'random_string_goes_here', // TODO : make secret field a high-entropy string instead of this bullshit
- duration: 30 * 60 * 1000,
- activeDuration: 5 * 60 * 1000,
- }));
-
this.app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
@@ -82,42 +74,9 @@ class Server {
next();
});
- this.app.use('/login', function (req, res, next) {
- if (req.session && req.session.user) {
- this.userRepository.userExists(req.session.user.id,
- function (user) {
- if (user) {
- req.user = user;
- delete req.user.password; // delete the password from the session
- req.session.user = user; //refresh the session value
- res.locals.user = user;
- }
- // finishing processing the middleware and run the route
- next();
- },
- function (err) {
- console.log("PROBLEME");
- res.send(err);
- });
- } else {
- next();
- }
-
- });
-
-
this.httpServer = http.createServer(this.app);
}
- requireLogin(req, res, next) {
- if (!req.user) {
- var route = req.get('host')+'/login';
- console.log('redirection vers', route);
- res.redirect(route);
- } else {
- next();
- }
- }
/**
* Runs the Server.
diff --git a/backend/src/api/DashboardRouter.ts b/backend/src/api/DashboardRouter.ts
index be4a210..bdb4aa4 100644
--- a/backend/src/api/DashboardRouter.ts
+++ b/backend/src/api/DashboardRouter.ts
@@ -28,6 +28,7 @@ class DashboardRouter extends RouterItf {
private middleware:Middleware;
+
constructor(challengeRepository:ChallengeRepository, challengeFactory:ChallengeFactory, goalRepository:GoalRepository, userRepository:UserRepository, badgeRepository:BadgeRepository, middleware:Middleware) {
super();
@@ -47,6 +48,7 @@ class DashboardRouter extends RouterItf {
var self = this;
this.router.get('/', function (req, res) {
+ console.log("Getting dashboard");
self.getDashboard(req, res);
});
diff --git a/backend/src/api/RouterItf.ts b/backend/src/api/RouterItf.ts
index 830dfd6..d6a0c3c 100644
--- a/backend/src/api/RouterItf.ts
+++ b/backend/src/api/RouterItf.ts
@@ -12,8 +12,6 @@ var express:any = require("express");
*/
class RouterItf {
- protected loginCheckFunc;
-
/**
* Router property.
*
@@ -25,8 +23,7 @@ class RouterItf {
/**
* Constructor.
*/
- constructor(loginCheck = null) {
- this.loginCheckFunc = loginCheck;
+ constructor() {
this.router = express.Router();
// middleware specific to this router
diff --git a/frontend/app/index.html b/frontend/app/index.html
index c874cd7..67c2b5c 100644
--- a/frontend/app/index.html
+++ b/frontend/app/index.html
@@ -106,6 +106,7 @@
+
@@ -113,6 +114,7 @@
+