vigiloauth/vigilo

Add endpoint to allow users to set security questions during registration

Offen

#370 geöffnet am 03.06.2025

 (2 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Go (9 Forks)auto 404
admin-uifeaturegood first issuepriority: medium

Repository-Metriken

Stars
 (100 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 162T 7h) (1 gemergte PR in 30 T)

Beschreibung

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_id corresponds 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 OK on success.
  • Return 400 Bad Request for validation errors.
  • Return 404 Not Found when the user doesn't exist with the given ID.
  • Return 500 Internal Server Error when appropriate.
  • Include basic validation: ensure both question and answer are non-empty strings.

Contributor Guide