vigiloauth/vigilo
Add endpoint to allow users to set security questions during registration
Ouverte
#370 ouverte le 3 juin 2025
admin-uifeaturegood first issuepriority: medium
Métriques du dépôt
- Stars
- (100 étoiles)
- Métriques de merge PR
- (Métriques PR en attente)
Description
Description: We need an endpoint that allows setting security questions and answers for a specific user (by user ID). This will help support account recovery and additional authentication flows in the future.
Endpoint:
- Method:
POST - Path:
/users/{user_id}/security-questions
Example Request Body:
{
"questions": [
{
"question": "What was the name of your first pet?",
"answer": "Fluffy"
},
{
"question": "What is your mother’s maiden name?",
"answer": "Smith"
}
]
}
Requirements
- Validate that the
user_idcorresponds to an existing user. - Accept a slice of 2–3 questions and answers.
- Hash the answers before saving (do not store plain text answers).
- Store them in the DB.
- Return
200 OKon success. - Return
400 Bad Requestfor validation errors. - Return
404 Not Foundwhen the user doesn't exist with the given ID. - Return
500 Internal Server Errorwhen appropriate. - Include basic validation: ensure both question and answer are non-empty strings.