Skip to content

Commit

Permalink
add error message
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitSerrano committed Oct 9, 2024
1 parent eec90f8 commit a79657d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions controllers/createConfController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ const createConfWithDay = async (email, conferenceDay, userTimezoneOffset) => {
module.exports.createConf = async (req, res) => {
const confData = await oidcAuth.finishAuth(req)

const { email, durationInMinutes, conferenceDay, userTimezoneOffset } = confData
const { email, durationInMinutes, conferenceDay, userTimezoneOffset, error } = confData

if (!conferenceDay && !durationInMinutes) {
console.error("Login token contained no conferenceDay and no durationInMinutes. Cannot create conference.")
req.flash("error", "La conférence n'a pas pu être créée. Vous pouvez réessayer.")
req.flash("error", error || "La conférence n'a pas pu être créée. Vous pouvez réessayer.")
return res.redirect("/")
}

Expand Down
2 changes: 1 addition & 1 deletion lib/oidcAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ module.exports.finishAuth = async (req) => {
}
} catch(e){
console.error(`error when validating email ${email}`,e)
return { error: `L'adresse e-mail ${email} n'est pas autorisée à utiliser ce service.` }
return { error: `L'adresse e-mail ${email} n'est pas autorisée à utiliser ce service. Si vous êtes agent de l'État, contactez-nous à [email protected]` }
}

const user = {id_token: tokenSet.id_token, state: request.state}
Expand Down

0 comments on commit a79657d

Please sign in to comment.