mirror of
https://github.com/openziti/zrok.git
synced 2024-11-22 16:13:47 +01:00
Merge pull request #568 from openziti/reset_to_regenerate
reset token -> regenerate token (#191)
This commit is contained in:
commit
c9a9b27359
@ -47,10 +47,10 @@ func Run(inCfg *config.Config) error {
|
||||
api.AccountChangePasswordHandler = newChangePasswordHandler(cfg)
|
||||
api.AccountInviteHandler = newInviteHandler(cfg)
|
||||
api.AccountLoginHandler = account.LoginHandlerFunc(loginHandler)
|
||||
api.AccountRegenerateTokenHandler = newRegenerateTokenHandler()
|
||||
api.AccountRegisterHandler = newRegisterHandler(cfg)
|
||||
api.AccountResetPasswordHandler = newResetPasswordHandler(cfg)
|
||||
api.AccountResetPasswordRequestHandler = newResetPasswordRequestHandler()
|
||||
api.AccountResetTokenHandler = newResetTokenHandler()
|
||||
api.AccountVerifyHandler = newVerifyHandler()
|
||||
api.AdminCreateFrontendHandler = newCreateFrontendHandler()
|
||||
api.AdminCreateIdentityHandler = newCreateIdentityHandler()
|
||||
|
@ -7,57 +7,57 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type resetTokenHandler struct{}
|
||||
type regenerateTokenHandler struct{}
|
||||
|
||||
func newResetTokenHandler() *resetTokenHandler {
|
||||
return &resetTokenHandler{}
|
||||
func newRegenerateTokenHandler() *regenerateTokenHandler {
|
||||
return ®enerateTokenHandler{}
|
||||
}
|
||||
|
||||
func (handler *resetTokenHandler) Handle(params account.ResetTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
func (handler *regenerateTokenHandler) Handle(params account.RegenerateTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
logrus.Infof("received token regeneration request for email '%v'", principal.Email)
|
||||
|
||||
if params.Body.EmailAddress != principal.Email {
|
||||
logrus.Errorf("mismatched account '%v' for '%v'", params.Body.EmailAddress, principal.Email)
|
||||
return account.NewResetTokenNotFound()
|
||||
return account.NewRegenerateTokenNotFound()
|
||||
}
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Errorf("error starting transaction for '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetTokenInternalServerError()
|
||||
return account.NewRegenerateTokenInternalServerError()
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
a, err := str.FindAccountWithEmail(params.Body.EmailAddress, tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error finding account for '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetTokenNotFound()
|
||||
return account.NewRegenerateTokenNotFound()
|
||||
}
|
||||
if a.Deleted {
|
||||
logrus.Errorf("account '%v' for '%v' deleted", a.Email, a.Token)
|
||||
return account.NewResetTokenNotFound()
|
||||
return account.NewRegenerateTokenNotFound()
|
||||
}
|
||||
|
||||
// Need to create new token and invalidate all other resources
|
||||
token, err := CreateToken()
|
||||
if err != nil {
|
||||
logrus.Errorf("error creating token for request '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetTokenInternalServerError()
|
||||
return account.NewRegenerateTokenInternalServerError()
|
||||
}
|
||||
|
||||
a.Token = token
|
||||
|
||||
if _, err := str.UpdateAccount(a, tx); err != nil {
|
||||
logrus.Errorf("error updating account for request '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetTokenInternalServerError()
|
||||
return account.NewRegenerateTokenInternalServerError()
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Errorf("error committing '%v' (%v): %v", params.Body.EmailAddress, a.Email, err)
|
||||
return account.NewResetTokenInternalServerError()
|
||||
return account.NewRegenerateTokenInternalServerError()
|
||||
}
|
||||
|
||||
logrus.Infof("regenerated token '%v' for '%v'", a.Token, a.Email)
|
||||
|
||||
return account.NewResetTokenOK().WithPayload(&account.ResetTokenOKBody{Token: token})
|
||||
return account.NewRegenerateTokenOK().WithPayload(&account.RegenerateTokenOKBody{Token: token})
|
||||
}
|
@ -36,14 +36,14 @@ type ClientService interface {
|
||||
|
||||
Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error)
|
||||
|
||||
RegenerateToken(params *RegenerateTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RegenerateTokenOK, error)
|
||||
|
||||
Register(params *RegisterParams, opts ...ClientOption) (*RegisterOK, error)
|
||||
|
||||
ResetPassword(params *ResetPasswordParams, opts ...ClientOption) (*ResetPasswordOK, error)
|
||||
|
||||
ResetPasswordRequest(params *ResetPasswordRequestParams, opts ...ClientOption) (*ResetPasswordRequestCreated, error)
|
||||
|
||||
ResetToken(params *ResetTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ResetTokenOK, error)
|
||||
|
||||
Verify(params *VerifyParams, opts ...ClientOption) (*VerifyOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
@ -164,6 +164,45 @@ func (a *Client) Login(params *LoginParams, opts ...ClientOption) (*LoginOK, err
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateToken regenerate token API
|
||||
*/
|
||||
func (a *Client) RegenerateToken(params *RegenerateTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RegenerateTokenOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewRegenerateTokenParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "regenerateToken",
|
||||
Method: "POST",
|
||||
PathPattern: "/regenerateToken",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &RegenerateTokenReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*RegenerateTokenOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for regenerateToken: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Register register API
|
||||
*/
|
||||
@ -278,45 +317,6 @@ func (a *Client) ResetPasswordRequest(params *ResetPasswordRequestParams, opts .
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ResetToken reset token API
|
||||
*/
|
||||
func (a *Client) ResetToken(params *ResetTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ResetTokenOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewResetTokenParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "resetToken",
|
||||
Method: "POST",
|
||||
PathPattern: "/resetToken",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ResetTokenReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ResetTokenOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for resetToken: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Verify verify API
|
||||
*/
|
||||
|
146
rest_client_zrok/account/regenerate_token_parameters.go
Normal file
146
rest_client_zrok/account/regenerate_token_parameters.go
Normal file
@ -0,0 +1,146 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewRegenerateTokenParams creates a new RegenerateTokenParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewRegenerateTokenParams() *RegenerateTokenParams {
|
||||
return &RegenerateTokenParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewRegenerateTokenParamsWithTimeout creates a new RegenerateTokenParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewRegenerateTokenParamsWithTimeout(timeout time.Duration) *RegenerateTokenParams {
|
||||
return &RegenerateTokenParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewRegenerateTokenParamsWithContext creates a new RegenerateTokenParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewRegenerateTokenParamsWithContext(ctx context.Context) *RegenerateTokenParams {
|
||||
return &RegenerateTokenParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewRegenerateTokenParamsWithHTTPClient creates a new RegenerateTokenParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewRegenerateTokenParamsWithHTTPClient(client *http.Client) *RegenerateTokenParams {
|
||||
return &RegenerateTokenParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the regenerate token operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type RegenerateTokenParams struct {
|
||||
|
||||
// Body.
|
||||
Body RegenerateTokenBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the regenerate token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *RegenerateTokenParams) WithDefaults() *RegenerateTokenParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the regenerate token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *RegenerateTokenParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the regenerate token params
|
||||
func (o *RegenerateTokenParams) WithTimeout(timeout time.Duration) *RegenerateTokenParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the regenerate token params
|
||||
func (o *RegenerateTokenParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the regenerate token params
|
||||
func (o *RegenerateTokenParams) WithContext(ctx context.Context) *RegenerateTokenParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the regenerate token params
|
||||
func (o *RegenerateTokenParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the regenerate token params
|
||||
func (o *RegenerateTokenParams) WithHTTPClient(client *http.Client) *RegenerateTokenParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the regenerate token params
|
||||
func (o *RegenerateTokenParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the regenerate token params
|
||||
func (o *RegenerateTokenParams) WithBody(body RegenerateTokenBody) *RegenerateTokenParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the regenerate token params
|
||||
func (o *RegenerateTokenParams) SetBody(body RegenerateTokenBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *RegenerateTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
303
rest_client_zrok/account/regenerate_token_responses.go
Normal file
303
rest_client_zrok/account/regenerate_token_responses.go
Normal file
@ -0,0 +1,303 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// RegenerateTokenReader is a Reader for the RegenerateToken structure.
|
||||
type RegenerateTokenReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *RegenerateTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewRegenerateTokenOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 404:
|
||||
result := NewRegenerateTokenNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewRegenerateTokenInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /regenerateToken] regenerateToken", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewRegenerateTokenOK creates a RegenerateTokenOK with default headers values
|
||||
func NewRegenerateTokenOK() *RegenerateTokenOK {
|
||||
return &RegenerateTokenOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenOK describes a response with status code 200, with default header values.
|
||||
|
||||
regenerate account token
|
||||
*/
|
||||
type RegenerateTokenOK struct {
|
||||
Payload *RegenerateTokenOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this regenerate token o k response has a 2xx status code
|
||||
func (o *RegenerateTokenOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this regenerate token o k response has a 3xx status code
|
||||
func (o *RegenerateTokenOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this regenerate token o k response has a 4xx status code
|
||||
func (o *RegenerateTokenOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this regenerate token o k response has a 5xx status code
|
||||
func (o *RegenerateTokenOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this regenerate token o k response a status code equal to that given
|
||||
func (o *RegenerateTokenOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the regenerate token o k response
|
||||
func (o *RegenerateTokenOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenOK) Error() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenOK) String() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenOK) GetPayload() *RegenerateTokenOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(RegenerateTokenOKBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewRegenerateTokenNotFound creates a RegenerateTokenNotFound with default headers values
|
||||
func NewRegenerateTokenNotFound() *RegenerateTokenNotFound {
|
||||
return &RegenerateTokenNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
account not found
|
||||
*/
|
||||
type RegenerateTokenNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this regenerate token not found response has a 2xx status code
|
||||
func (o *RegenerateTokenNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this regenerate token not found response has a 3xx status code
|
||||
func (o *RegenerateTokenNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this regenerate token not found response has a 4xx status code
|
||||
func (o *RegenerateTokenNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this regenerate token not found response has a 5xx status code
|
||||
func (o *RegenerateTokenNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this regenerate token not found response a status code equal to that given
|
||||
func (o *RegenerateTokenNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the regenerate token not found response
|
||||
func (o *RegenerateTokenNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewRegenerateTokenInternalServerError creates a RegenerateTokenInternalServerError with default headers values
|
||||
func NewRegenerateTokenInternalServerError() *RegenerateTokenInternalServerError {
|
||||
return &RegenerateTokenInternalServerError{}
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type RegenerateTokenInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this regenerate token internal server error response has a 2xx status code
|
||||
func (o *RegenerateTokenInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this regenerate token internal server error response has a 3xx status code
|
||||
func (o *RegenerateTokenInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this regenerate token internal server error response has a 4xx status code
|
||||
func (o *RegenerateTokenInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this regenerate token internal server error response has a 5xx status code
|
||||
func (o *RegenerateTokenInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this regenerate token internal server error response a status code equal to that given
|
||||
func (o *RegenerateTokenInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the regenerate token internal server error response
|
||||
func (o *RegenerateTokenInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /regenerateToken][%d] regenerateTokenInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *RegenerateTokenInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenBody regenerate token body
|
||||
swagger:model RegenerateTokenBody
|
||||
*/
|
||||
type RegenerateTokenBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this regenerate token body
|
||||
func (o *RegenerateTokenBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this regenerate token body based on context it is used
|
||||
func (o *RegenerateTokenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *RegenerateTokenBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *RegenerateTokenBody) UnmarshalBinary(b []byte) error {
|
||||
var res RegenerateTokenBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateTokenOKBody regenerate token o k body
|
||||
swagger:model RegenerateTokenOKBody
|
||||
*/
|
||||
type RegenerateTokenOKBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this regenerate token o k body
|
||||
func (o *RegenerateTokenOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this regenerate token o k body based on context it is used
|
||||
func (o *RegenerateTokenOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *RegenerateTokenOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *RegenerateTokenOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res RegenerateTokenOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewResetTokenParams creates a new ResetTokenParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewResetTokenParams() *ResetTokenParams {
|
||||
return &ResetTokenParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetTokenParamsWithTimeout creates a new ResetTokenParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewResetTokenParamsWithTimeout(timeout time.Duration) *ResetTokenParams {
|
||||
return &ResetTokenParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetTokenParamsWithContext creates a new ResetTokenParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewResetTokenParamsWithContext(ctx context.Context) *ResetTokenParams {
|
||||
return &ResetTokenParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetTokenParamsWithHTTPClient creates a new ResetTokenParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewResetTokenParamsWithHTTPClient(client *http.Client) *ResetTokenParams {
|
||||
return &ResetTokenParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the reset token operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ResetTokenParams struct {
|
||||
|
||||
// Body.
|
||||
Body ResetTokenBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the reset token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ResetTokenParams) WithDefaults() *ResetTokenParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the reset token params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ResetTokenParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the reset token params
|
||||
func (o *ResetTokenParams) WithTimeout(timeout time.Duration) *ResetTokenParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the reset token params
|
||||
func (o *ResetTokenParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the reset token params
|
||||
func (o *ResetTokenParams) WithContext(ctx context.Context) *ResetTokenParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the reset token params
|
||||
func (o *ResetTokenParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the reset token params
|
||||
func (o *ResetTokenParams) WithHTTPClient(client *http.Client) *ResetTokenParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the reset token params
|
||||
func (o *ResetTokenParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the reset token params
|
||||
func (o *ResetTokenParams) WithBody(body ResetTokenBody) *ResetTokenParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the reset token params
|
||||
func (o *ResetTokenParams) SetBody(body ResetTokenBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ResetTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,303 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ResetTokenReader is a Reader for the ResetToken structure.
|
||||
type ResetTokenReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ResetTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewResetTokenOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 404:
|
||||
result := NewResetTokenNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewResetTokenInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /resetToken] resetToken", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetTokenOK creates a ResetTokenOK with default headers values
|
||||
func NewResetTokenOK() *ResetTokenOK {
|
||||
return &ResetTokenOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenOK describes a response with status code 200, with default header values.
|
||||
|
||||
token reset
|
||||
*/
|
||||
type ResetTokenOK struct {
|
||||
Payload *ResetTokenOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset token o k response has a 2xx status code
|
||||
func (o *ResetTokenOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset token o k response has a 3xx status code
|
||||
func (o *ResetTokenOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset token o k response has a 4xx status code
|
||||
func (o *ResetTokenOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset token o k response has a 5xx status code
|
||||
func (o *ResetTokenOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset token o k response a status code equal to that given
|
||||
func (o *ResetTokenOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the reset token o k response
|
||||
func (o *ResetTokenOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ResetTokenOK) Error() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ResetTokenOK) String() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ResetTokenOK) GetPayload() *ResetTokenOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ResetTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(ResetTokenOKBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewResetTokenNotFound creates a ResetTokenNotFound with default headers values
|
||||
func NewResetTokenNotFound() *ResetTokenNotFound {
|
||||
return &ResetTokenNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
account not found
|
||||
*/
|
||||
type ResetTokenNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset token not found response has a 2xx status code
|
||||
func (o *ResetTokenNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset token not found response has a 3xx status code
|
||||
func (o *ResetTokenNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset token not found response has a 4xx status code
|
||||
func (o *ResetTokenNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset token not found response has a 5xx status code
|
||||
func (o *ResetTokenNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset token not found response a status code equal to that given
|
||||
func (o *ResetTokenNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the reset token not found response
|
||||
func (o *ResetTokenNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *ResetTokenNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *ResetTokenNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenNotFound ", 404)
|
||||
}
|
||||
|
||||
func (o *ResetTokenNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewResetTokenInternalServerError creates a ResetTokenInternalServerError with default headers values
|
||||
func NewResetTokenInternalServerError() *ResetTokenInternalServerError {
|
||||
return &ResetTokenInternalServerError{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type ResetTokenInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset token internal server error response has a 2xx status code
|
||||
func (o *ResetTokenInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset token internal server error response has a 3xx status code
|
||||
func (o *ResetTokenInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset token internal server error response has a 4xx status code
|
||||
func (o *ResetTokenInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset token internal server error response has a 5xx status code
|
||||
func (o *ResetTokenInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset token internal server error response a status code equal to that given
|
||||
func (o *ResetTokenInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
// Code gets the status code for the reset token internal server error response
|
||||
func (o *ResetTokenInternalServerError) Code() int {
|
||||
return 500
|
||||
}
|
||||
|
||||
func (o *ResetTokenInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ResetTokenInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /resetToken][%d] resetTokenInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ResetTokenInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenBody reset token body
|
||||
swagger:model ResetTokenBody
|
||||
*/
|
||||
type ResetTokenBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset token body
|
||||
func (o *ResetTokenBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset token body based on context it is used
|
||||
func (o *ResetTokenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetTokenBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetTokenBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetTokenBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
ResetTokenOKBody reset token o k body
|
||||
swagger:model ResetTokenOKBody
|
||||
*/
|
||||
type ResetTokenOKBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset token o k body
|
||||
func (o *ResetTokenOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset token o k body based on context it is used
|
||||
func (o *ResetTokenOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetTokenOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetTokenOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetTokenOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -771,6 +771,50 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/regenerateToken": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "regenerateToken",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "regenerate account token",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "account not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/register": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -874,50 +918,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/resetToken": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "resetToken",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "token reset",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "account not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/share": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -2498,6 +2498,50 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/regenerateToken": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "regenerateToken",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "regenerate account token",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "account not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/register": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -2601,50 +2645,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/resetToken": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "resetToken",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "token reset",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "account not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/share": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
148
rest_server_zrok/operations/account/regenerate_token.go
Normal file
148
rest_server_zrok/operations/account/regenerate_token.go
Normal file
@ -0,0 +1,148 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// RegenerateTokenHandlerFunc turns a function with the right signature into a regenerate token handler
|
||||
type RegenerateTokenHandlerFunc func(RegenerateTokenParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn RegenerateTokenHandlerFunc) Handle(params RegenerateTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// RegenerateTokenHandler interface for that can handle valid regenerate token params
|
||||
type RegenerateTokenHandler interface {
|
||||
Handle(RegenerateTokenParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewRegenerateToken creates a new http.Handler for the regenerate token operation
|
||||
func NewRegenerateToken(ctx *middleware.Context, handler RegenerateTokenHandler) *RegenerateToken {
|
||||
return &RegenerateToken{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
RegenerateToken swagger:route POST /regenerateToken account regenerateToken
|
||||
|
||||
RegenerateToken regenerate token API
|
||||
*/
|
||||
type RegenerateToken struct {
|
||||
Context *middleware.Context
|
||||
Handler RegenerateTokenHandler
|
||||
}
|
||||
|
||||
func (o *RegenerateToken) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewRegenerateTokenParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *rest_model_zrok.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// RegenerateTokenBody regenerate token body
|
||||
//
|
||||
// swagger:model RegenerateTokenBody
|
||||
type RegenerateTokenBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this regenerate token body
|
||||
func (o *RegenerateTokenBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this regenerate token body based on context it is used
|
||||
func (o *RegenerateTokenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *RegenerateTokenBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *RegenerateTokenBody) UnmarshalBinary(b []byte) error {
|
||||
var res RegenerateTokenBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegenerateTokenOKBody regenerate token o k body
|
||||
//
|
||||
// swagger:model RegenerateTokenOKBody
|
||||
type RegenerateTokenOKBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this regenerate token o k body
|
||||
func (o *RegenerateTokenOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this regenerate token o k body based on context it is used
|
||||
func (o *RegenerateTokenOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *RegenerateTokenOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *RegenerateTokenOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res RegenerateTokenOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -14,19 +14,19 @@ import (
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewResetTokenParams creates a new ResetTokenParams object
|
||||
// NewRegenerateTokenParams creates a new RegenerateTokenParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewResetTokenParams() ResetTokenParams {
|
||||
func NewRegenerateTokenParams() RegenerateTokenParams {
|
||||
|
||||
return ResetTokenParams{}
|
||||
return RegenerateTokenParams{}
|
||||
}
|
||||
|
||||
// ResetTokenParams contains all the bound params for the reset token operation
|
||||
// RegenerateTokenParams contains all the bound params for the regenerate token operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters resetToken
|
||||
type ResetTokenParams struct {
|
||||
// swagger:parameters regenerateToken
|
||||
type RegenerateTokenParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
@ -34,21 +34,21 @@ type ResetTokenParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body ResetTokenBody
|
||||
Body RegenerateTokenBody
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewResetTokenParams() beforehand.
|
||||
func (o *ResetTokenParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
// To ensure default values, the struct must have been initialized with NewRegenerateTokenParams() beforehand.
|
||||
func (o *RegenerateTokenParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body ResetTokenBody
|
||||
var body RegenerateTokenBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
@ -0,0 +1,107 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
)
|
||||
|
||||
// RegenerateTokenOKCode is the HTTP code returned for type RegenerateTokenOK
|
||||
const RegenerateTokenOKCode int = 200
|
||||
|
||||
/*
|
||||
RegenerateTokenOK regenerate account token
|
||||
|
||||
swagger:response regenerateTokenOK
|
||||
*/
|
||||
type RegenerateTokenOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *RegenerateTokenOKBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewRegenerateTokenOK creates RegenerateTokenOK with default headers values
|
||||
func NewRegenerateTokenOK() *RegenerateTokenOK {
|
||||
|
||||
return &RegenerateTokenOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the regenerate token o k response
|
||||
func (o *RegenerateTokenOK) WithPayload(payload *RegenerateTokenOKBody) *RegenerateTokenOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the regenerate token o k response
|
||||
func (o *RegenerateTokenOK) SetPayload(payload *RegenerateTokenOKBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RegenerateTokenOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RegenerateTokenNotFoundCode is the HTTP code returned for type RegenerateTokenNotFound
|
||||
const RegenerateTokenNotFoundCode int = 404
|
||||
|
||||
/*
|
||||
RegenerateTokenNotFound account not found
|
||||
|
||||
swagger:response regenerateTokenNotFound
|
||||
*/
|
||||
type RegenerateTokenNotFound struct {
|
||||
}
|
||||
|
||||
// NewRegenerateTokenNotFound creates RegenerateTokenNotFound with default headers values
|
||||
func NewRegenerateTokenNotFound() *RegenerateTokenNotFound {
|
||||
|
||||
return &RegenerateTokenNotFound{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RegenerateTokenNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(404)
|
||||
}
|
||||
|
||||
// RegenerateTokenInternalServerErrorCode is the HTTP code returned for type RegenerateTokenInternalServerError
|
||||
const RegenerateTokenInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
RegenerateTokenInternalServerError internal server error
|
||||
|
||||
swagger:response regenerateTokenInternalServerError
|
||||
*/
|
||||
type RegenerateTokenInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewRegenerateTokenInternalServerError creates RegenerateTokenInternalServerError with default headers values
|
||||
func NewRegenerateTokenInternalServerError() *RegenerateTokenInternalServerError {
|
||||
|
||||
return &RegenerateTokenInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *RegenerateTokenInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@ -11,15 +11,15 @@ import (
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// ResetTokenURL generates an URL for the reset token operation
|
||||
type ResetTokenURL struct {
|
||||
// RegenerateTokenURL generates an URL for the regenerate token operation
|
||||
type RegenerateTokenURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *ResetTokenURL) WithBasePath(bp string) *ResetTokenURL {
|
||||
func (o *RegenerateTokenURL) WithBasePath(bp string) *RegenerateTokenURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
@ -27,15 +27,15 @@ func (o *ResetTokenURL) WithBasePath(bp string) *ResetTokenURL {
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *ResetTokenURL) SetBasePath(bp string) {
|
||||
func (o *RegenerateTokenURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ResetTokenURL) Build() (*url.URL, error) {
|
||||
func (o *RegenerateTokenURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/resetToken"
|
||||
var _path = "/regenerateToken"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@ -47,7 +47,7 @@ func (o *ResetTokenURL) Build() (*url.URL, error) {
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *ResetTokenURL) Must(u *url.URL, err error) *url.URL {
|
||||
func (o *RegenerateTokenURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -58,17 +58,17 @@ func (o *ResetTokenURL) Must(u *url.URL, err error) *url.URL {
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *ResetTokenURL) String() string {
|
||||
func (o *RegenerateTokenURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ResetTokenURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
func (o *RegenerateTokenURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ResetTokenURL")
|
||||
return nil, errors.New("scheme is required for a full url on RegenerateTokenURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ResetTokenURL")
|
||||
return nil, errors.New("host is required for a full url on RegenerateTokenURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
@ -82,6 +82,6 @@ func (o *ResetTokenURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *ResetTokenURL) StringFull(scheme, host string) string {
|
||||
func (o *RegenerateTokenURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ResetTokenHandlerFunc turns a function with the right signature into a reset token handler
|
||||
type ResetTokenHandlerFunc func(ResetTokenParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ResetTokenHandlerFunc) Handle(params ResetTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// ResetTokenHandler interface for that can handle valid reset token params
|
||||
type ResetTokenHandler interface {
|
||||
Handle(ResetTokenParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewResetToken creates a new http.Handler for the reset token operation
|
||||
func NewResetToken(ctx *middleware.Context, handler ResetTokenHandler) *ResetToken {
|
||||
return &ResetToken{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetToken swagger:route POST /resetToken account resetToken
|
||||
|
||||
ResetToken reset token API
|
||||
*/
|
||||
type ResetToken struct {
|
||||
Context *middleware.Context
|
||||
Handler ResetTokenHandler
|
||||
}
|
||||
|
||||
func (o *ResetToken) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewResetTokenParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *rest_model_zrok.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// ResetTokenBody reset token body
|
||||
//
|
||||
// swagger:model ResetTokenBody
|
||||
type ResetTokenBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset token body
|
||||
func (o *ResetTokenBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset token body based on context it is used
|
||||
func (o *ResetTokenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetTokenBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetTokenBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetTokenBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResetTokenOKBody reset token o k body
|
||||
//
|
||||
// swagger:model ResetTokenOKBody
|
||||
type ResetTokenOKBody struct {
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset token o k body
|
||||
func (o *ResetTokenOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset token o k body based on context it is used
|
||||
func (o *ResetTokenOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetTokenOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetTokenOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetTokenOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package account
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
)
|
||||
|
||||
// ResetTokenOKCode is the HTTP code returned for type ResetTokenOK
|
||||
const ResetTokenOKCode int = 200
|
||||
|
||||
/*
|
||||
ResetTokenOK token reset
|
||||
|
||||
swagger:response resetTokenOK
|
||||
*/
|
||||
type ResetTokenOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *ResetTokenOKBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewResetTokenOK creates ResetTokenOK with default headers values
|
||||
func NewResetTokenOK() *ResetTokenOK {
|
||||
|
||||
return &ResetTokenOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the reset token o k response
|
||||
func (o *ResetTokenOK) WithPayload(payload *ResetTokenOKBody) *ResetTokenOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the reset token o k response
|
||||
func (o *ResetTokenOK) SetPayload(payload *ResetTokenOKBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetTokenOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ResetTokenNotFoundCode is the HTTP code returned for type ResetTokenNotFound
|
||||
const ResetTokenNotFoundCode int = 404
|
||||
|
||||
/*
|
||||
ResetTokenNotFound account not found
|
||||
|
||||
swagger:response resetTokenNotFound
|
||||
*/
|
||||
type ResetTokenNotFound struct {
|
||||
}
|
||||
|
||||
// NewResetTokenNotFound creates ResetTokenNotFound with default headers values
|
||||
func NewResetTokenNotFound() *ResetTokenNotFound {
|
||||
|
||||
return &ResetTokenNotFound{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetTokenNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(404)
|
||||
}
|
||||
|
||||
// ResetTokenInternalServerErrorCode is the HTTP code returned for type ResetTokenInternalServerError
|
||||
const ResetTokenInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
ResetTokenInternalServerError internal server error
|
||||
|
||||
swagger:response resetTokenInternalServerError
|
||||
*/
|
||||
type ResetTokenInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewResetTokenInternalServerError creates ResetTokenInternalServerError with default headers values
|
||||
func NewResetTokenInternalServerError() *ResetTokenInternalServerError {
|
||||
|
||||
return &ResetTokenInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetTokenInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@ -109,6 +109,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
MetadataOverviewHandler: metadata.OverviewHandlerFunc(func(params metadata.OverviewParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.Overview has not yet been implemented")
|
||||
}),
|
||||
AccountRegenerateTokenHandler: account.RegenerateTokenHandlerFunc(func(params account.RegenerateTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.RegenerateToken has not yet been implemented")
|
||||
}),
|
||||
AccountRegisterHandler: account.RegisterHandlerFunc(func(params account.RegisterParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Register has not yet been implemented")
|
||||
}),
|
||||
@ -118,9 +121,6 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AccountResetPasswordRequestHandler: account.ResetPasswordRequestHandlerFunc(func(params account.ResetPasswordRequestParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ResetPasswordRequest has not yet been implemented")
|
||||
}),
|
||||
AccountResetTokenHandler: account.ResetTokenHandlerFunc(func(params account.ResetTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ResetToken has not yet been implemented")
|
||||
}),
|
||||
ShareShareHandler: share.ShareHandlerFunc(func(params share.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation share.Share has not yet been implemented")
|
||||
}),
|
||||
@ -232,14 +232,14 @@ type ZrokAPI struct {
|
||||
AccountLoginHandler account.LoginHandler
|
||||
// MetadataOverviewHandler sets the operation handler for the overview operation
|
||||
MetadataOverviewHandler metadata.OverviewHandler
|
||||
// AccountRegenerateTokenHandler sets the operation handler for the regenerate token operation
|
||||
AccountRegenerateTokenHandler account.RegenerateTokenHandler
|
||||
// AccountRegisterHandler sets the operation handler for the register operation
|
||||
AccountRegisterHandler account.RegisterHandler
|
||||
// AccountResetPasswordHandler sets the operation handler for the reset password operation
|
||||
AccountResetPasswordHandler account.ResetPasswordHandler
|
||||
// AccountResetPasswordRequestHandler sets the operation handler for the reset password request operation
|
||||
AccountResetPasswordRequestHandler account.ResetPasswordRequestHandler
|
||||
// AccountResetTokenHandler sets the operation handler for the reset token operation
|
||||
AccountResetTokenHandler account.ResetTokenHandler
|
||||
// ShareShareHandler sets the operation handler for the share operation
|
||||
ShareShareHandler share.ShareHandler
|
||||
// ShareUnaccessHandler sets the operation handler for the unaccess operation
|
||||
@ -395,6 +395,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.MetadataOverviewHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.OverviewHandler")
|
||||
}
|
||||
if o.AccountRegenerateTokenHandler == nil {
|
||||
unregistered = append(unregistered, "account.RegenerateTokenHandler")
|
||||
}
|
||||
if o.AccountRegisterHandler == nil {
|
||||
unregistered = append(unregistered, "account.RegisterHandler")
|
||||
}
|
||||
@ -404,9 +407,6 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AccountResetPasswordRequestHandler == nil {
|
||||
unregistered = append(unregistered, "account.ResetPasswordRequestHandler")
|
||||
}
|
||||
if o.AccountResetTokenHandler == nil {
|
||||
unregistered = append(unregistered, "account.ResetTokenHandler")
|
||||
}
|
||||
if o.ShareShareHandler == nil {
|
||||
unregistered = append(unregistered, "share.ShareHandler")
|
||||
}
|
||||
@ -610,6 +610,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/regenerateToken"] = account.NewRegenerateToken(o.context, o.AccountRegenerateTokenHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/register"] = account.NewRegister(o.context, o.AccountRegisterHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@ -622,10 +626,6 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/resetToken"] = account.NewResetToken(o.context, o.AccountResetTokenHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/share"] = share.NewShare(o.context, o.ShareShareHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
|
@ -1 +1 @@
|
||||
3.0.52
|
||||
3.0.51
|
@ -55,11 +55,11 @@ from zrok_api.models.password_requirements import PasswordRequirements
|
||||
from zrok_api.models.principal import Principal
|
||||
from zrok_api.models.public_frontend import PublicFrontend
|
||||
from zrok_api.models.public_frontend_list import PublicFrontendList
|
||||
from zrok_api.models.regenerate_token_body import RegenerateTokenBody
|
||||
from zrok_api.models.register_request import RegisterRequest
|
||||
from zrok_api.models.register_response import RegisterResponse
|
||||
from zrok_api.models.reset_password_request import ResetPasswordRequest
|
||||
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
|
||||
from zrok_api.models.reset_token_body import ResetTokenBody
|
||||
from zrok_api.models.share import Share
|
||||
from zrok_api.models.share_request import ShareRequest
|
||||
from zrok_api.models.share_response import ShareResponse
|
||||
|
@ -311,6 +311,99 @@ class AccountApi(object):
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def regenerate_token(self, **kwargs): # noqa: E501
|
||||
"""regenerate_token # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.regenerate_token(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param RegenerateTokenBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async_req'):
|
||||
return self.regenerate_token_with_http_info(**kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.regenerate_token_with_http_info(**kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def regenerate_token_with_http_info(self, **kwargs): # noqa: E501
|
||||
"""regenerate_token # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.regenerate_token_with_http_info(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param RegenerateTokenBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
|
||||
params = locals()
|
||||
for key, val in six.iteritems(params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method regenerate_token" % key
|
||||
)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = []
|
||||
|
||||
header_params = {}
|
||||
|
||||
form_params = []
|
||||
local_var_files = {}
|
||||
|
||||
body_params = None
|
||||
if 'body' in params:
|
||||
body_params = params['body']
|
||||
# HTTP header `Accept`
|
||||
header_params['Accept'] = self.api_client.select_header_accept(
|
||||
['application/zrok.v1+json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
||||
['application/zrok.v1+json']) # noqa: E501
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['key'] # noqa: E501
|
||||
|
||||
return self.api_client.call_api(
|
||||
'/regenerateToken', 'POST',
|
||||
path_params,
|
||||
query_params,
|
||||
header_params,
|
||||
body=body_params,
|
||||
post_params=form_params,
|
||||
files=local_var_files,
|
||||
response_type='InlineResponse200', # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async_req=params.get('async_req'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
_preload_content=params.get('_preload_content', True),
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def register(self, **kwargs): # noqa: E501
|
||||
"""register # noqa: E501
|
||||
|
||||
@ -586,99 +679,6 @@ class AccountApi(object):
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def reset_token(self, **kwargs): # noqa: E501
|
||||
"""reset_token # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.reset_token(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param ResetTokenBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async_req'):
|
||||
return self.reset_token_with_http_info(**kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.reset_token_with_http_info(**kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def reset_token_with_http_info(self, **kwargs): # noqa: E501
|
||||
"""reset_token # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.reset_token_with_http_info(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param ResetTokenBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
|
||||
all_params = ['body'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
|
||||
params = locals()
|
||||
for key, val in six.iteritems(params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method reset_token" % key
|
||||
)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = []
|
||||
|
||||
header_params = {}
|
||||
|
||||
form_params = []
|
||||
local_var_files = {}
|
||||
|
||||
body_params = None
|
||||
if 'body' in params:
|
||||
body_params = params['body']
|
||||
# HTTP header `Accept`
|
||||
header_params['Accept'] = self.api_client.select_header_accept(
|
||||
['application/zrok.v1+json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
||||
['application/zrok.v1+json']) # noqa: E501
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['key'] # noqa: E501
|
||||
|
||||
return self.api_client.call_api(
|
||||
'/resetToken', 'POST',
|
||||
path_params,
|
||||
query_params,
|
||||
header_params,
|
||||
body=body_params,
|
||||
post_params=form_params,
|
||||
files=local_var_files,
|
||||
response_type='InlineResponse200', # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async_req=params.get('async_req'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
_preload_content=params.get('_preload_content', True),
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def verify(self, **kwargs): # noqa: E501
|
||||
"""verify # noqa: E501
|
||||
|
||||
|
@ -219,12 +219,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
||||
|
||||
:return: The token for basic HTTP authentication.
|
||||
"""
|
||||
token = ""
|
||||
if self.username or self.password:
|
||||
token = urllib3.util.make_headers(
|
||||
return urllib3.util.make_headers(
|
||||
basic_auth=self.username + ':' + self.password
|
||||
).get('authorization')
|
||||
return token
|
||||
|
||||
def auth_settings(self):
|
||||
"""Gets Auth Settings dict for api client.
|
||||
|
@ -45,11 +45,11 @@ from zrok_api.models.password_requirements import PasswordRequirements
|
||||
from zrok_api.models.principal import Principal
|
||||
from zrok_api.models.public_frontend import PublicFrontend
|
||||
from zrok_api.models.public_frontend_list import PublicFrontendList
|
||||
from zrok_api.models.regenerate_token_body import RegenerateTokenBody
|
||||
from zrok_api.models.register_request import RegisterRequest
|
||||
from zrok_api.models.register_response import RegisterResponse
|
||||
from zrok_api.models.reset_password_request import ResetPasswordRequest
|
||||
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
|
||||
from zrok_api.models.reset_token_body import ResetTokenBody
|
||||
from zrok_api.models.share import Share
|
||||
from zrok_api.models.share_request import ShareRequest
|
||||
from zrok_api.models.share_response import ShareResponse
|
||||
|
@ -15,7 +15,7 @@ import re # noqa: F401
|
||||
|
||||
import six
|
||||
|
||||
class ResetTokenBody(object):
|
||||
class RegenerateTokenBody(object):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
@ -36,7 +36,7 @@ class ResetTokenBody(object):
|
||||
}
|
||||
|
||||
def __init__(self, email_address=None): # noqa: E501
|
||||
"""ResetTokenBody - a model defined in Swagger""" # noqa: E501
|
||||
"""RegenerateTokenBody - a model defined in Swagger""" # noqa: E501
|
||||
self._email_address = None
|
||||
self.discriminator = None
|
||||
if email_address is not None:
|
||||
@ -44,20 +44,20 @@ class ResetTokenBody(object):
|
||||
|
||||
@property
|
||||
def email_address(self):
|
||||
"""Gets the email_address of this ResetTokenBody. # noqa: E501
|
||||
"""Gets the email_address of this RegenerateTokenBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The email_address of this ResetTokenBody. # noqa: E501
|
||||
:return: The email_address of this RegenerateTokenBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._email_address
|
||||
|
||||
@email_address.setter
|
||||
def email_address(self, email_address):
|
||||
"""Sets the email_address of this ResetTokenBody.
|
||||
"""Sets the email_address of this RegenerateTokenBody.
|
||||
|
||||
|
||||
:param email_address: The email_address of this ResetTokenBody. # noqa: E501
|
||||
:param email_address: The email_address of this RegenerateTokenBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
@ -84,7 +84,7 @@ class ResetTokenBody(object):
|
||||
))
|
||||
else:
|
||||
result[attr] = value
|
||||
if issubclass(ResetTokenBody, dict):
|
||||
if issubclass(RegenerateTokenBody, dict):
|
||||
for key, value in self.items():
|
||||
result[key] = value
|
||||
|
||||
@ -100,7 +100,7 @@ class ResetTokenBody(object):
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Returns true if both objects are equal"""
|
||||
if not isinstance(other, ResetTokenBody):
|
||||
if not isinstance(other, RegenerateTokenBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
@ -42,11 +42,11 @@ class RESTResponse(io.IOBase):
|
||||
|
||||
def getheaders(self):
|
||||
"""Returns a dictionary of the response headers."""
|
||||
return self.urllib3_response.headers
|
||||
return self.urllib3_response.getheaders()
|
||||
|
||||
def getheader(self, name, default=None):
|
||||
"""Returns a given response header."""
|
||||
return self.urllib3_response.headers.get(name, default)
|
||||
return self.urllib3_response.getheader(name, default)
|
||||
|
||||
|
||||
class RESTClientObject(object):
|
||||
|
@ -81,6 +81,32 @@ paths:
|
||||
401:
|
||||
description: invalid login
|
||||
|
||||
/regenerateToken:
|
||||
post:
|
||||
tags:
|
||||
- account
|
||||
security:
|
||||
- key: []
|
||||
operationId: regenerateToken
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
properties:
|
||||
emailAddress:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: regenerate account token
|
||||
schema:
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
404:
|
||||
description: account not found
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/register:
|
||||
post:
|
||||
tags:
|
||||
@ -147,32 +173,6 @@ paths:
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/resetToken:
|
||||
post:
|
||||
tags:
|
||||
- account
|
||||
security:
|
||||
- key: []
|
||||
operationId: resetToken
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
properties:
|
||||
emailAddress:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: token reset
|
||||
schema:
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
404:
|
||||
description: account not found
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/verify:
|
||||
post:
|
||||
tags:
|
||||
|
@ -47,6 +47,21 @@ export function login(options) {
|
||||
return gateway.request(loginOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {object} [options.body]
|
||||
* @return {Promise<object>} regenerate account token
|
||||
*/
|
||||
export function regenerateToken(options) {
|
||||
if (!options) options = {}
|
||||
const parameters = {
|
||||
body: {
|
||||
body: options.body
|
||||
}
|
||||
}
|
||||
return gateway.request(regenerateTokenOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.registerRequest} [options.body]
|
||||
@ -92,21 +107,6 @@ export function resetPasswordRequest(options) {
|
||||
return gateway.request(resetPasswordRequestOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {object} [options.body]
|
||||
* @return {Promise<object>} token reset
|
||||
*/
|
||||
export function resetToken(options) {
|
||||
if (!options) options = {}
|
||||
const parameters = {
|
||||
body: {
|
||||
body: options.body
|
||||
}
|
||||
}
|
||||
return gateway.request(resetTokenOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.verifyRequest} [options.body]
|
||||
@ -145,6 +145,17 @@ const loginOperation = {
|
||||
method: 'post'
|
||||
}
|
||||
|
||||
const regenerateTokenOperation = {
|
||||
path: '/regenerateToken',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
method: 'post',
|
||||
security: [
|
||||
{
|
||||
id: 'key'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const registerOperation = {
|
||||
path: '/register',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
@ -163,17 +174,6 @@ const resetPasswordRequestOperation = {
|
||||
method: 'post'
|
||||
}
|
||||
|
||||
const resetTokenOperation = {
|
||||
path: '/resetToken',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
method: 'post',
|
||||
security: [
|
||||
{
|
||||
id: 'key'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const verifyOperation = {
|
||||
path: '/verify',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
|
@ -21,7 +21,7 @@ const RegenerateToken = (props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
account.resetToken({body: {emailAddress: props.user.email}})
|
||||
account.regenerateToken({body: {emailAddress: props.user.email}})
|
||||
.then(resp => {
|
||||
console.log(resp);
|
||||
let user = JSON.parse(localStorage.getItem('user'));
|
||||
|
Loading…
Reference in New Issue
Block a user