vigiloauth/vigilo

Add endpoint to allow users to set security questions during registration

Ouverte

#370 ouverte le 3 juin 2025

 (2 commentaires) (0 réaction) (1 personne assignée)Go (9 forks)auto 404
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_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.

Guide contributeur