forms

package
v0.0.0-...-89d1b08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminLogin

type AdminLogin struct {
	Email    string `form:"email" json:"email"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

AdminLogin specifies an admin email/pass login form.

func NewAdminLogin

func NewAdminLogin(app core.App) *AdminLogin

NewAdminLogin creates a new AdminLogin form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewAdminLoginWithConfig with explicitly set Dao.

func NewAdminLoginWithConfig

func NewAdminLoginWithConfig(config AdminLoginConfig) *AdminLogin

NewAdminLoginWithConfig creates a new AdminLogin form with the provided config or panics on invalid configuration.

func (*AdminLogin) Submit

func (form *AdminLogin) Submit() (*models.Admin, error)

Submit validates and submits the admin form. On success returns the authorized admin model.

func (*AdminLogin) Validate

func (form *AdminLogin) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type AdminLoginConfig

type AdminLoginConfig struct {
	App core.App
	Dao *daos.Dao
}

AdminLoginConfig is the AdminLogin factory initializer config.

NB! App is a required struct member.

type AdminPasswordResetConfirm

type AdminPasswordResetConfirm struct {
	Token           string `form:"token" json:"token"`
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	// contains filtered or unexported fields
}

AdminPasswordResetConfirm specifies an admin password reset confirmation form.

func NewAdminPasswordResetConfirm

func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm

NewAdminPasswordResetConfirm creates a new AdminPasswordResetConfirm form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewAdminPasswordResetConfirmWithConfig with explicitly set Dao.

func NewAdminPasswordResetConfirmWithConfig

func NewAdminPasswordResetConfirmWithConfig(config AdminPasswordResetConfirmConfig) *AdminPasswordResetConfirm

NewAdminPasswordResetConfirmWithConfig creates a new AdminPasswordResetConfirm form with the provided config or panics on invalid configuration.

func (*AdminPasswordResetConfirm) Submit

func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error)

Submit validates and submits the admin password reset confirmation form. On success returns the updated admin model associated to `form.Token`.

func (*AdminPasswordResetConfirm) Validate

func (form *AdminPasswordResetConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type AdminPasswordResetConfirmConfig

type AdminPasswordResetConfirmConfig struct {
	App core.App
	Dao *daos.Dao
}

AdminPasswordResetConfirmConfig is the AdminPasswordResetConfirm factory initializer config.

NB! App is required struct member.

type AdminPasswordResetRequest

type AdminPasswordResetRequest struct {
	Email string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

AdminPasswordResetRequest specifies an admin password reset request form.

func NewAdminPasswordResetRequest

func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest

NewAdminPasswordResetRequest creates a new AdminPasswordResetRequest form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewAdminPasswordResetRequestWithConfig with explicitly set Dao.

func NewAdminPasswordResetRequestWithConfig

func NewAdminPasswordResetRequestWithConfig(config AdminPasswordResetRequestConfig) *AdminPasswordResetRequest

NewAdminPasswordResetRequestWithConfig creates a new AdminPasswordResetRequest form with the provided config or panics on invalid configuration.

func (*AdminPasswordResetRequest) Submit

func (form *AdminPasswordResetRequest) Submit() error

Submit validates and submits the form. On success sends a password reset email to the `form.Email` admin.

func (*AdminPasswordResetRequest) Validate

func (form *AdminPasswordResetRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

This method doesn't verify that admin with `form.Email` exists (this is done on Submit).

type AdminPasswordResetRequestConfig

type AdminPasswordResetRequestConfig struct {
	App             core.App
	Dao             *daos.Dao
	ResendThreshold float64 // in seconds
}

AdminPasswordResetRequestConfig is the AdminPasswordResetRequest factory initializer config.

NB! App is required struct member.

type AdminUpsert

type AdminUpsert struct {
	Id              string `form:"id" json:"id"`
	Avatar          int    `form:"avatar" json:"avatar"`
	Email           string `form:"email" json:"email"`
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	// contains filtered or unexported fields
}

AdminUpsert specifies a models.Admin upsert (create/update) form.

func NewAdminUpsert

func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert

NewAdminUpsert creates a new AdminUpsert form with initializer config created from the provided core.App and models.Admin instances (for create you could pass a pointer to an empty Admin - `&models.Admin{}`).

If you want to submit the form as part of another transaction, use NewAdminUpsertWithConfig with explicitly set Dao.

func NewAdminUpsertWithConfig

func NewAdminUpsertWithConfig(config AdminUpsertConfig, admin *models.Admin) *AdminUpsert

NewAdminUpsertWithConfig creates a new AdminUpsert form with the provided config and models.Admin instance or panics on invalid configuration (for create you could pass a pointer to an empty Admin - `&models.Admin{}`).

func (*AdminUpsert) Submit

func (form *AdminUpsert) Submit(interceptors ...InterceptorFunc) error

Submit validates the form and upserts the form admin model.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*AdminUpsert) Validate

func (form *AdminUpsert) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type AdminUpsertConfig

type AdminUpsertConfig struct {
	App core.App
	Dao *daos.Dao
}

AdminUpsertConfig is the AdminUpsert factory initializer config.

NB! App is a required struct member.

type CollectionUpsert

type CollectionUpsert struct {
	Id         string        `form:"id" json:"id"`
	Name       string        `form:"name" json:"name"`
	System     bool          `form:"system" json:"system"`
	Schema     schema.Schema `form:"schema" json:"schema"`
	ListRule   *string       `form:"listRule" json:"listRule"`
	ViewRule   *string       `form:"viewRule" json:"viewRule"`
	CreateRule *string       `form:"createRule" json:"createRule"`
	UpdateRule *string       `form:"updateRule" json:"updateRule"`
	DeleteRule *string       `form:"deleteRule" json:"deleteRule"`
	// contains filtered or unexported fields
}

CollectionUpsert specifies a models.Collection upsert (create/update) form.

func NewCollectionUpsert

func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert

NewCollectionUpsert creates a new CollectionUpsert form with initializer config created from the provided core.App and models.Collection instances (for create you could pass a pointer to an empty Collection - `&models.Collection{}`).

If you want to submit the form as part of another transaction, use NewCollectionUpsertWithConfig with explicitly set Dao.

func NewCollectionUpsertWithConfig

func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert

NewCollectionUpsertWithConfig creates a new CollectionUpsert form with the provided config and models.Collection instance or panics on invalid configuration (for create you could pass a pointer to an empty Collection - `&models.Collection{}`).

func (*CollectionUpsert) Submit

func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error

Submit validates the form and upserts the form's Collection model.

On success the related record table schema will be auto updated.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*CollectionUpsert) Validate

func (form *CollectionUpsert) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type CollectionUpsertConfig

type CollectionUpsertConfig struct {
	App core.App
	Dao *daos.Dao
}

CollectionUpsertConfig is the CollectionUpsert factory initializer config.

NB! App is a required struct member.

type CollectionsImport

type CollectionsImport struct {
	Collections   []*models.Collection `form:"collections" json:"collections"`
	DeleteMissing bool                 `form:"deleteMissing" json:"deleteMissing"`
	// contains filtered or unexported fields
}

CollectionsImport specifies a form model to bulk import (create, replace and delete) collections from a user provided list.

func NewCollectionsImport

func NewCollectionsImport(app core.App) *CollectionsImport

NewCollectionsImport creates a new CollectionsImport form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewCollectionsImportWithConfig with explicitly set Dao.

func NewCollectionsImportWithConfig

func NewCollectionsImportWithConfig(config CollectionsImportConfig) *CollectionsImport

NewCollectionsImportWithConfig creates a new CollectionsImport form with the provided config or panics on invalid configuration.

func (*CollectionsImport) Submit

func (form *CollectionsImport) Submit(interceptors ...InterceptorFunc) error

Submit applies the import, aka.: - imports the form collections (create or replace) - sync the collection changes with their related records table - ensures the integrity of the imported structure (aka. run validations for each collection) - if [form.DeleteMissing] is set, deletes all local collections that are not found in the imports list

All operations are wrapped in a single transaction that are rollbacked on the first encountered error.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*CollectionsImport) Validate

func (form *CollectionsImport) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type CollectionsImportConfig

type CollectionsImportConfig struct {
	App core.App
	Dao *daos.Dao
}

CollectionsImportConfig is the CollectionsImport factory initializer config.

NB! App is a required struct member.

type InterceptorFunc

type InterceptorFunc func(next InterceptorNextFunc) InterceptorNextFunc

InterceptorFunc defines a single interceptor function that will execute the provided next func handler.

type InterceptorNextFunc

type InterceptorNextFunc = func() error

InterceptorNextFunc is a interceptor handler function. Usually used in combination with InterceptorFunc.

type RealtimeSubscribe

type RealtimeSubscribe struct {
	ClientId      string   `form:"clientId" json:"clientId"`
	Subscriptions []string `form:"subscriptions" json:"subscriptions"`
}

RealtimeSubscribe is a realtime subscriptions request form.

func NewRealtimeSubscribe

func NewRealtimeSubscribe() *RealtimeSubscribe

NewRealtimeSubscribe creates new RealtimeSubscribe request form.

func (*RealtimeSubscribe) Validate

func (form *RealtimeSubscribe) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordUpsert

type RecordUpsert struct {
	Id   string         `form:"id" json:"id"`
	Data map[string]any `json:"data"`
	// contains filtered or unexported fields
}

RecordUpsert specifies a models.Record upsert (create/update) form.

func NewRecordUpsert

func NewRecordUpsert(app core.App, record *models.Record) *RecordUpsert

NewRecordUpsert creates a new RecordUpsert form with initializer config created from the provided core.App and models.Record instances (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`).

