Documentation ¶
Overview ¶
Package models implements various services used for request data validation and applying changes to existing DB models through the app Dao.
Index ¶
- type AdminLogin
- type AdminLoginConfig
- type AdminPasswordResetConfirm
- type AdminPasswordResetConfirmConfig
- type AdminPasswordResetRequest
- type AdminPasswordResetRequestConfig
- type AdminUpsert
- type AdminUpsertConfig
- type CollectionUpsert
- type CollectionUpsertConfig
- type CollectionsImport
- type CollectionsImportConfig
- type InterceptorFunc
- type InterceptorNextFunc
- type RealtimeSubscribe
- type RecordUpsert
- type RecordUpsertConfig
- type SettingsUpsert
- type SettingsUpsertConfig
- type TestEmailSend
- type UserEmailChangeConfirm
- type UserEmailChangeConfirmConfig
- type UserEmailChangeRequest
- type UserEmailChangeRequestConfig
- type UserEmailLogin
- type UserEmailLoginConfig
- type UserOauth2Login
- type UserOauth2LoginConfig
- type UserPasswordResetConfirm
- type UserPasswordResetConfirmConfig
- type UserPasswordResetRequest
- type UserPasswordResetRequestConfig
- type UserUpsert
- type UserUpsertConfig
- type UserVerificationConfirm
- type UserVerificationConfirmConfig
- type UserVerificationRequest
- type UserVerificationRequestConfig
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 TxDao.
func NewAdminLoginWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewAdminPasswordResetConfirmWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewAdminPasswordResetRequestWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
type AdminPasswordResetRequestConfig struct { App core.App TxDao *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 TxDao.
func NewAdminUpsertWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewCollectionUpsertWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
CollectionUpsertConfig is the CollectionUpsert factory initializer config.
NB! App is a required struct member.
type CollectionsImport ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewCollectionsImportWithConfig ¶ added in v0.4.0
func NewCollectionsImportWithConfig(config CollectionsImportConfig) *CollectionsImport
NewCollectionsImportWithConfig creates a new CollectionsImport form with the provided config or panics on invalid configuration.
func (*CollectionsImport) Submit ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (form *CollectionsImport) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type CollectionsImportConfig ¶ added in v0.4.0
CollectionsImportConfig is the CollectionsImport factory initializer config.
NB! App is a required struct member.
type InterceptorFunc ¶ added in v0.2.4
type InterceptorFunc func(next InterceptorNextFunc) InterceptorNextFunc
InterceptorFunc defines a single interceptor function that will execute the provided next func handler.
type InterceptorNextFunc ¶ added in v0.2.4
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 TxDao.
func NewRecordUpsertWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
RecordUpsertConfig is the RecordUpsert factory initializer config.
NB! App is required struct member.
type SettingsUpsert ¶
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 TxDao.
func NewSettingsUpsertWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
SettingsUpsertConfig is the SettingsUpsert factory initializer config.
NB! App is required struct member.
type TestEmailSend ¶ added in v0.5.0
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 ¶ added in v0.5.0
func NewTestEmailSend(app core.App) *TestEmailSend
NewTestEmailSend creates and initializes new TestEmailSend form.
func (*TestEmailSend) Submit ¶ added in v0.5.0
func (form *TestEmailSend) Submit() error
Submit validates and sends a test email to the form.Email address.
func (*TestEmailSend) Validate ¶ added in v0.5.0
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 TxDao.
func NewUserEmailChangeConfirmWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserEmailChangeRequestWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserEmailLoginWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserOauth2LoginWithConfig ¶ added in v0.4.0
func NewUserOauth2LoginWithConfig(config UserOauth2LoginConfig) *UserOauth2Login
NewUserOauth2LoginWithConfig creates a new UserOauth2Login form with the provided config or panics on invalid configuration.
func (*UserOauth2Login) Submit ¶
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 ¶ added in v0.4.0
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 TxDao.
func NewUserPasswordResetConfirmWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserPasswordResetRequestWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
type UserPasswordResetRequestConfig struct { App core.App TxDao *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 TxDao.
func NewUserUpsertWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserVerificationConfirmWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 TxDao.
func NewUserVerificationRequestWithConfig ¶ added in v0.4.0
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 ¶ added in v0.4.0
type UserVerificationRequestConfig struct { App core.App TxDao *daos.Dao ResendThreshold float64 // in seconds }
UserVerificationRequestConfig is the UserVerificationRequest factory initializer config.
NB! App is required struct member.
Source Files ¶
- admin_login.go
- admin_password_reset_confirm.go
- admin_password_reset_request.go
- admin_upsert.go
- base.go
- collection_upsert.go
- collections_import.go
- realtime_subscribe.go
- record_upsert.go
- settings_upsert.go
- test_email_send.go
- user_email_change_confirm.go
- user_email_change_request.go
- user_email_login.go
- user_oauth2_login.go
- user_password_reset_confirm.go
- user_password_reset_request.go
- user_upsert.go
- user_verification_confirm.go
- user_verification_request.go
Directories ¶
Path | Synopsis |
---|---|
Package validators implements custom shared PocketBase validators.
|
Package validators implements custom shared PocketBase validators. |