ValidateUserPassword validates the complexity of a user password and that it is secured enough. @Summary Validate user password @ID validate-user-password @Security CoderSessionToken @Produce json @Accept json @Tags Authorization @Param request body codersdk.ValidateUserPasswordRequest true "Valida
(rw http.ResponseWriter, r *http.Request)
| 468 | // @Success 200 {object} codersdk.ValidateUserPasswordResponse |
| 469 | // @Router /api/v2/users/validate-password [post] |
| 470 | func (*API) validateUserPassword(rw http.ResponseWriter, r *http.Request) { |
| 471 | var ( |
| 472 | ctx = r.Context() |
| 473 | valid = true |
| 474 | details = "" |
| 475 | ) |
| 476 | |
| 477 | var req codersdk.ValidateUserPasswordRequest |
| 478 | if !httpapi.Read(ctx, rw, r, &req) { |
| 479 | return |
| 480 | } |
| 481 | |
| 482 | err := userpassword.Validate(req.Password) |
| 483 | if err != nil { |
| 484 | valid = false |
| 485 | details = err.Error() |
| 486 | } |
| 487 | |
| 488 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.ValidateUserPasswordResponse{ |
| 489 | Valid: valid, |
| 490 | Details: details, |
| 491 | }) |
| 492 | } |
| 493 | |
| 494 | // Authenticates the user with an email and password. |
| 495 | // |