mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 01:23:49 +01:00
missed bad request for password reset request
This commit is contained in:
parent
2bbf404bae
commit
3917892c58
@ -17,11 +17,11 @@ func newForgetPasswordHandler() *forgetPasswordHandler {
|
||||
func (handler *forgetPasswordHandler) Handle(params account.ForgotPasswordParams) middleware.Responder {
|
||||
if params.Body == nil || params.Body.Email == "" {
|
||||
logrus.Errorf("missing email")
|
||||
return account.NewInviteBadRequest()
|
||||
return account.NewForgotPasswordBadRequest()
|
||||
}
|
||||
if !util.IsValidEmail(params.Body.Email) {
|
||||
logrus.Errorf("'%v' is not a valid email address", params.Body.Email)
|
||||
return account.NewInviteBadRequest()
|
||||
return account.NewForgotPasswordBadRequest()
|
||||
}
|
||||
logrus.Infof("received forgot password request for email '%v'", params.Body.Email)
|
||||
var token string
|
||||
|
@ -26,6 +26,12 @@ func (o *ForgotPasswordReader) ReadResponse(response runtime.ClientResponse, con
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewForgotPasswordBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewForgotPasswordInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
@ -88,6 +94,57 @@ func (o *ForgotPasswordCreated) readResponse(response runtime.ClientResponse, co
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewForgotPasswordBadRequest creates a ForgotPasswordBadRequest with default headers values
|
||||
func NewForgotPasswordBadRequest() *ForgotPasswordBadRequest {
|
||||
return &ForgotPasswordBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPasswordBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
forgot password request not created
|
||||
*/
|
||||
type ForgotPasswordBadRequest struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this forgot password bad request response has a 2xx status code
|
||||
func (o *ForgotPasswordBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this forgot password bad request response has a 3xx status code
|
||||
func (o *ForgotPasswordBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this forgot password bad request response has a 4xx status code
|
||||
func (o *ForgotPasswordBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this forgot password bad request response has a 5xx status code
|
||||
func (o *ForgotPasswordBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this forgot password bad request response a status code equal to that given
|
||||
func (o *ForgotPasswordBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordBadRequest ", 400)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordBadRequest ", 400)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewForgotPasswordInternalServerError creates a ForgotPasswordInternalServerError with default headers values
|
||||
func NewForgotPasswordInternalServerError() *ForgotPasswordInternalServerError {
|
||||
return &ForgotPasswordInternalServerError{}
|
||||
|
@ -241,6 +241,9 @@ func init() {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
@ -1484,6 +1487,9 @@ func init() {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
|
@ -36,6 +36,31 @@ func (o *ForgotPasswordCreated) WriteResponse(rw http.ResponseWriter, producer r
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
// ForgotPasswordBadRequestCode is the HTTP code returned for type ForgotPasswordBadRequest
|
||||
const ForgotPasswordBadRequestCode int = 400
|
||||
|
||||
/*
|
||||
ForgotPasswordBadRequest forgot password request not created
|
||||
|
||||
swagger:response forgotPasswordBadRequest
|
||||
*/
|
||||
type ForgotPasswordBadRequest struct {
|
||||
}
|
||||
|
||||
// NewForgotPasswordBadRequest creates ForgotPasswordBadRequest with default headers values
|
||||
func NewForgotPasswordBadRequest() *ForgotPasswordBadRequest {
|
||||
|
||||
return &ForgotPasswordBadRequest{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ForgotPasswordBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(400)
|
||||
}
|
||||
|
||||
// ForgotPasswordInternalServerErrorCode is the HTTP code returned for type ForgotPasswordInternalServerError
|
||||
const ForgotPasswordInternalServerErrorCode int = 500
|
||||
|
||||
|
@ -28,6 +28,8 @@ paths:
|
||||
responses:
|
||||
201:
|
||||
description: forgot password request created
|
||||
400:
|
||||
description: forgot password request not created
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user