Skip to content

Commit

Permalink
Merge branch 'staging' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Feb 27, 2023
2 parents 621f47d + 44f1d3c commit addfeac
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 43 deletions.
8 changes: 4 additions & 4 deletions src/api/auth/auth.middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ export const signin = async (req, res, next) => {
const { password: _password } = user;
const isMatch = await bcrypt.compare(password, _password);
if (!isMatch) throw new BadRequestError('Mauvaise combinaison utilisateur/mot de passe');
totp.options = { window: [20, 0] };
totp.options = { window: [60, 0] };
if (!userOtp) {
res.setHeader(otpHeader, 'required');
res.setHeader(otpMethodHeader, 'email;');
if (otpMethod === 'email') {
const otp = totp.generate(user.otpSecret);
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress;
agenda.now('send signin email', { user, otp, ip });
const expires = new Date().setMinutes(new Date().getMinutes() + 10);
const expires = new Date().setMinutes(new Date().getMinutes() + 15);
const options = {
year: 'numeric',
month: 'long',
Expand Down Expand Up @@ -138,15 +138,15 @@ export const resetPassword = async (req, res, next) => {
const otpMethod = req.headers[otpMethodHeader];
const user = await usersRepository.getByEmail(email);
if (!user) throw new NotFoundError();
totp.options = { window: [20, 0] };
totp.options = { window: [60, 0] };
if (!userOtp) {
res.setHeader(otpHeader, 'required');
res.setHeader(otpMethodHeader, 'email;');
if (otpMethod === 'email') {
const otp = totp.generate(user.otpSecret);
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress;
agenda.now('send recovery email', { user, otp, ip });
const expires = new Date().setMinutes(new Date().getMinutes() + 10);
const expires = new Date().setMinutes(new Date().getMinutes() + 15);
const options = {
year: 'numeric',
month: 'long',
Expand Down
2 changes: 1 addition & 1 deletion src/api/commons/queries/structures.elastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default [
$match: {
$expr: {
$and: [
{ $in: ['$type', ['GRID', 'idRef', 'RNSR', 'ROR', 'Siret', 'UAI', 'Wikidata']] },
{ $in: ['$type', ['finess', 'GRID', 'idRef', 'ringgold', 'RNSR', 'ROR', 'Siret', 'UAI', 'Wikidata']] },
],
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/api/persons/__tests__/identifiers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ describe('API > persons > identifiers > list', () => {
.post(`/${resource}/${resourceId}/${subresource}/`)
.set('Authorization', authorization)
.send({
type: 'Siret',
value: 'siretID',
type: 'scopus',
value: 'scopusID',
active: true,
startDate: '2012-01-01',
endDate: '2014-12-31',
Expand All @@ -200,7 +200,7 @@ describe('API > persons > identifiers > list', () => {
.set('Authorization', authorization)
.send({
type: 'idRef',
value: 'idrefID',
value: 'idRefID',
active: true,
startDate: '2012-01-01',
endDate: '2014-12-31',
Expand All @@ -221,7 +221,7 @@ describe('API > persons > identifiers > list', () => {
.set('Authorization', authorization);
const docs = body.data.map((doc) => doc.type);
expect(docs).toHaveLength(3);
expect(docs).toContain('Siret');
expect(docs).toContain('scopus');
expect(docs).toContain('Wikidata');
expect(docs).toContain('idRef');
});
Expand Down
4 changes: 2 additions & 2 deletions src/api/search/search.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ router.route('/autocomplete')
default_operator: 'AND',
fields: ['acronym', 'acronymFr', 'acronymEn', 'acronymLocal', 'brandName', 'category', 'city', 'firstName', 'id', 'identifiers',
'lastName', 'locality', 'name', 'nameEn', 'names', 'names.acronymFr', 'names.id', 'names.nameEn', 'names.officialName',
'names.otherNames', 'names.shortName', 'names.usualName', 'officialName', 'otherNames', 'shortName'],
'names.otherNames', 'names.shortName', 'names.usualName', 'officialName', 'otherNames', 'otherNamesEn', 'otherNamesFr', 'shortName'],
},
}, {
query_string: {
query: `*${query.replace(/-/g, ' ')}*`,
default_operator: 'AND',
fields: ['acronym', 'acronymFr', 'acronymEn', 'acronymLocal', 'brandName', 'category', 'city', 'firstName', 'id', 'identifiers',
'lastName', 'locality', 'name', 'nameEn', 'names', 'names.acronymFr', 'names.id', 'names.nameEn', 'names.officialName',
'names.otherNames', 'names.shortName', 'names.usualName', 'officialName', 'otherNames', 'shortName'],
'names.otherNames', 'names.shortName', 'names.usualName', 'officialName', 'otherNames', 'otherNamesEn', 'otherNamesFr', 'shortName'],
},
}],
},
Expand Down
2 changes: 1 addition & 1 deletion src/openapi/parameters/ids/dataset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: dataset
in: path
schema:
type: string
enum: ["biatss", "education", "finance", "master", "master-mentions", "population", "real-estate"]
enum: ["biatss", "education", "finance", "inserpro", "master", "master-mentions", "piaweb", "piaweb-paysage", "population", "population-statistics", "real-estate", "tmm-mentions", "tmm-trainings", "tranings"]
required: true
description: Dataset name to collect the keynumbers
22 changes: 1 addition & 21 deletions src/openapi/schemas/persons/enums/identifier-types.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
description: Accepted values of identifier type for a person
type: string
enum:
- Code Insee
- cvHal
- dataESR
- fundref
- GA OAD
- GRID
- Id unité CNRS
- Identifiant BnF
- Identifiant CTI de l'école
- idHal
- idRef
- ISIL
- isni
- Numéro d'ED
- Numéro national de Thèse
- OpenCorporates ID
- ORCID Id
- orgref
- PIC (Participant Identification Code)
- RCR
- Référence projet PIA (ANR)
- RNA
- ROR
- Siret
- These
- UAI
- scopus
- Univ-droit jurist ID
- Web of Science Researcher ID
- Wikidata
- WOS
12 changes: 2 additions & 10 deletions src/openapi/schemas/structures/enums/identifier-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ description: Accepted values of identifier type for a structure
type: string
enum:
- BibId
- Code Insee
- dataESR
- ESGBU
- ETER
- EtId
- finess
- fundref
- GA OAD
- GRID
Expand All @@ -19,22 +17,16 @@ enum:
- ISIL
- isni
- Numéro d'ED
- Numéro national de Thèse
- OAD
- OC
- OpenCorporates ID
- ORCID Id
- orgref
- PIC (Participant Identification Code)
- RCR
- Référence projet PIA (ANR)
- ringgold
- RNA
- RNSR
- ROR
- SdId
- Siret
- UAI
- Univ-droit jurist ID
- Web of Science Researcher ID
- Wikidata
- WOS

0 comments on commit addfeac

Please sign in to comment.