mirror of
https://github.com/directus/directus.git
synced 2026-02-11 16:54:57 -05:00
Fix things for MySQL
This commit is contained in:
@@ -9,8 +9,6 @@ import getEmailFromProfile from '../utils/get-email-from-profile';
|
||||
import { InvalidPayloadException } from '../exceptions/invalid-payload';
|
||||
import ms from 'ms';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import { Action } from '../types';
|
||||
import ActivityService from '../services/activity';
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -26,7 +24,6 @@ router.post(
|
||||
const authenticationService = new AuthenticationService({
|
||||
accountability: req.accountability,
|
||||
});
|
||||
const activityService = new ActivityService();
|
||||
|
||||
const { error } = loginSchema.validate(req.body);
|
||||
if (error) throw new InvalidPayloadException(error.message);
|
||||
@@ -47,16 +44,6 @@ router.post(
|
||||
}
|
||||
);
|
||||
|
||||
/** @todo move activity creation to AuthService */
|
||||
await activityService.create({
|
||||
action: Action.AUTHENTICATE,
|
||||
collection: 'directus_users',
|
||||
item: id,
|
||||
ip: ip,
|
||||
user_agent: userAgent,
|
||||
action_by: id,
|
||||
});
|
||||
|
||||
const payload = {
|
||||
data: { access_token: accessToken, expires },
|
||||
} as Record<string, Record<string, any>>;
|
||||
@@ -159,7 +146,6 @@ router.use(grant.express()(getGrantConfig()));
|
||||
router.get(
|
||||
'/sso/:provider/callback',
|
||||
asyncHandler(async (req, res) => {
|
||||
const activityService = new ActivityService();
|
||||
const authenticationService = new AuthenticationService({
|
||||
accountability: req.accountability,
|
||||
});
|
||||
@@ -170,18 +156,6 @@ router.get(
|
||||
email
|
||||
);
|
||||
|
||||
const ip = req.ip;
|
||||
const userAgent = req.get('user-agent');
|
||||
|
||||
await activityService.create({
|
||||
action: Action.AUTHENTICATE,
|
||||
collection: 'directus_users',
|
||||
item: id,
|
||||
ip: ip,
|
||||
user_agent: userAgent,
|
||||
action_by: id,
|
||||
});
|
||||
|
||||
return res.status(200).json({
|
||||
data: { access_token: accessToken, refresh_token: refreshToken, expires },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user