use cron middleware

This commit is contained in:
Matteo Pagliazzi
2015-12-15 12:11:32 +01:00
parent e547eb2dde
commit 13cbf03759
9 changed files with 27 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
import validator from 'validator';
import passport from 'passport';
import { authWithHeaders } from '../../middlewares/api-v3/auth';
import cron from '../../middlewares/api-v3/cron';
import {
NotAuthorized,
} from '../../libs/api-v3/errors';
@@ -138,6 +139,7 @@ function _loginRes (user, req, res, next) {
api.loginLocal = {
method: 'POST',
url: '/user/auth/local/login',
middlewares: [cron],
handler (req, res, next) {
req.checkBody({
username: {
@@ -182,6 +184,7 @@ api.loginLocal = {
api.loginSocial = {
method: 'POST',
url: '/user/auth/social', // this isn't the most appropriate url but must be the same as v2
middlewares: [cron],
handler (req, res, next) {
let accessToken = req.body.authResponse.access_token;
let network = req.body.network;
@@ -247,7 +250,7 @@ api.loginSocial = {
api.deleteSocial = {
method: 'DELETE',
url: '/user/auth/social/:network',
middlewares: [authWithHeaders()],
middlewares: [authWithHeaders(), cron],
handler (req, res, next) {
let user = res.locals.user;
let network = req.params.network;