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 AdminPasswordResetConfirm
- type AdminPasswordResetRequest
- type AdminUpsert
- type CollectionUpsert
- type CollectionsImport
- type InterceptorFunc
- type InterceptorNextFunc
- type InterceptorWithRecordFunc
- type InterceptorWithRecordNextFunc
- type RealtimeSubscribe
- type RecordEmailChangeConfirm
- type RecordEmailChangeRequest
- type RecordOAuth2Login
- type RecordPasswordLogin
- type RecordPasswordResetConfirm
- type RecordPasswordResetRequest
- type RecordUpsert
- func (form *RecordUpsert) AddFiles(key string, files ...*filesystem.File) error
- func (form *RecordUpsert) Data() map[string]any
- func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error
- func (form *RecordUpsert) LoadData(requestData map[string]any) error
- func (form *RecordUpsert) LoadRequest(r *http.Request, keyPrefix string) error
- func (form *RecordUpsert) RemoveFiles(key string, toDelete ...string) error
- func (form *RecordUpsert) SetDao(dao *daos.Dao)
- func (form *RecordUpsert) SetFullManageAccess(fullManageAccess bool)
- func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error
- func (form *RecordUpsert) Validate() error
- func (form *RecordUpsert) ValidateAndFill() error
- type RecordVerificationConfirm
- type RecordVerificationRequest
- type SettingsUpsert
- type TestEmailSend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminLogin ¶
type AdminLogin struct { Identity string `form:"identity" json:"identity"` Password string `form:"password" json:"password"` // contains filtered or unexported fields }
AdminLogin is an admin email/pass login form.
func NewAdminLogin ¶
func NewAdminLogin(app core.App) *AdminLogin
NewAdminLogin creates a new AdminLogin form initialized with the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*AdminLogin) SetDao ¶ added in v0.8.0
func (form *AdminLogin) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 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 is an admin password reset confirmation form.
func NewAdminPasswordResetConfirm ¶
func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm
NewAdminPasswordResetConfirm creates a new AdminPasswordResetConfirm form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*AdminPasswordResetConfirm) SetDao ¶ added in v0.8.0
func (form *AdminPasswordResetConfirm) SetDao(dao *daos.Dao)
SetDao replaces the form Dao instance with the provided one.
This is useful if you want to use a specific transaction Dao instance instead of the default app.Dao().
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 AdminPasswordResetRequest ¶
type AdminPasswordResetRequest struct { Email string `form:"email" json:"email"` // contains filtered or unexported fields }
AdminPasswordResetRequest is an admin password reset request form.
func NewAdminPasswordResetRequest ¶
func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest
NewAdminPasswordResetRequest creates a new AdminPasswordResetRequest form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*AdminPasswordResetRequest) SetDao ¶ added in v0.8.0
func (form *AdminPasswordResetRequest) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 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 is 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 a transaction, you can change the default Dao via [SetDao()].
func (*AdminUpsert) SetDao ¶ added in v0.8.0
func (form *AdminUpsert) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 CollectionUpsert ¶
type CollectionUpsert struct { Id string `form:"id" json:"id"` Type string `form:"type" json:"type"` 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"` Options types.JsonMap `form:"options" json:"options"` // contains filtered or unexported fields }
CollectionUpsert is 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 a transaction, you can change the default Dao via [SetDao()].
func (*CollectionUpsert) SetDao ¶ added in v0.8.0
func (form *CollectionUpsert) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 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 is 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 initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*CollectionsImport) SetDao ¶ added in v0.8.0
func (form *CollectionsImport) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 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 InterceptorWithRecordFunc ¶ added in v0.9.0
type InterceptorWithRecordFunc func(next InterceptorWithRecordNextFunc) InterceptorWithRecordNextFunc
InterceptorWithRecordFunc defines a single Record interceptor function that will execute the provided next func handler.
type InterceptorWithRecordNextFunc ¶ added in v0.9.0
InterceptorWithRecordNextFunc is a Record interceptor handler function. Usually used in combination with InterceptorWithRecordFunc.
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 RecordEmailChangeConfirm ¶ added in v0.8.0
type RecordEmailChangeConfirm struct { Token string `form:"token" json:"token"` Password string `form:"password" json:"password"` // contains filtered or unexported fields }
RecordEmailChangeConfirm is an auth record email change confirmation form.
func NewRecordEmailChangeConfirm ¶ added in v0.8.0
func NewRecordEmailChangeConfirm(app core.App, collection *models.Collection) *RecordEmailChangeConfirm
NewRecordEmailChangeConfirm creates a new RecordEmailChangeConfirm form initialized with from the provided core.App and models.Collection instances.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordEmailChangeConfirm) SetDao ¶ added in v0.8.0
func (form *RecordEmailChangeConfirm) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordEmailChangeConfirm) Submit ¶ added in v0.8.0
func (form *RecordEmailChangeConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)
Submit validates and submits the auth record email change confirmation form. On success returns the updated auth record associated to `form.Token`.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordEmailChangeConfirm) Validate ¶ added in v0.8.0
func (form *RecordEmailChangeConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordEmailChangeRequest ¶ added in v0.8.0
type RecordEmailChangeRequest struct { NewEmail string `form:"newEmail" json:"newEmail"` // contains filtered or unexported fields }
RecordEmailChangeRequest is an auth record email change request form.
func NewRecordEmailChangeRequest ¶ added in v0.8.0
func NewRecordEmailChangeRequest(app core.App, record *models.Record) *RecordEmailChangeRequest
NewRecordEmailChangeRequest creates a new RecordEmailChangeRequest form initialized with from the provided core.App and models.Record instances.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordEmailChangeRequest) SetDao ¶ added in v0.8.0
func (form *RecordEmailChangeRequest) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordEmailChangeRequest) Submit ¶ added in v0.8.0
func (form *RecordEmailChangeRequest) Submit(interceptors ...InterceptorWithRecordFunc) error
Submit validates and sends the change email request.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordEmailChangeRequest) Validate ¶ added in v0.8.0
func (form *RecordEmailChangeRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordOAuth2Login ¶ added in v0.8.0
type RecordOAuth2Login 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"` // Additional data that will be used for creating a new auth record // if an existing OAuth2 account doesn't exist. CreateData map[string]any `form:"createData" json:"createData"` // contains filtered or unexported fields }
RecordOAuth2Login is an auth record OAuth2 login form.
func NewRecordOAuth2Login ¶ added in v0.8.0
func NewRecordOAuth2Login(app core.App, collection *models.Collection, optAuthRecord *models.Record) *RecordOAuth2Login
NewRecordOAuth2Login creates a new RecordOAuth2Login form with initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordOAuth2Login) SetDao ¶ added in v0.8.0
func (form *RecordOAuth2Login) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordOAuth2Login) Submit ¶ added in v0.8.0
func (form *RecordOAuth2Login) Submit( beforeCreateFuncs ...func(createForm *RecordUpsert, authRecord *models.Record, authUser *auth.AuthUser) error, ) (*models.Record, *auth.AuthUser, error)
Submit validates and submits the form.
If an auth record doesn't exist, it will make an attempt to create it based on the fetched OAuth2 profile data via a local RecordUpsert form. You can intercept/modify the create form by setting the optional beforeCreateFuncs argument.
On success returns the authorized record model and the fetched provider's data.
func (*RecordOAuth2Login) Validate ¶ added in v0.8.0
func (form *RecordOAuth2Login) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordPasswordLogin ¶ added in v0.8.0
type RecordPasswordLogin struct { Identity string `form:"identity" json:"identity"` Password string `form:"password" json:"password"` // contains filtered or unexported fields }
RecordPasswordLogin is record username/email + password login form.
func NewRecordPasswordLogin ¶ added in v0.8.0
func NewRecordPasswordLogin(app core.App, collection *models.Collection) *RecordPasswordLogin
NewRecordPasswordLogin creates a new RecordPasswordLogin form initialized with from the provided core.App and models.Collection instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordPasswordLogin) SetDao ¶ added in v0.8.0
func (form *RecordPasswordLogin) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordPasswordLogin) Submit ¶ added in v0.8.0
func (form *RecordPasswordLogin) Submit() (*models.Record, error)
Submit validates and submits the form. On success returns the authorized record model.
func (*RecordPasswordLogin) Validate ¶ added in v0.8.0
func (form *RecordPasswordLogin) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordPasswordResetConfirm ¶ added in v0.8.0
type RecordPasswordResetConfirm struct { Token string `form:"token" json:"token"` Password string `form:"password" json:"password"` PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` // contains filtered or unexported fields }
RecordPasswordResetConfirm is an auth record password reset confirmation form.
func NewRecordPasswordResetConfirm ¶ added in v0.8.0
func NewRecordPasswordResetConfirm(app core.App, collection *models.Collection) *RecordPasswordResetConfirm
NewRecordPasswordResetConfirm creates a new RecordPasswordResetConfirm form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordPasswordResetConfirm) SetDao ¶ added in v0.8.0
func (form *RecordPasswordResetConfirm) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordPasswordResetConfirm) Submit ¶ added in v0.8.0
func (form *RecordPasswordResetConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)
Submit validates and submits the form. On success returns the updated auth record associated to `form.Token`.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordPasswordResetConfirm) Validate ¶ added in v0.8.0
func (form *RecordPasswordResetConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordPasswordResetRequest ¶ added in v0.8.0
type RecordPasswordResetRequest struct { Email string `form:"email" json:"email"` // contains filtered or unexported fields }
RecordPasswordResetRequest is an auth record reset password request form.
func NewRecordPasswordResetRequest ¶ added in v0.8.0
func NewRecordPasswordResetRequest(app core.App, collection *models.Collection) *RecordPasswordResetRequest
NewRecordPasswordResetRequest creates a new RecordPasswordResetRequest form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordPasswordResetRequest) SetDao ¶ added in v0.8.0
func (form *RecordPasswordResetRequest) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordPasswordResetRequest) Submit ¶ added in v0.8.0
func (form *RecordPasswordResetRequest) Submit(interceptors ...InterceptorWithRecordFunc) error
Submit validates and submits the form. On success, sends a password reset email to the `form.Email` auth record.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordPasswordResetRequest) Validate ¶ added in v0.8.0
func (form *RecordPasswordResetRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
This method doesn't checks whether auth record with `form.Email` exists (this is done on Submit).
type RecordUpsert ¶
type RecordUpsert struct { // base model fields Id string `json:"id"` // auth collection fields // --- Username string `json:"username"` Email string `json:"email"` EmailVisibility bool `json:"emailVisibility"` Verified bool `json:"verified"` Password string `json:"password"` PasswordConfirm string `json:"passwordConfirm"` OldPassword string `json:"oldPassword"` // contains filtered or unexported fields }
RecordUpsert is 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 a transaction, you can change the default Dao via [SetDao()].
func (*RecordUpsert) AddFiles ¶ added in v0.10.0
func (form *RecordUpsert) AddFiles(key string, files ...*filesystem.File) error
AddFiles adds the provided file(s) to the specified file field.
If the file field is a SINGLE-value file field (aka. "Max Select = 1"), then the newly added file will REPLACE the existing one. In this case if you pass more than 1 files only the first one will be assigned.
If the file field is a MULTI-value file field (aka. "Max Select > 1"), then the newly added file(s) will be APPENDED to the existing one(s).
Example
f1, _ := filesystem.NewFileFromPath("/path/to/file1.txt") f2, _ := filesystem.NewFileFromPath("/path/to/file2.txt") form.AddFiles("documents", f1, f2)
func (*RecordUpsert) Data ¶
func (form *RecordUpsert) Data() map[string]any
Data returns the loaded form's data.
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(requestData map[string]any) error
LoadData loads and normalizes the provided regular record data fields into the form.
To DELETE previously uploaded file(s) you can suffix the field name with the file index or filename (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 = null`).
func (*RecordUpsert) LoadRequest ¶ added in v0.8.0
func (form *RecordUpsert) LoadRequest(r *http.Request, keyPrefix string) error
LoadRequest extracts the json or multipart/form-data request data and lods it into the form.
File upload is supported only via multipart/form-data.
To DELETE previously uploaded file(s) you can suffix the field name with the file index or filename (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 = null`).
func (*RecordUpsert) RemoveFiles ¶ added in v0.10.0
func (form *RecordUpsert) RemoveFiles(key string, toDelete ...string) error
RemoveFiles removes a single or multiple file from the specified file field.
NB! If filesToDelete is not set it will remove all existing files assigned to the file field (including those assigned with AddFiles)!
Example
// mark only only 2 files for removal form.AddFiles("documents", "file1_aw4bdrvws6.txt", "file2_xwbs36bafv.txt") // mark all "documents" files for removal form.AddFiles("documents")
func (*RecordUpsert) SetDao ¶ added in v0.8.0
func (form *RecordUpsert) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordUpsert) SetFullManageAccess ¶ added in v0.8.0
func (form *RecordUpsert) SetFullManageAccess(fullManageAccess bool)
SetFullManageAccess sets the manageAccess bool flag of the current form to enable/disable directly changing some system record fields (often used with auth collection records).
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.
func (*RecordUpsert) ValidateAndFill ¶ added in v0.8.0
func (form *RecordUpsert) ValidateAndFill() error
type RecordVerificationConfirm ¶ added in v0.8.0
type RecordVerificationConfirm struct { Token string `form:"token" json:"token"` // contains filtered or unexported fields }
RecordVerificationConfirm is an auth record email verification confirmation form.
func NewRecordVerificationConfirm ¶ added in v0.8.0
func NewRecordVerificationConfirm(app core.App, collection *models.Collection) *RecordVerificationConfirm
NewRecordVerificationConfirm creates a new RecordVerificationConfirm form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordVerificationConfirm) SetDao ¶ added in v0.8.0
func (form *RecordVerificationConfirm) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordVerificationConfirm) Submit ¶ added in v0.8.0
func (form *RecordVerificationConfirm) Submit(interceptors ...InterceptorWithRecordFunc) (*models.Record, error)
Submit validates and submits the form. On success returns the verified auth record associated to `form.Token`.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordVerificationConfirm) Validate ¶ added in v0.8.0
func (form *RecordVerificationConfirm) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
type RecordVerificationRequest ¶ added in v0.8.0
type RecordVerificationRequest struct { Email string `form:"email" json:"email"` // contains filtered or unexported fields }
RecordVerificationRequest is an auth record email verification request form.
func NewRecordVerificationRequest ¶ added in v0.8.0
func NewRecordVerificationRequest(app core.App, collection *models.Collection) *RecordVerificationRequest
NewRecordVerificationRequest creates a new RecordVerificationRequest form initialized with from the provided core.App instance.
If you want to submit the form as part of a transaction, you can change the default Dao via [SetDao()].
func (*RecordVerificationRequest) SetDao ¶ added in v0.8.0
func (form *RecordVerificationRequest) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
func (*RecordVerificationRequest) Submit ¶ added in v0.8.0
func (form *RecordVerificationRequest) Submit(interceptors ...InterceptorWithRecordFunc) error
Submit validates and sends a verification request email to the `form.Email` auth record.
You can optionally provide a list of InterceptorWithRecordFunc to further modify the form behavior before persisting it.
func (*RecordVerificationRequest) Validate ¶ added in v0.8.0
func (form *RecordVerificationRequest) Validate() error
Validate makes the form validatable by implementing validation.Validatable interface.
// This method doesn't verify that auth record with `form.Email` exists (this is done on Submit).
type SettingsUpsert ¶
SettingsUpsert is a settings.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 a transaction, you can change the default Dao via [SetDao()].
func (*SettingsUpsert) SetDao ¶ added in v0.8.0
func (form *SettingsUpsert) SetDao(dao *daos.Dao)
SetDao replaces the default form Dao instance with the provided one.
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 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.
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_email_change_confirm.go
- record_email_change_request.go
- record_oauth2_login.go
- record_password_login.go
- record_password_reset_confirm.go
- record_password_reset_request.go
- record_upsert.go
- record_verification_confirm.go
- record_verification_request.go
- settings_upsert.go
- test_email_send.go
Directories ¶
Path | Synopsis |
---|---|
Package validators implements custom shared PocketBase validators.
|
Package validators implements custom shared PocketBase validators. |