If you want to submit the form as part of another transaction, use NewRecordUpsertWithConfig with explicitly set Dao.

func NewRecordUpsertWithConfig

func NewRecordUpsertWithConfig(config RecordUpsertConfig, record *models.Record) *RecordUpsert

NewRecordUpsertWithConfig creates a new RecordUpsert form with the provided config and models.Record instance or panics on invalid configuration (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`).

func (*RecordUpsert) DrySubmit

func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error

DrySubmit performs a form submit within a transaction and reverts it. For actual record persistence, check the `form.Submit()` method.

This method doesn't handle file uploads/deletes or trigger any app events!

func (*RecordUpsert) LoadData

func (form *RecordUpsert) LoadData(r *http.Request) error

LoadData loads and normalizes json OR multipart/form-data request data.

File upload is supported only via multipart/form-data.

To REPLACE previously uploaded file(s) you can suffix the field name with the file index (eg. `myfile.0`) and set the new value. For single file upload fields, you can skip the index and directly assign the file value to the field name (eg. `myfile`).

To DELETE previously uploaded file(s) you can suffix the field name with the file index (eg. `myfile.0`) and set it to null or empty string. For single file upload fields, you can skip the index and directly reset the field using its field name (eg. `myfile`).

func (*RecordUpsert) Submit

func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error

Submit validates the form and upserts the form Record model.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*RecordUpsert) Validate

func (form *RecordUpsert) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type RecordUpsertConfig

type RecordUpsertConfig struct {
	App core.App
	Dao *daos.Dao
}

RecordUpsertConfig is the RecordUpsert factory initializer config.

NB! App is required struct member.

type SettingsUpsert

type SettingsUpsert struct {
	*core.Settings
	// contains filtered or unexported fields
}

SettingsUpsert specifies a core.Settings upsert (create/update) form.

func NewSettingsUpsert

func NewSettingsUpsert(app core.App) *SettingsUpsert

NewSettingsUpsert creates a new SettingsUpsert form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewSettingsUpsertWithConfig with explicitly set Dao.

func NewSettingsUpsertWithConfig

func NewSettingsUpsertWithConfig(config SettingsUpsertConfig) *SettingsUpsert

NewSettingsUpsertWithConfig creates a new SettingsUpsert form with the provided config or panics on invalid configuration.

func (*SettingsUpsert) Submit

func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error

Submit validates the form and upserts the loaded settings.

On success the app settings will be refreshed with the form ones.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*SettingsUpsert) Validate

func (form *SettingsUpsert) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type SettingsUpsertConfig

type SettingsUpsertConfig struct {
	App     core.App
	Dao     *daos.Dao
	LogsDao *daos.Dao
}

SettingsUpsertConfig is the SettingsUpsert factory initializer config.

NB! App is required struct member.

type TestEmailSend

type TestEmailSend struct {
	Template string `form:"template" json:"template"`
	Email    string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

TestEmailSend is a email template test request form.

func NewTestEmailSend

func NewTestEmailSend(app core.App) *TestEmailSend

NewTestEmailSend creates and initializes new TestEmailSend form.

func (*TestEmailSend) Submit

func (form *TestEmailSend) Submit() error

Submit validates and sends a test email to the form.Email address.

func (*TestEmailSend) Validate

func (form *TestEmailSend) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserEmailChangeConfirm

type UserEmailChangeConfirm struct {
	Token    string `form:"token" json:"token"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

UserEmailChangeConfirm specifies a user email change confirmation form.

func NewUserEmailChangeConfirm

func NewUserEmailChangeConfirm(app core.App) *UserEmailChangeConfirm

NewUserEmailChangeConfirm creates a new UserEmailChangeConfirm form with initializer config created from the provided core.App instance.

This factory method is used primarily for convenience (and backward compatibility). If you want to submit the form as part of another transaction, use NewUserEmailChangeConfirmWithConfig with explicitly set Dao.

func NewUserEmailChangeConfirmWithConfig

func NewUserEmailChangeConfirmWithConfig(config UserEmailChangeConfirmConfig) *UserEmailChangeConfirm

NewUserEmailChangeConfirmWithConfig creates a new UserEmailChangeConfirm form with the provided config or panics on invalid configuration.

func (*UserEmailChangeConfirm) Submit

func (form *UserEmailChangeConfirm) Submit() (*models.User, error)

Submit validates and submits the user email change confirmation form. On success returns the updated user model associated to `form.Token`.

func (*UserEmailChangeConfirm) Validate

func (form *UserEmailChangeConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserEmailChangeConfirmConfig

type UserEmailChangeConfirmConfig struct {
	App core.App
	Dao *daos.Dao
}

UserEmailChangeConfirmConfig is the UserEmailChangeConfirm factory initializer config.

NB! App is required struct member.

type UserEmailChangeRequest

type UserEmailChangeRequest struct {
	NewEmail string `form:"newEmail" json:"newEmail"`
	// contains filtered or unexported fields
}

UserEmailChangeRequest defines a user email change request form.

func NewUserEmailChangeRequest

func NewUserEmailChangeRequest(app core.App, user *models.User) *UserEmailChangeRequest

NewUserEmailChangeRequest creates a new UserEmailChangeRequest form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserEmailChangeConfirmWithConfig with explicitly set Dao.

func NewUserEmailChangeRequestWithConfig

func NewUserEmailChangeRequestWithConfig(config UserEmailChangeRequestConfig, user *models.User) *UserEmailChangeRequest

NewUserEmailChangeRequestWithConfig creates a new UserEmailChangeRequest form with the provided config or panics on invalid configuration.

func (*UserEmailChangeRequest) Submit

func (form *UserEmailChangeRequest) Submit() error

Submit validates and sends the change email request.

func (*UserEmailChangeRequest) Validate

func (form *UserEmailChangeRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserEmailChangeRequestConfig

type UserEmailChangeRequestConfig struct {
	App core.App
	Dao *daos.Dao
}

UserEmailChangeRequestConfig is the UserEmailChangeRequest factory initializer config.

NB! App is required struct member.

type UserEmailLogin

type UserEmailLogin struct {
	Email    string `form:"email" json:"email"`
	Password string `form:"password" json:"password"`
	// contains filtered or unexported fields
}

UserEmailLogin specifies a user email/pass login form.

func NewUserEmailLogin

func NewUserEmailLogin(app core.App) *UserEmailLogin

NewUserEmailLogin creates a new UserEmailLogin form with initializer config created from the provided core.App instance.

This factory method is used primarily for convenience (and backward compatibility). If you want to submit the form as part of another transaction, use NewUserEmailLoginWithConfig with explicitly set Dao.

func NewUserEmailLoginWithConfig

func NewUserEmailLoginWithConfig(config UserEmailLoginConfig) *UserEmailLogin

NewUserEmailLoginWithConfig creates a new UserEmailLogin form with the provided config or panics on invalid configuration.

func (*UserEmailLogin) Submit

func (form *UserEmailLogin) Submit() (*models.User, error)

Submit validates and submits the form. On success returns the authorized user model.

func (*UserEmailLogin) Validate

func (form *UserEmailLogin) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserEmailLoginConfig

type UserEmailLoginConfig struct {
	App core.App
	Dao *daos.Dao
}

UserEmailLoginConfig is the UserEmailLogin factory initializer config.

NB! App is required struct member.

type UserOauth2Login

type UserOauth2Login struct {

	// The name of the OAuth2 client provider (eg. "google")
	Provider string `form:"provider" json:"provider"`

	// The authorization code returned from the initial request.
	Code string `form:"code" json:"code"`

	// The code verifier sent with the initial request as part of the code_challenge.
	CodeVerifier string `form:"codeVerifier" json:"codeVerifier"`

	// The redirect url sent with the initial request.
	RedirectUrl string `form:"redirectUrl" json:"redirectUrl"`
	// contains filtered or unexported fields
}

UserOauth2Login specifies a user Oauth2 login form.

func NewUserOauth2Login

func NewUserOauth2Login(app core.App) *UserOauth2Login

NewUserOauth2Login creates a new UserOauth2Login form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserOauth2LoginWithConfig with explicitly set Dao.

func NewUserOauth2LoginWithConfig

func NewUserOauth2LoginWithConfig(config UserOauth2LoginConfig) *UserOauth2Login

NewUserOauth2LoginWithConfig creates a new UserOauth2Login form with the provided config or panics on invalid configuration.

func (*UserOauth2Login) Submit

func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error)

Submit validates and submits the form. On success returns the authorized user model and the fetched provider's data.

func (*UserOauth2Login) Validate

func (form *UserOauth2Login) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserOauth2LoginConfig

type UserOauth2LoginConfig struct {
	App core.App
	Dao *daos.Dao
}

UserOauth2LoginConfig is the UserOauth2Login factory initializer config.

NB! App is required struct member.

type UserPasswordResetConfirm

type UserPasswordResetConfirm struct {
	Token           string `form:"token" json:"token"`
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	// contains filtered or unexported fields
}

UserPasswordResetConfirm specifies a user password reset confirmation form.

func NewUserPasswordResetConfirm

func NewUserPasswordResetConfirm(app core.App) *UserPasswordResetConfirm

NewUserPasswordResetConfirm creates a new UserPasswordResetConfirm form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserPasswordResetConfirmWithConfig with explicitly set Dao.

func NewUserPasswordResetConfirmWithConfig

func NewUserPasswordResetConfirmWithConfig(config UserPasswordResetConfirmConfig) *UserPasswordResetConfirm

NewUserPasswordResetConfirmWithConfig creates a new UserPasswordResetConfirm form with the provided config or panics on invalid configuration.

func (*UserPasswordResetConfirm) Submit

func (form *UserPasswordResetConfirm) Submit() (*models.User, error)

Submit validates and submits the form. On success returns the updated user model associated to `form.Token`.

func (*UserPasswordResetConfirm) Validate

func (form *UserPasswordResetConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserPasswordResetConfirmConfig

type UserPasswordResetConfirmConfig struct {
	App core.App
	Dao *daos.Dao
}

UserPasswordResetConfirmConfig is the UserPasswordResetConfirm factory initializer config.

NB! App is required struct member.

type UserPasswordResetRequest

type UserPasswordResetRequest struct {
	Email string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

UserPasswordResetRequest specifies a user password reset request form.

func NewUserPasswordResetRequest

func NewUserPasswordResetRequest(app core.App) *UserPasswordResetRequest

NewUserPasswordResetRequest creates a new UserPasswordResetRequest form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserPasswordResetRequestWithConfig with explicitly set Dao.

func NewUserPasswordResetRequestWithConfig

func NewUserPasswordResetRequestWithConfig(config UserPasswordResetRequestConfig) *UserPasswordResetRequest

NewUserPasswordResetRequestWithConfig creates a new UserPasswordResetRequest form with the provided config or panics on invalid configuration.

func (*UserPasswordResetRequest) Submit

func (form *UserPasswordResetRequest) Submit() error

Submit validates and submits the form. On success sends a password reset email to the `form.Email` user.

func (*UserPasswordResetRequest) Validate

func (form *UserPasswordResetRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

This method doesn't checks whether user with `form.Email` exists (this is done on Submit).

type UserPasswordResetRequestConfig

type UserPasswordResetRequestConfig struct {
	App             core.App
	Dao             *daos.Dao
	ResendThreshold float64 // in seconds
}

UserPasswordResetRequestConfig is the UserPasswordResetRequest factory initializer config.

NB! App is required struct member.

type UserUpsert

type UserUpsert struct {
	Id              string `form:"id" json:"id"`
	Email           string `form:"email" json:"email"`
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	// contains filtered or unexported fields
}

UserUpsert specifies a models.User upsert (create/update) form.

func NewUserUpsert

func NewUserUpsert(app core.App, user *models.User) *UserUpsert

NewUserUpsert creates a new UserUpsert form with initializer config created from the provided core.App instance (for create you could pass a pointer to an empty User - `&models.User{}`).

If you want to submit the form as part of another transaction, use NewUserEmailChangeConfirmWithConfig with explicitly set Dao.

func NewUserUpsertWithConfig

func NewUserUpsertWithConfig(config UserUpsertConfig, user *models.User) *UserUpsert

NewUserUpsertWithConfig creates a new UserUpsert form with the provided config and models.User instance or panics on invalid configuration (for create you could pass a pointer to an empty User - `&models.User{}`).

func (*UserUpsert) Submit

func (form *UserUpsert) Submit(interceptors ...InterceptorFunc) error

Submit validates the form and upserts the form user model.

You can optionally provide a list of InterceptorFunc to further modify the form behavior before persisting it.

func (*UserUpsert) Validate

func (form *UserUpsert) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserUpsertConfig

type UserUpsertConfig struct {
	App core.App
	Dao *daos.Dao
}

UserUpsertConfig is the UserUpsert factory initializer config.

NB! App is required struct member.

type UserVerificationConfirm

type UserVerificationConfirm struct {
	Token string `form:"token" json:"token"`
	// contains filtered or unexported fields
}

UserVerificationConfirm specifies a user email verification confirmation form.

func NewUserVerificationConfirm

func NewUserVerificationConfirm(app core.App) *UserVerificationConfirm

NewUserVerificationConfirm creates a new UserVerificationConfirm form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserVerificationConfirmWithConfig with explicitly set Dao.

func NewUserVerificationConfirmWithConfig

func NewUserVerificationConfirmWithConfig(config UserVerificationConfirmConfig) *UserVerificationConfirm

NewUserVerificationConfirmWithConfig creates a new UserVerificationConfirmConfig form with the provided config or panics on invalid configuration.

func (*UserVerificationConfirm) Submit

func (form *UserVerificationConfirm) Submit() (*models.User, error)

Submit validates and submits the form. On success returns the verified user model associated to `form.Token`.

func (*UserVerificationConfirm) Validate

func (form *UserVerificationConfirm) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

type UserVerificationConfirmConfig

type UserVerificationConfirmConfig struct {
	App core.App
	Dao *daos.Dao
}

UserVerificationConfirmConfig is the UserVerificationConfirm factory initializer config.

NB! App is required struct member.

type UserVerificationRequest

type UserVerificationRequest struct {
	Email string `form:"email" json:"email"`
	// contains filtered or unexported fields
}

UserVerificationRequest defines a user email verification request form.

func NewUserVerificationRequest

func NewUserVerificationRequest(app core.App) *UserVerificationRequest

NewUserVerificationRequest creates a new UserVerificationRequest form with initializer config created from the provided core.App instance.

If you want to submit the form as part of another transaction, use NewUserVerificationRequestWithConfig with explicitly set Dao.

func NewUserVerificationRequestWithConfig

func NewUserVerificationRequestWithConfig(config UserVerificationRequestConfig) *UserVerificationRequest

NewUserVerificationRequestWithConfig creates a new UserVerificationRequest form with the provided config or panics on invalid configuration.

func (*UserVerificationRequest) Submit

func (form *UserVerificationRequest) Submit() error

Submit validates and sends a verification request email to the `form.Email` user.

func (*UserVerificationRequest) Validate

func (form *UserVerificationRequest) Validate() error

Validate makes the form validatable by implementing validation.Validatable interface.

// This method doesn't verify that user with `form.Email` exists (this is done on Submit).

type UserVerificationRequestConfig

type UserVerificationRequestConfig struct {
	App             core.App
	Dao             *daos.Dao
	ResendThreshold float64 // in seconds
}

UserVerificationRequestConfig is the UserVerificationRequest factory initializer config.

NB! App is required struct member.

Directories

Path Synopsis
Package validators implements custom shared PocketBase validators.
Package validators implements custom shared PocketBase validators.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL