<commit_before>'use strict'

const { Router } = require('express')
const bodyParser = require('body-parser')
const auth = require('../lib/auth')
const { People, Organization } = require('../lib/model')
const { format } = require('../lib/model-utils')
const { UnauthorizedError } = require('../lib/errors')
const { map } = require('lodash/fp')

const router = module.exports = Router()

// Permissions on my People's instance
const MY_PERMISSIONS = { viewable: true, editable: false, confidentials: { viewable: true, editable: false, paths: [] } }

const formatPeople = p => format('People', p, MY_PERMISSIONS)
const formatOrganization = o => format('Organization', o)
const populateAndFormatPeople = p => p.populateAll().then(formatPeople)

const parseJson = bodyParser.json()
const parseForm = bodyParser.urlencoded({
	extended: true
})

router.post('/login', parseJson, parseForm, (req, res, next) => {
	const { login, password } = req.body<commit_msg>fix(auth): we have to go deeper (cf. previous commit)<commit_after>'use strict'

const { Router } = require('express')
const bodyParser = require('body-parser')
const auth = require('../lib/auth')
const { People, Organization } = require('../lib/model')
const { format } = require('../lib/model-utils')
const { UnauthorizedError } = require('../lib/errors')
const { map } = require('lodash/fp')

const router = module.exports = Router()

// Permissions on my People's instance
const MY_PERMISSIONS = { viewable: true, editable: false, confidentials: { viewable: true, editable: false, paths: [] } }

const formatPeople = p => format('People', p, MY_PERMISSIONS)
const formatOrganization = o => format('Organization', o, MY_PERMISSIONS)
const populateAndFormatPeople = p => p.populateAll().then(formatPeople)

const parseJson = bodyParser.json()
const parseForm = bodyParser.urlencoded({
	extended: true
})

router.post('/login', parseJson, parseForm, (req, res, next) => {
	const { login, password } = req.body
{'fraction_non_alphanumeric': 0.15835030549898166, 'fraction_numerical': 0.0, 'mean_word_length': 5.15987460815047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '881548', 'n_tokens_mistral': 598, 'n_tokens_neox': 583, 'n_words': 164}