mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 01:23:49 +01:00
forgot -> reset; password reset testing & tweaks (#65)
This commit is contained in:
parent
cc7516460c
commit
7d3eeff885
@ -12,7 +12,7 @@ const ConfigVersion = 1
|
||||
|
||||
type Config struct {
|
||||
V int
|
||||
Account *AccountConfig
|
||||
ResetPassword *ResetPasswordConfig
|
||||
Admin *AdminConfig
|
||||
Endpoint *EndpointConfig
|
||||
Email *EmailConfig
|
||||
@ -25,10 +25,6 @@ type Config struct {
|
||||
Ziti *ZitiConfig
|
||||
}
|
||||
|
||||
type AccountConfig struct {
|
||||
ForgotPasswordUrlTemplate string
|
||||
}
|
||||
|
||||
type AdminConfig struct {
|
||||
Secrets []string `cf:"+secret"`
|
||||
}
|
||||
@ -51,6 +47,10 @@ type RegistrationConfig struct {
|
||||
TokenStrategy string
|
||||
}
|
||||
|
||||
type ResetPasswordConfig struct {
|
||||
ResetUrlTemplate string
|
||||
}
|
||||
|
||||
type ZitiConfig struct {
|
||||
ApiEndpoint string
|
||||
Username string
|
||||
@ -69,7 +69,7 @@ type InfluxConfig struct {
|
||||
}
|
||||
|
||||
type MaintenanceConfig struct {
|
||||
Account *AccountMaintenanceConfig
|
||||
ResetPassword *ResetPasswordMaintenanceConfig
|
||||
Registration *RegistrationMaintenanceConfig
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ type RegistrationMaintenanceConfig struct {
|
||||
BatchLimit int
|
||||
}
|
||||
|
||||
type AccountMaintenanceConfig struct {
|
||||
type ResetPasswordMaintenanceConfig struct {
|
||||
ExpirationTimeout time.Duration
|
||||
CheckFrequency time.Duration
|
||||
BatchLimit int
|
||||
@ -102,7 +102,7 @@ func DefaultConfig() *Config {
|
||||
ServiceName: "metrics",
|
||||
},
|
||||
Maintenance: &MaintenanceConfig{
|
||||
Account: &AccountMaintenanceConfig{
|
||||
ResetPassword: &ResetPasswordMaintenanceConfig{
|
||||
ExpirationTimeout: time.Minute * 15,
|
||||
CheckFrequency: time.Minute * 15,
|
||||
BatchLimit: 500,
|
||||
|
@ -29,10 +29,10 @@ func Run(inCfg *Config) error {
|
||||
api := operations.NewZrokAPI(swaggerSpec)
|
||||
api.KeyAuth = newZrokAuthenticator(cfg).authenticate
|
||||
api.AccountInviteHandler = newInviteHandler(cfg)
|
||||
api.AccountForgotPasswordHandler = newForgetPasswordHandler()
|
||||
api.AccountLoginHandler = account.LoginHandlerFunc(loginHandler)
|
||||
api.AccountRegisterHandler = newRegisterHandler()
|
||||
api.AccountResetPasswordHandler = newResetPasswordHandler()
|
||||
api.AccountResetPasswordRequestHandler = newResetPasswordRequestHandler()
|
||||
api.AccountVerifyHandler = newVerifyHandler()
|
||||
api.AdminCreateFrontendHandler = newCreateFrontendHandler()
|
||||
api.AdminCreateIdentityHandler = newCreateIdentityHandler()
|
||||
@ -84,8 +84,8 @@ func Run(inCfg *Config) error {
|
||||
if cfg.Maintenance.Registration != nil {
|
||||
go newRegistrationMaintenanceAgent(ctx, cfg.Maintenance.Registration).run()
|
||||
}
|
||||
if cfg.Maintenance.Account != nil {
|
||||
go newAccountMaintenanceAgent(ctx, cfg.Maintenance.Account).run()
|
||||
if cfg.Maintenance.ResetPassword != nil {
|
||||
go newMaintenanceResetPasswordAgent(ctx, cfg.Maintenance.ResetPassword).run()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,5 @@ package emailUi
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed verify.gohtml verify.gotext forgotPassword.gohtml forgotPassword.gotext
|
||||
//go:embed verify.gohtml verify.gotext resetPassword.gohtml resetPassword.gotext
|
||||
var FS embed.FS
|
||||
|
@ -1,5 +0,0 @@
|
||||
We see you requested a forgot password request, {{ .EmailAddress }}!
|
||||
|
||||
Please click this link to change your zrok account password:
|
||||
|
||||
{{ .ForgotPasswordUrl }}
|
@ -185,8 +185,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>We see you requested a forgot password request, {{ .EmailAddress }}!</h1>
|
||||
<h1>Someone requested a password reset on your behalf, {{ .EmailAddress }}!</h1>
|
||||
<p>Please click this to change your <code>zrok</code> account password.</p>
|
||||
<div><a class="btn btn-primary" href="{{ .ForgotPasswordUrl }}">Reset Passwrod</a></div>
|
||||
<div><a class="btn btn-primary" href="{{ .Url }}">Reset Password</a></div>
|
||||
</body>
|
||||
</html>
|
5
controller/emailUi/resetPassword.gotext
Normal file
5
controller/emailUi/resetPassword.gotext
Normal file
@ -0,0 +1,5 @@
|
||||
Someone requested a password reset on your behalf, {{ .EmailAddress }}!
|
||||
|
||||
Please click this link to change your zrok account password:
|
||||
|
||||
{{ .Url }}
|
@ -1,129 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/controller/store"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
||||
"github.com/openziti/zrok/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type forgetPasswordHandler struct{}
|
||||
|
||||
func newForgetPasswordHandler() *forgetPasswordHandler {
|
||||
return &forgetPasswordHandler{}
|
||||
}
|
||||
|
||||
func (handler *forgetPasswordHandler) Handle(params account.ForgotPasswordParams) middleware.Responder {
|
||||
if params.Body == nil || params.Body.Email == "" {
|
||||
logrus.Errorf("missing email")
|
||||
return account.NewForgotPasswordBadRequest()
|
||||
}
|
||||
if !util.IsValidEmail(params.Body.Email) {
|
||||
logrus.Errorf("'%v' is not a valid email address", params.Body.Email)
|
||||
return account.NewForgotPasswordBadRequest()
|
||||
}
|
||||
logrus.Infof("received forgot password request for email '%v'", params.Body.Email)
|
||||
var token string
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewForgotPasswordInternalServerError()
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
token, err = createToken()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewForgotPasswordInternalServerError()
|
||||
}
|
||||
|
||||
acct, err := str.FindAccountWithEmail(params.Body.Email, tx)
|
||||
if err != nil {
|
||||
logrus.Infof("no account found for '%v': %v", params.Body.Email, err)
|
||||
return account.NewForgotPasswordInternalServerError()
|
||||
}
|
||||
|
||||
prr := &store.PasswordResetRequest{
|
||||
Token: token,
|
||||
AccountId: acct.Id,
|
||||
}
|
||||
|
||||
if _, err := str.CreatePasswordResetRequest(prr, tx); err != nil {
|
||||
logrus.Errorf("error creating forgot password request for '%v': %v", params.Body.Email, err)
|
||||
return account.NewInviteInternalServerError()
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Errorf("error committing forgot password request for '%v': %v", params.Body.Email, err)
|
||||
return account.NewInviteInternalServerError()
|
||||
}
|
||||
|
||||
if cfg.Email != nil && cfg.Registration != nil && cfg.Account != nil {
|
||||
if err := sendForgotPasswordEmail(acct.Email, token); err != nil {
|
||||
logrus.Errorf("error sending forgot password email for '%v': %v", acct.Email, err)
|
||||
return account.NewForgotPasswordInternalServerError()
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("'email', 'registration', and 'account' configuration missing; skipping forgot password email")
|
||||
}
|
||||
|
||||
logrus.Infof("forgot password request for '%v' has token '%v'", params.Body.Email, prr.Token)
|
||||
|
||||
return account.NewForgotPasswordCreated()
|
||||
}
|
||||
|
||||
type resetPasswordHandler struct{}
|
||||
|
||||
func newResetPasswordHandler() *resetPasswordHandler {
|
||||
return &resetPasswordHandler{}
|
||||
}
|
||||
|
||||
func (handler *resetPasswordHandler) Handle(params account.ResetPasswordParams) middleware.Responder {
|
||||
if params.Body == nil || params.Body.Token == "" || params.Body.Password == "" {
|
||||
logrus.Error("missing token or password")
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
logrus.Infof("received password reset request for token '%v'", params.Body.Token)
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
prr, err := str.FindPasswordResetRequestWithToken(params.Body.Token, tx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
|
||||
a, err := str.GetAccount(prr.AccountId, tx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
a.Password = hashPassword(params.Body.Password)
|
||||
|
||||
if _, err := str.UpdateAccount(a, tx); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
if err := str.DeletePasswordResetRequest(prr.Id, tx); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
logrus.Infof("reset password for '%v'", a.Email)
|
||||
|
||||
return account.NewResetPasswordOK()
|
||||
|
||||
}
|
@ -77,19 +77,19 @@ func (ma *maintenanceRegistrationAgent) deleteExpiredAccountRequests() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type maintenanceAccountAgent struct {
|
||||
*AccountMaintenanceConfig
|
||||
type maintenanceResetPasswordAgent struct {
|
||||
*ResetPasswordMaintenanceConfig
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func newAccountMaintenanceAgent(ctx context.Context, cfg *AccountMaintenanceConfig) *maintenanceAccountAgent {
|
||||
return &maintenanceAccountAgent{
|
||||
AccountMaintenanceConfig: cfg,
|
||||
func newMaintenanceResetPasswordAgent(ctx context.Context, cfg *ResetPasswordMaintenanceConfig) *maintenanceResetPasswordAgent {
|
||||
return &maintenanceResetPasswordAgent{
|
||||
ResetPasswordMaintenanceConfig: cfg,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
func (ma *maintenanceAccountAgent) run() {
|
||||
func (ma *maintenanceResetPasswordAgent) run() {
|
||||
logrus.Infof("starting maintenance account agent")
|
||||
defer logrus.Info("stopping maintenance account agent")
|
||||
|
||||
@ -110,7 +110,7 @@ func (ma *maintenanceAccountAgent) run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (ma *maintenanceAccountAgent) deleteExpiredForgetPasswordRequests() error {
|
||||
func (ma *maintenanceResetPasswordAgent) deleteExpiredForgetPasswordRequests() error {
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
|
60
controller/resetPassword.go
Normal file
60
controller/resetPassword.go
Normal file
@ -0,0 +1,60 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type resetPasswordHandler struct{}
|
||||
|
||||
func newResetPasswordHandler() *resetPasswordHandler {
|
||||
return &resetPasswordHandler{}
|
||||
}
|
||||
|
||||
func (handler *resetPasswordHandler) Handle(params account.ResetPasswordParams) middleware.Responder {
|
||||
if params.Body == nil || params.Body.Token == "" || params.Body.Password == "" {
|
||||
logrus.Error("missing token or password")
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
logrus.Infof("received password reset request for token '%v'", params.Body.Token)
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
prr, err := str.FindPasswordResetRequestWithToken(params.Body.Token, tx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
|
||||
a, err := str.GetAccount(prr.AccountId, tx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordNotFound()
|
||||
}
|
||||
a.Password = hashPassword(params.Body.Password)
|
||||
|
||||
if _, err := str.UpdateAccount(a, tx); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
if err := str.DeletePasswordResetRequest(prr.Id, tx); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordInternalServerError()
|
||||
}
|
||||
|
||||
logrus.Infof("reset password for '%v'", a.Email)
|
||||
|
||||
return account.NewResetPasswordOK()
|
||||
}
|
@ -11,35 +11,35 @@ import (
|
||||
"github.com/wneessen/go-mail"
|
||||
)
|
||||
|
||||
type forgotPasswordEmail struct {
|
||||
type resetPasswordEmail struct {
|
||||
EmailAddress string
|
||||
ForgotPasswordUrl string
|
||||
Url string
|
||||
}
|
||||
|
||||
func sendForgotPasswordEmail(emailAddress, token string) error {
|
||||
emailData := &forgotPasswordEmail{
|
||||
func sendResetPasswordEmail(emailAddress, token string) error {
|
||||
emailData := &resetPasswordEmail{
|
||||
EmailAddress: emailAddress,
|
||||
ForgotPasswordUrl: fmt.Sprintf("%s?token=%s", cfg.Account.ForgotPasswordUrlTemplate, token),
|
||||
Url: fmt.Sprintf("%s/%s", cfg.ResetPassword.ResetUrlTemplate, token),
|
||||
}
|
||||
|
||||
plainBody, err := emailData.mergeTemplate("forgotPassword.gotext")
|
||||
plainBody, err := emailData.mergeTemplate("resetPassword.gotext")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
htmlBody, err := emailData.mergeTemplate("forgotPassword.gohtml")
|
||||
htmlBody, err := emailData.mergeTemplate("resetPassword.gohtml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := mail.NewMsg()
|
||||
if err := msg.From(cfg.Registration.EmailFrom); err != nil {
|
||||
return errors.Wrap(err, "failed to set from address in forgot password email")
|
||||
return errors.Wrap(err, "failed to set from address in reset password email")
|
||||
}
|
||||
if err := msg.To(emailAddress); err != nil {
|
||||
return errors.Wrap(err, "failed to set to address in forgot password email")
|
||||
return errors.Wrap(err, "failed to set to address in reset password email")
|
||||
}
|
||||
|
||||
msg.Subject("zrok Forgot Password")
|
||||
msg.Subject("Password Reset Request")
|
||||
msg.SetDate()
|
||||
msg.SetMessageID()
|
||||
msg.SetBulk()
|
||||
@ -56,17 +56,17 @@ func sendForgotPasswordEmail(emailAddress, token string) error {
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating forgot password email client")
|
||||
return errors.Wrap(err, "error creating reset password email client")
|
||||
}
|
||||
if err := client.DialAndSend(msg); err != nil {
|
||||
return errors.Wrap(err, "error sending forgot password email")
|
||||
return errors.Wrap(err, "error sending reset password email")
|
||||
}
|
||||
|
||||
logrus.Infof("forgot password email sent to '%v'", emailAddress)
|
||||
logrus.Infof("reset password email sent to '%v'", emailAddress)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fpe forgotPasswordEmail) mergeTemplate(filename string) (string, error) {
|
||||
func (fpe resetPasswordEmail) mergeTemplate(filename string) (string, error) {
|
||||
t, err := template.ParseFS(emailUi.FS, filename)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error parsing verification email template '%v'", filename)
|
75
controller/resetPasswordRequest.go
Normal file
75
controller/resetPasswordRequest.go
Normal file
@ -0,0 +1,75 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/controller/store"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
||||
"github.com/openziti/zrok/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type resetPasswordRequestHandler struct{}
|
||||
|
||||
func newResetPasswordRequestHandler() *resetPasswordRequestHandler {
|
||||
return &resetPasswordRequestHandler{}
|
||||
}
|
||||
|
||||
func (handler *resetPasswordRequestHandler) Handle(params account.ResetPasswordRequestParams) middleware.Responder {
|
||||
if params.Body.EmailAddress == "" {
|
||||
logrus.Errorf("missing email")
|
||||
return account.NewResetPasswordRequestBadRequest()
|
||||
}
|
||||
if !util.IsValidEmail(params.Body.EmailAddress) {
|
||||
logrus.Errorf("'%v' is not a valid email address", params.Body.EmailAddress)
|
||||
return account.NewResetPasswordRequestBadRequest()
|
||||
}
|
||||
logrus.Infof("received reset password request for email '%v'", params.Body.EmailAddress)
|
||||
var token string
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
token, err = createToken()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
|
||||
acct, err := str.FindAccountWithEmail(params.Body.EmailAddress, tx)
|
||||
if err != nil {
|
||||
logrus.Infof("no account found for '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
|
||||
prr := &store.PasswordResetRequest{
|
||||
Token: token,
|
||||
AccountId: acct.Id,
|
||||
}
|
||||
|
||||
if _, err := str.CreatePasswordResetRequest(prr, tx); err != nil {
|
||||
logrus.Errorf("error creating reset password request for '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Errorf("error committing reset password request for '%v': %v", params.Body.EmailAddress, err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
|
||||
if cfg.Email != nil && cfg.Registration != nil && cfg.ResetPassword != nil {
|
||||
if err := sendResetPasswordEmail(acct.Email, token); err != nil {
|
||||
logrus.Errorf("error sending reset password email for '%v': %v", acct.Email, err)
|
||||
return account.NewResetPasswordRequestInternalServerError()
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("'email', 'registration', and 'account' configuration missing; skipping reset password email")
|
||||
}
|
||||
|
||||
logrus.Infof("reset password request for '%v' has token '%v'", params.Body.EmailAddress, prr.Token)
|
||||
|
||||
return account.NewResetPasswordRequestCreated()
|
||||
}
|
@ -30,8 +30,6 @@ type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ForgotPassword(params *ForgotPasswordParams, opts ...ClientOption) (*ForgotPasswordCreated, error)
|
||||
|
||||
Invite(params *InviteParams, opts ...ClientOption) (*InviteCreated, error)
|
||||
|
||||
Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error)
|
||||
@ -40,49 +38,13 @@ type ClientService interface {
|
||||
|
||||
ResetPassword(params *ResetPasswordParams, opts ...ClientOption) (*ResetPasswordOK, error)
|
||||
|
||||
ResetPasswordRequest(params *ResetPasswordRequestParams, opts ...ClientOption) (*ResetPasswordRequestCreated, error)
|
||||
|
||||
Verify(params *VerifyParams, opts ...ClientOption) (*VerifyOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPassword forgot password API
|
||||
*/
|
||||
func (a *Client) ForgotPassword(params *ForgotPasswordParams, opts ...ClientOption) (*ForgotPasswordCreated, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewForgotPasswordParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "forgotPassword",
|
||||
Method: "POST",
|
||||
PathPattern: "/forgotPassword",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ForgotPasswordReader{formats: a.formats},
|
||||
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.(*ForgotPasswordCreated)
|
||||
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 forgotPassword: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Invite invite API
|
||||
*/
|
||||
@ -235,6 +197,44 @@ func (a *Client) ResetPassword(params *ResetPasswordParams, opts ...ClientOption
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequest reset password request API
|
||||
*/
|
||||
func (a *Client) ResetPasswordRequest(params *ResetPasswordRequestParams, opts ...ClientOption) (*ResetPasswordRequestCreated, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewResetPasswordRequestParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "resetPasswordRequest",
|
||||
Method: "POST",
|
||||
PathPattern: "/resetPasswordRequest",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ResetPasswordRequestReader{formats: a.formats},
|
||||
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.(*ResetPasswordRequestCreated)
|
||||
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 resetPasswordRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Verify verify API
|
||||
*/
|
||||
|
@ -1,150 +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"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewForgotPasswordParams creates a new ForgotPasswordParams 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 NewForgotPasswordParams() *ForgotPasswordParams {
|
||||
return &ForgotPasswordParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewForgotPasswordParamsWithTimeout creates a new ForgotPasswordParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewForgotPasswordParamsWithTimeout(timeout time.Duration) *ForgotPasswordParams {
|
||||
return &ForgotPasswordParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewForgotPasswordParamsWithContext creates a new ForgotPasswordParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewForgotPasswordParamsWithContext(ctx context.Context) *ForgotPasswordParams {
|
||||
return &ForgotPasswordParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewForgotPasswordParamsWithHTTPClient creates a new ForgotPasswordParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewForgotPasswordParamsWithHTTPClient(client *http.Client) *ForgotPasswordParams {
|
||||
return &ForgotPasswordParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPasswordParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the forgot password operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ForgotPasswordParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.ForgotPasswordRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the forgot password params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ForgotPasswordParams) WithDefaults() *ForgotPasswordParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the forgot password params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ForgotPasswordParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the forgot password params
|
||||
func (o *ForgotPasswordParams) WithTimeout(timeout time.Duration) *ForgotPasswordParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the forgot password params
|
||||
func (o *ForgotPasswordParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the forgot password params
|
||||
func (o *ForgotPasswordParams) WithContext(ctx context.Context) *ForgotPasswordParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the forgot password params
|
||||
func (o *ForgotPasswordParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the forgot password params
|
||||
func (o *ForgotPasswordParams) WithHTTPClient(client *http.Client) *ForgotPasswordParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the forgot password params
|
||||
func (o *ForgotPasswordParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the forgot password params
|
||||
func (o *ForgotPasswordParams) WithBody(body *rest_model_zrok.ForgotPasswordRequest) *ForgotPasswordParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the forgot password params
|
||||
func (o *ForgotPasswordParams) SetBody(body *rest_model_zrok.ForgotPasswordRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ForgotPasswordParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,197 +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 (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// ForgotPasswordReader is a Reader for the ForgotPassword structure.
|
||||
type ForgotPasswordReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ForgotPasswordReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewForgotPasswordCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewForgotPasswordCreated creates a ForgotPasswordCreated with default headers values
|
||||
func NewForgotPasswordCreated() *ForgotPasswordCreated {
|
||||
return &ForgotPasswordCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPasswordCreated describes a response with status code 201, with default header values.
|
||||
|
||||
forgot password request created
|
||||
*/
|
||||
type ForgotPasswordCreated struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this forgot password created response has a 2xx status code
|
||||
func (o *ForgotPasswordCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this forgot password created response has a 3xx status code
|
||||
func (o *ForgotPasswordCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this forgot password created response has a 4xx status code
|
||||
func (o *ForgotPasswordCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this forgot password created response has a 5xx status code
|
||||
func (o *ForgotPasswordCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this forgot password created response a status code equal to that given
|
||||
func (o *ForgotPasswordCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordCreated) Error() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordCreated ", 201)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordCreated) String() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordCreated ", 201)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
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{}
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPasswordInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type ForgotPasswordInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this forgot password internal server error response has a 2xx status code
|
||||
func (o *ForgotPasswordInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this forgot password internal server error response has a 3xx status code
|
||||
func (o *ForgotPasswordInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this forgot password internal server error response has a 4xx status code
|
||||
func (o *ForgotPasswordInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this forgot password internal server error response has a 5xx status code
|
||||
func (o *ForgotPasswordInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this forgot password internal server error response a status code equal to that given
|
||||
func (o *ForgotPasswordInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /forgotPassword][%d] forgotPasswordInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ForgotPasswordInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
146
rest_client_zrok/account/reset_password_request_parameters.go
Normal file
146
rest_client_zrok/account/reset_password_request_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"
|
||||
)
|
||||
|
||||
// NewResetPasswordRequestParams creates a new ResetPasswordRequestParams 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 NewResetPasswordRequestParams() *ResetPasswordRequestParams {
|
||||
return &ResetPasswordRequestParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestParamsWithTimeout creates a new ResetPasswordRequestParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewResetPasswordRequestParamsWithTimeout(timeout time.Duration) *ResetPasswordRequestParams {
|
||||
return &ResetPasswordRequestParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestParamsWithContext creates a new ResetPasswordRequestParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewResetPasswordRequestParamsWithContext(ctx context.Context) *ResetPasswordRequestParams {
|
||||
return &ResetPasswordRequestParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestParamsWithHTTPClient creates a new ResetPasswordRequestParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewResetPasswordRequestParamsWithHTTPClient(client *http.Client) *ResetPasswordRequestParams {
|
||||
return &ResetPasswordRequestParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequestParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the reset password request operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ResetPasswordRequestParams struct {
|
||||
|
||||
// Body.
|
||||
Body ResetPasswordRequestBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the reset password request params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ResetPasswordRequestParams) WithDefaults() *ResetPasswordRequestParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the reset password request params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ResetPasswordRequestParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) WithTimeout(timeout time.Duration) *ResetPasswordRequestParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) WithContext(ctx context.Context) *ResetPasswordRequestParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) WithHTTPClient(client *http.Client) *ResetPasswordRequestParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) WithBody(body ResetPasswordRequestBody) *ResetPasswordRequestParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the reset password request params
|
||||
func (o *ResetPasswordRequestParams) SetBody(body ResetPasswordRequestBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ResetPasswordRequestParams) 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
|
||||
}
|
237
rest_client_zrok/account/reset_password_request_responses.go
Normal file
237
rest_client_zrok/account/reset_password_request_responses.go
Normal file
@ -0,0 +1,237 @@
|
||||
// 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"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ResetPasswordRequestReader is a Reader for the ResetPasswordRequest structure.
|
||||
type ResetPasswordRequestReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ResetPasswordRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewResetPasswordRequestCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewResetPasswordRequestBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewResetPasswordRequestInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestCreated creates a ResetPasswordRequestCreated with default headers values
|
||||
func NewResetPasswordRequestCreated() *ResetPasswordRequestCreated {
|
||||
return &ResetPasswordRequestCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequestCreated describes a response with status code 201, with default header values.
|
||||
|
||||
forgot password request created
|
||||
*/
|
||||
type ResetPasswordRequestCreated struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset password request created response has a 2xx status code
|
||||
func (o *ResetPasswordRequestCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset password request created response has a 3xx status code
|
||||
func (o *ResetPasswordRequestCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset password request created response has a 4xx status code
|
||||
func (o *ResetPasswordRequestCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset password request created response has a 5xx status code
|
||||
func (o *ResetPasswordRequestCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset password request created response a status code equal to that given
|
||||
func (o *ResetPasswordRequestCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestCreated) Error() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestCreated ", 201)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestCreated) String() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestCreated ", 201)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestBadRequest creates a ResetPasswordRequestBadRequest with default headers values
|
||||
func NewResetPasswordRequestBadRequest() *ResetPasswordRequestBadRequest {
|
||||
return &ResetPasswordRequestBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequestBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
forgot password request not created
|
||||
*/
|
||||
type ResetPasswordRequestBadRequest struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset password request bad request response has a 2xx status code
|
||||
func (o *ResetPasswordRequestBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset password request bad request response has a 3xx status code
|
||||
func (o *ResetPasswordRequestBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset password request bad request response has a 4xx status code
|
||||
func (o *ResetPasswordRequestBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset password request bad request response has a 5xx status code
|
||||
func (o *ResetPasswordRequestBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset password request bad request response a status code equal to that given
|
||||
func (o *ResetPasswordRequestBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestBadRequest ", 400)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestBadRequest ", 400)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestInternalServerError creates a ResetPasswordRequestInternalServerError with default headers values
|
||||
func NewResetPasswordRequestInternalServerError() *ResetPasswordRequestInternalServerError {
|
||||
return &ResetPasswordRequestInternalServerError{}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequestInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type ResetPasswordRequestInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this reset password request internal server error response has a 2xx status code
|
||||
func (o *ResetPasswordRequestInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this reset password request internal server error response has a 3xx status code
|
||||
func (o *ResetPasswordRequestInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this reset password request internal server error response has a 4xx status code
|
||||
func (o *ResetPasswordRequestInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this reset password request internal server error response has a 5xx status code
|
||||
func (o *ResetPasswordRequestInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this reset password request internal server error response a status code equal to that given
|
||||
func (o *ResetPasswordRequestInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestInternalServerError) String() string {
|
||||
return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequestBody reset password request body
|
||||
swagger:model ResetPasswordRequestBody
|
||||
*/
|
||||
type ResetPasswordRequestBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset password request body
|
||||
func (o *ResetPasswordRequestBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset password request body based on context it is used
|
||||
func (o *ResetPasswordRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetPasswordRequestBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetPasswordRequestBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetPasswordRequestBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package rest_model_zrok
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ForgotPasswordRequest forgot password request
|
||||
//
|
||||
// swagger:model forgotPasswordRequest
|
||||
type ForgotPasswordRequest struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this forgot password request
|
||||
func (m *ForgotPasswordRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this forgot password request based on context it is used
|
||||
func (m *ForgotPasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *ForgotPasswordRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *ForgotPasswordRequest) UnmarshalBinary(b []byte) error {
|
||||
var res ForgotPasswordRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -222,34 +222,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/forgotPassword": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "forgotPassword",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/forgotPasswordRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/frontend": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -612,6 +584,38 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/resetPasswordRequest": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "resetPasswordRequest",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/share": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -954,14 +958,6 @@ func init() {
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"forgotPasswordRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"inviteRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -1471,34 +1467,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/forgotPassword": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "forgotPassword",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/forgotPasswordRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/frontend": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -1861,6 +1829,38 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/resetPasswordRequest": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"account"
|
||||
],
|
||||
"operationId": "resetPasswordRequest",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"properties": {
|
||||
"emailAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "forgot password request created"
|
||||
},
|
||||
"400": {
|
||||
"description": "forgot password request not created"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/share": {
|
||||
"post": {
|
||||
"security": [
|
||||
@ -2203,14 +2203,6 @@ func init() {
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"forgotPasswordRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"inviteRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1,56 +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 (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// ForgotPasswordHandlerFunc turns a function with the right signature into a forgot password handler
|
||||
type ForgotPasswordHandlerFunc func(ForgotPasswordParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ForgotPasswordHandlerFunc) Handle(params ForgotPasswordParams) middleware.Responder {
|
||||
return fn(params)
|
||||
}
|
||||
|
||||
// ForgotPasswordHandler interface for that can handle valid forgot password params
|
||||
type ForgotPasswordHandler interface {
|
||||
Handle(ForgotPasswordParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewForgotPassword creates a new http.Handler for the forgot password operation
|
||||
func NewForgotPassword(ctx *middleware.Context, handler ForgotPasswordHandler) *ForgotPassword {
|
||||
return &ForgotPassword{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
ForgotPassword swagger:route POST /forgotPassword account forgotPassword
|
||||
|
||||
ForgotPassword forgot password API
|
||||
*/
|
||||
type ForgotPassword struct {
|
||||
Context *middleware.Context
|
||||
Handler ForgotPasswordHandler
|
||||
}
|
||||
|
||||
func (o *ForgotPassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewForgotPasswordParams()
|
||||
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) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
@ -1,87 +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"
|
||||
)
|
||||
|
||||
// ForgotPasswordCreatedCode is the HTTP code returned for type ForgotPasswordCreated
|
||||
const ForgotPasswordCreatedCode int = 201
|
||||
|
||||
/*
|
||||
ForgotPasswordCreated forgot password request created
|
||||
|
||||
swagger:response forgotPasswordCreated
|
||||
*/
|
||||
type ForgotPasswordCreated struct {
|
||||
}
|
||||
|
||||
// NewForgotPasswordCreated creates ForgotPasswordCreated with default headers values
|
||||
func NewForgotPasswordCreated() *ForgotPasswordCreated {
|
||||
|
||||
return &ForgotPasswordCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ForgotPasswordCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
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
|
||||
|
||||
/*
|
||||
ForgotPasswordInternalServerError internal server error
|
||||
|
||||
swagger:response forgotPasswordInternalServerError
|
||||
*/
|
||||
type ForgotPasswordInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewForgotPasswordInternalServerError creates ForgotPasswordInternalServerError with default headers values
|
||||
func NewForgotPasswordInternalServerError() *ForgotPasswordInternalServerError {
|
||||
|
||||
return &ForgotPasswordInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ForgotPasswordInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ResetPasswordRequestHandlerFunc turns a function with the right signature into a reset password request handler
|
||||
type ResetPasswordRequestHandlerFunc func(ResetPasswordRequestParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ResetPasswordRequestHandlerFunc) Handle(params ResetPasswordRequestParams) middleware.Responder {
|
||||
return fn(params)
|
||||
}
|
||||
|
||||
// ResetPasswordRequestHandler interface for that can handle valid reset password request params
|
||||
type ResetPasswordRequestHandler interface {
|
||||
Handle(ResetPasswordRequestParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewResetPasswordRequest creates a new http.Handler for the reset password request operation
|
||||
func NewResetPasswordRequest(ctx *middleware.Context, handler ResetPasswordRequestHandler) *ResetPasswordRequest {
|
||||
return &ResetPasswordRequest{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
ResetPasswordRequest swagger:route POST /resetPasswordRequest account resetPasswordRequest
|
||||
|
||||
ResetPasswordRequest reset password request API
|
||||
*/
|
||||
type ResetPasswordRequest struct {
|
||||
Context *middleware.Context
|
||||
Handler ResetPasswordRequestHandler
|
||||
}
|
||||
|
||||
func (o *ResetPasswordRequest) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewResetPasswordRequestParams()
|
||||
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) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// ResetPasswordRequestBody reset password request body
|
||||
//
|
||||
// swagger:model ResetPasswordRequestBody
|
||||
type ResetPasswordRequestBody struct {
|
||||
|
||||
// email address
|
||||
EmailAddress string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this reset password request body
|
||||
func (o *ResetPasswordRequestBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this reset password request body based on context it is used
|
||||
func (o *ResetPasswordRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *ResetPasswordRequestBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *ResetPasswordRequestBody) UnmarshalBinary(b []byte) error {
|
||||
var res ResetPasswordRequestBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
@ -12,23 +12,21 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewForgotPasswordParams creates a new ForgotPasswordParams object
|
||||
// NewResetPasswordRequestParams creates a new ResetPasswordRequestParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewForgotPasswordParams() ForgotPasswordParams {
|
||||
func NewResetPasswordRequestParams() ResetPasswordRequestParams {
|
||||
|
||||
return ForgotPasswordParams{}
|
||||
return ResetPasswordRequestParams{}
|
||||
}
|
||||
|
||||
// ForgotPasswordParams contains all the bound params for the forgot password operation
|
||||
// ResetPasswordRequestParams contains all the bound params for the reset password request operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters forgotPassword
|
||||
type ForgotPasswordParams struct {
|
||||
// swagger:parameters resetPasswordRequest
|
||||
type ResetPasswordRequestParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
@ -36,21 +34,21 @@ type ForgotPasswordParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body *rest_model_zrok.ForgotPasswordRequest
|
||||
Body ResetPasswordRequestBody
|
||||
}
|
||||
|
||||
// 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 NewForgotPasswordParams() beforehand.
|
||||
func (o *ForgotPasswordParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
// To ensure default values, the struct must have been initialized with NewResetPasswordRequestParams() beforehand.
|
||||
func (o *ResetPasswordRequestParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.ForgotPasswordRequest
|
||||
var body ResetPasswordRequestBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
@ -65,7 +63,7 @@ func (o *ForgotPasswordParams) BindRequest(r *http.Request, route *middleware.Ma
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ResetPasswordRequestCreatedCode is the HTTP code returned for type ResetPasswordRequestCreated
|
||||
const ResetPasswordRequestCreatedCode int = 201
|
||||
|
||||
/*
|
||||
ResetPasswordRequestCreated forgot password request created
|
||||
|
||||
swagger:response resetPasswordRequestCreated
|
||||
*/
|
||||
type ResetPasswordRequestCreated struct {
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestCreated creates ResetPasswordRequestCreated with default headers values
|
||||
func NewResetPasswordRequestCreated() *ResetPasswordRequestCreated {
|
||||
|
||||
return &ResetPasswordRequestCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetPasswordRequestCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
// ResetPasswordRequestBadRequestCode is the HTTP code returned for type ResetPasswordRequestBadRequest
|
||||
const ResetPasswordRequestBadRequestCode int = 400
|
||||
|
||||
/*
|
||||
ResetPasswordRequestBadRequest forgot password request not created
|
||||
|
||||
swagger:response resetPasswordRequestBadRequest
|
||||
*/
|
||||
type ResetPasswordRequestBadRequest struct {
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestBadRequest creates ResetPasswordRequestBadRequest with default headers values
|
||||
func NewResetPasswordRequestBadRequest() *ResetPasswordRequestBadRequest {
|
||||
|
||||
return &ResetPasswordRequestBadRequest{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetPasswordRequestBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(400)
|
||||
}
|
||||
|
||||
// ResetPasswordRequestInternalServerErrorCode is the HTTP code returned for type ResetPasswordRequestInternalServerError
|
||||
const ResetPasswordRequestInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
ResetPasswordRequestInternalServerError internal server error
|
||||
|
||||
swagger:response resetPasswordRequestInternalServerError
|
||||
*/
|
||||
type ResetPasswordRequestInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewResetPasswordRequestInternalServerError creates ResetPasswordRequestInternalServerError with default headers values
|
||||
func NewResetPasswordRequestInternalServerError() *ResetPasswordRequestInternalServerError {
|
||||
|
||||
return &ResetPasswordRequestInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ResetPasswordRequestInternalServerError) 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"
|
||||
)
|
||||
|
||||
// ForgotPasswordURL generates an URL for the forgot password operation
|
||||
type ForgotPasswordURL struct {
|
||||
// ResetPasswordRequestURL generates an URL for the reset password request operation
|
||||
type ResetPasswordRequestURL 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 *ForgotPasswordURL) WithBasePath(bp string) *ForgotPasswordURL {
|
||||
func (o *ResetPasswordRequestURL) WithBasePath(bp string) *ResetPasswordRequestURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
@ -27,15 +27,15 @@ func (o *ForgotPasswordURL) WithBasePath(bp string) *ForgotPasswordURL {
|
||||
// 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 *ForgotPasswordURL) SetBasePath(bp string) {
|
||||
func (o *ResetPasswordRequestURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ForgotPasswordURL) Build() (*url.URL, error) {
|
||||
func (o *ResetPasswordRequestURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/forgotPassword"
|
||||
var _path = "/resetPasswordRequest"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@ -47,7 +47,7 @@ func (o *ForgotPasswordURL) Build() (*url.URL, error) {
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *ForgotPasswordURL) Must(u *url.URL, err error) *url.URL {
|
||||
func (o *ResetPasswordRequestURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -58,17 +58,17 @@ func (o *ForgotPasswordURL) Must(u *url.URL, err error) *url.URL {
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *ForgotPasswordURL) String() string {
|
||||
func (o *ResetPasswordRequestURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ForgotPasswordURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
func (o *ResetPasswordRequestURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ForgotPasswordURL")
|
||||
return nil, errors.New("scheme is required for a full url on ResetPasswordRequestURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ForgotPasswordURL")
|
||||
return nil, errors.New("host is required for a full url on ResetPasswordRequestURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
@ -82,6 +82,6 @@ func (o *ForgotPasswordURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *ForgotPasswordURL) StringFull(scheme, host string) string {
|
||||
func (o *ResetPasswordRequestURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -67,9 +67,6 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
EnvironmentEnableHandler: environment.EnableHandlerFunc(func(params environment.EnableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation environment.Enable has not yet been implemented")
|
||||
}),
|
||||
AccountForgotPasswordHandler: account.ForgotPasswordHandlerFunc(func(params account.ForgotPasswordParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ForgotPassword has not yet been implemented")
|
||||
}),
|
||||
MetadataGetEnvironmentDetailHandler: metadata.GetEnvironmentDetailHandlerFunc(func(params metadata.GetEnvironmentDetailParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation metadata.GetEnvironmentDetail has not yet been implemented")
|
||||
}),
|
||||
@ -97,6 +94,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AccountResetPasswordHandler: account.ResetPasswordHandlerFunc(func(params account.ResetPasswordParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ResetPassword has not yet been implemented")
|
||||
}),
|
||||
AccountResetPasswordRequestHandler: account.ResetPasswordRequestHandlerFunc(func(params account.ResetPasswordRequestParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.ResetPasswordRequest 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")
|
||||
}),
|
||||
@ -180,8 +180,6 @@ type ZrokAPI struct {
|
||||
EnvironmentDisableHandler environment.DisableHandler
|
||||
// EnvironmentEnableHandler sets the operation handler for the enable operation
|
||||
EnvironmentEnableHandler environment.EnableHandler
|
||||
// AccountForgotPasswordHandler sets the operation handler for the forgot password operation
|
||||
AccountForgotPasswordHandler account.ForgotPasswordHandler
|
||||
// MetadataGetEnvironmentDetailHandler sets the operation handler for the get environment detail operation
|
||||
MetadataGetEnvironmentDetailHandler metadata.GetEnvironmentDetailHandler
|
||||
// MetadataGetShareDetailHandler sets the operation handler for the get share detail operation
|
||||
@ -200,6 +198,8 @@ type ZrokAPI struct {
|
||||
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
|
||||
// ShareShareHandler sets the operation handler for the share operation
|
||||
ShareShareHandler share.ShareHandler
|
||||
// ShareUnaccessHandler sets the operation handler for the unaccess operation
|
||||
@ -313,9 +313,6 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.EnvironmentEnableHandler == nil {
|
||||
unregistered = append(unregistered, "environment.EnableHandler")
|
||||
}
|
||||
if o.AccountForgotPasswordHandler == nil {
|
||||
unregistered = append(unregistered, "account.ForgotPasswordHandler")
|
||||
}
|
||||
if o.MetadataGetEnvironmentDetailHandler == nil {
|
||||
unregistered = append(unregistered, "metadata.GetEnvironmentDetailHandler")
|
||||
}
|
||||
@ -343,6 +340,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AccountResetPasswordHandler == nil {
|
||||
unregistered = append(unregistered, "account.ResetPasswordHandler")
|
||||
}
|
||||
if o.AccountResetPasswordRequestHandler == nil {
|
||||
unregistered = append(unregistered, "account.ResetPasswordRequestHandler")
|
||||
}
|
||||
if o.ShareShareHandler == nil {
|
||||
unregistered = append(unregistered, "share.ShareHandler")
|
||||
}
|
||||
@ -487,10 +487,6 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/enable"] = environment.NewEnable(o.context, o.EnvironmentEnableHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/forgotPassword"] = account.NewForgotPassword(o.context, o.AccountForgotPasswordHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
@ -530,6 +526,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/resetPasswordRequest"] = account.NewResetPasswordRequest(o.context, o.AccountResetPasswordRequestHandler)
|
||||
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)
|
||||
|
@ -15,24 +15,6 @@ paths:
|
||||
#
|
||||
# account
|
||||
#
|
||||
/forgotPassword:
|
||||
post:
|
||||
tags:
|
||||
- account
|
||||
operationId: forgotPassword
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/forgotPasswordRequest"
|
||||
responses:
|
||||
201:
|
||||
description: forgot password request created
|
||||
400:
|
||||
description: forgot password request not created
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/invite:
|
||||
post:
|
||||
tags:
|
||||
@ -109,6 +91,26 @@ paths:
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/resetPasswordRequest:
|
||||
post:
|
||||
tags:
|
||||
- account
|
||||
operationId: resetPasswordRequest
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
properties:
|
||||
emailAddress:
|
||||
type: string
|
||||
responses:
|
||||
201:
|
||||
description: forgot password request created
|
||||
400:
|
||||
description: forgot password request not created
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/verify:
|
||||
post:
|
||||
tags:
|
||||
@ -612,12 +614,6 @@ definitions:
|
||||
errorMessage:
|
||||
type: string
|
||||
|
||||
forgotPasswordRequest:
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
|
||||
inviteTokenGenerateRequest:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -3,7 +3,7 @@ import Register from "./register/Register";
|
||||
import Console from "./console/Console";
|
||||
import {useEffect, useState} from "react";
|
||||
import Login from "./console/login/Login";
|
||||
import ForgotPassword from "./console/forgotPassword/ForgotPassword"
|
||||
import ResetPassword from "./resetPassword/ResetPassword"
|
||||
|
||||
const App = () => {
|
||||
const [user, setUser] = useState();
|
||||
@ -28,7 +28,8 @@ const App = () => {
|
||||
<Routes>
|
||||
<Route path={"/"} element={consoleComponent}/>
|
||||
<Route path={"register/:token"} element={<Register />} />
|
||||
<Route path={"forgotpassword"} element={<ForgotPassword />}/>
|
||||
<Route path={"resetPassword"} element={<ResetPassword />}/>
|
||||
<Route path={"resetPassword/:token"} element={<ResetPassword />}/>
|
||||
</Routes>
|
||||
</Router>
|
||||
);
|
||||
|
@ -2,21 +2,6 @@
|
||||
// Auto-generated, edits will be overwritten
|
||||
import * as gateway from './gateway'
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.forgotPasswordRequest} [options.body]
|
||||
* @return {Promise<object>} forgot password request created
|
||||
*/
|
||||
export function forgotPassword(options) {
|
||||
if (!options) options = {}
|
||||
const parameters = {
|
||||
body: {
|
||||
body: options.body
|
||||
}
|
||||
}
|
||||
return gateway.request(forgotPasswordOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.inviteRequest} [options.body]
|
||||
@ -77,6 +62,21 @@ export function resetPassword(options) {
|
||||
return gateway.request(resetPasswordOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {object} [options.body]
|
||||
* @return {Promise<object>} forgot password request created
|
||||
*/
|
||||
export function resetPasswordRequest(options) {
|
||||
if (!options) options = {}
|
||||
const parameters = {
|
||||
body: {
|
||||
body: options.body
|
||||
}
|
||||
}
|
||||
return gateway.request(resetPasswordRequestOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.verifyRequest} [options.body]
|
||||
@ -92,12 +92,6 @@ export function verify(options) {
|
||||
return gateway.request(verifyOperation, parameters)
|
||||
}
|
||||
|
||||
const forgotPasswordOperation = {
|
||||
path: '/forgotPassword',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
method: 'post'
|
||||
}
|
||||
|
||||
const inviteOperation = {
|
||||
path: '/invite',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
@ -122,6 +116,12 @@ const resetPasswordOperation = {
|
||||
method: 'post'
|
||||
}
|
||||
|
||||
const resetPasswordRequestOperation = {
|
||||
path: '/resetPasswordRequest',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
method: 'post'
|
||||
}
|
||||
|
||||
const verifyOperation = {
|
||||
path: '/verify',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
|
@ -91,13 +91,6 @@
|
||||
* @property {module:types.shares} shares
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef forgotPasswordRequest
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} email
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef inviteTokenGenerateRequest
|
||||
* @memberof module:types
|
||||
|
@ -1,24 +0,0 @@
|
||||
import {useState} from "react";
|
||||
import * as account from '../../api/account';
|
||||
import {Button, Container, Form, Row} from "react-bootstrap";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import SendRequest from "./SendRequest"
|
||||
import ResetPassword from "./ResetPassword";
|
||||
|
||||
const ForgotPassword = (props) => {
|
||||
const { search } = useLocation();
|
||||
const token = new URLSearchParams(search).get("token")
|
||||
console.log(token)
|
||||
let forgetPasswordComponent = undefined
|
||||
if (token) {
|
||||
forgetPasswordComponent = <ResetPassword token={token} />
|
||||
} else {
|
||||
forgetPasswordComponent = <SendRequest />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={"fullscreen"}>{forgetPasswordComponent}</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ForgotPassword;
|
@ -68,8 +68,8 @@ const Login = (props) => {
|
||||
|
||||
<Button variant={"light"} type={"submit"}>Log In</Button>
|
||||
|
||||
<div>
|
||||
<Link to="/forgotpassword" className="">
|
||||
<div id={"zrok-reset-password"}>
|
||||
<Link to="/resetPassword" className="">
|
||||
Forgot Password?
|
||||
</Link>
|
||||
</div>
|
||||
|
@ -113,3 +113,7 @@ code, pre {
|
||||
.actions-tab p {
|
||||
font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
|
||||
}
|
||||
|
||||
#zrok-reset-password {
|
||||
margin-top: 25px;
|
||||
}
|
23
ui/src/resetPassword/ResetPassword.js
Normal file
23
ui/src/resetPassword/ResetPassword.js
Normal file
@ -0,0 +1,23 @@
|
||||
import {useLocation, useParams} from "react-router-dom";
|
||||
import SendRequest from "./SendRequest"
|
||||
import SetNewPassword from "./SetNewPassword";
|
||||
|
||||
const ResetPassword = () => {
|
||||
const { search } = useLocation();
|
||||
const { token } = useParams();
|
||||
console.log(token)
|
||||
let component = undefined
|
||||
if (token) {
|
||||
component = <SetNewPassword token={token} />
|
||||
} else {
|
||||
component = <SendRequest />
|
||||
}
|
||||
|
||||
console.log(token);
|
||||
|
||||
return (
|
||||
<div className={"fullscreen"}>{component}</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ResetPassword;
|
@ -1,9 +1,8 @@
|
||||
import { useState } from "react";
|
||||
import * as account from '../../api/account';
|
||||
import * as account from '../api/account';
|
||||
import { Button, Container, Form, Row } from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const SendRequest = (props) => {
|
||||
const SendRequest = () => {
|
||||
const [email, setEmail] = useState('');
|
||||
const [complete, setComplete] = useState(false);
|
||||
|
||||
@ -11,7 +10,7 @@ const SendRequest = (props) => {
|
||||
e.preventDefault();
|
||||
console.log(email);
|
||||
|
||||
account.forgotPassword({ body: { "email": email } })
|
||||
account.resetPasswordRequest({ body: { "emailAddress": email } })
|
||||
.then(resp => {
|
||||
if (!resp.error) {
|
||||
setComplete(true)
|
||||
@ -66,14 +65,7 @@ const SendRequest = (props) => {
|
||||
<h1>Reset Password</h1>
|
||||
</Row>
|
||||
<Row>
|
||||
We will get back to you shortly with a link to reset your password!
|
||||
</Row>
|
||||
<Row>
|
||||
<div>
|
||||
<Link to="/" className="">
|
||||
Login
|
||||
</Link>
|
||||
</div>
|
||||
Check your email for a password reset message!
|
||||
</Row>
|
||||
</Container>
|
||||
)
|
@ -1,9 +1,9 @@
|
||||
import {useState} from "react";
|
||||
import * as account from '../../api/account';
|
||||
import * as account from '../api/account';
|
||||
import {Button, Container, Form, Row} from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const ResetPassword = (props) => {
|
||||
const SetNewPassword = (props) => {
|
||||
const [password, setPassword] = useState('');
|
||||
const [confirm, setConfirm] = useState('');
|
||||
const [message, setMessage] = useState();
|
||||
@ -93,9 +93,9 @@ const ResetPassword = (props) => {
|
||||
Password reset successful! You can now return to the login page and login.
|
||||
</Row>
|
||||
<Row>
|
||||
<div>
|
||||
<div id={"zrok-reset-password"}>
|
||||
<Link to="/" className="">
|
||||
Login
|
||||
<Button variant={"light"}>Login</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</Row>
|
||||
@ -103,4 +103,4 @@ const ResetPassword = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default ResetPassword;
|
||||
export default SetNewPassword;
|
Loading…
Reference in New Issue
Block a user