vigiloauth/vigilo
Add endpoint to allow users to set security questions during registration
開放
#370 建立於 2025年6月3日
admin-uifeaturegood first issuepriority: medium
倉庫指標
- 星標
- (100 顆星)
- PR 合併指標
- (PR 指標待抓取)
描述
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.