lib/api/members/members_models/password_change_request.go

100 lines
2.5 KiB
Go
Raw Normal View History

// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package members_models
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
// PasswordChangeRequest Secret-bearing request. Values are never logged, stored raw, echoed, or generated into response models.
//
// swagger:model PasswordChangeRequest
type PasswordChangeRequest struct {
// Plaintext current password; verified only in memory and never logged.
// Required: true
// Format: password
CurrentPassword *strfmt.Password `json:"currentPassword"`
// Plaintext new password; Members enforces 12-64 valid UTF-8 bytes.
// Required: true
// Format: password
NewPassword *strfmt.Password `json:"newPassword"`
}
// Validate validates this password change request
func (m *PasswordChangeRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCurrentPassword(formats); err != nil {
res = append(res, err)
}
if err := m.validateNewPassword(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PasswordChangeRequest) validateCurrentPassword(formats strfmt.Registry) error {
if err := validate.Required("currentPassword", "body", m.CurrentPassword); err != nil {
return err
}
if err := validate.FormatOf("currentPassword", "body", "password", m.CurrentPassword.String(), formats); err != nil {
return err
}
return nil
}
func (m *PasswordChangeRequest) validateNewPassword(formats strfmt.Registry) error {
if err := validate.Required("newPassword", "body", m.NewPassword); err != nil {
return err
}
if err := validate.FormatOf("newPassword", "body", "password", m.NewPassword.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this password change request based on context it is used
func (m *PasswordChangeRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PasswordChangeRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PasswordChangeRequest) UnmarshalBinary(b []byte) error {
var res PasswordChangeRequest
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}