forms

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 17 Imported by: 63

Documentation

Index

Constants

View Source
const (
	TestTemplateVerification  = "verification"
	TestTemplatePasswordReset = "password-reset"
	TestTemplateEmailChange   = "email-change"
	TestTemplateOTP           = "otp"
	TestTemplateAuthAlert     = "login-alert"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleClientSecretCreate added in v0.14.0

type AppleClientSecretCreate struct {

	// ClientId is the identifier of your app (aka. Service ID).
	ClientId string `form:"clientId" json:"clientId"`

	// TeamId is a 10-character string associated with your developer account
	// (usually could be found next to your name in the Apple Developer site).
	TeamId string `form:"teamId" json:"teamId"`

	// KeyId is a 10-character key identifier generated for the "Sign in with Apple"
	// private key associated with your developer account.
	KeyId string `form:"keyId" json:"keyId"`

	// PrivateKey is the private key associated to your app.
	// Usually wrapped within -----BEGIN PRIVATE KEY----- X -----END PRIVATE KEY-----.
	PrivateKey string `form:"privateKey" json:"privateKey"`

	// Duration specifies how long the generated JWT should be considered valid.
	// The specified value must be in seconds and max 15777000 (~6months).
	Duration int `form:"duration" json:"duration"`
	// contains filtered or unexported fields
}

AppleClientSecretCreate is a form struct to generate a new Apple Client Secret.

Reference: https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens

func NewAppleClientSecretCreate added in v0.14.0

func NewAppleClientSecretCreate(app core.App) *AppleClientSecretCreate

NewAppleClientSecretCreate creates a new AppleClientSecretCreate form with initializer config created from the provided core.App instances.

func (*AppleClientSecretCreate) Submit added in v0.14.0

func (form *AppleClientSecretCreate) Submit() (string, error)

Submit validates the form and returns a new Apple Client Secret JWT.

func (*AppleClientSecretCreate) Validate added in v0.14.0

func (form *AppleClientSecretCreate) Validate() error

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

type RecordUpsert

type RecordUpsert struct {

	// extra password fields
	Password        string `form:"password" json:"password"`
	PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
	OldPassword     string `form:"oldPassword" json:"oldPassword"`
	// contains filtered or unexported fields
}

func NewRecordUpsert

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

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

func (*RecordUpsert) DrySubmit

func (form *RecordUpsert) DrySubmit(callback func(txApp core.App, drySavedRecord *core.Record) error) error

@todo consider removing and executing the Create API rule without dummy insert.

DrySubmit performs a temp form submit within a transaction and reverts it at the end. For actual record persistence, check the [RecordUpsert.Submit()] method.

This method doesn't perform validations, handle file uploads/deletes or trigger app save events!

func (*RecordUpsert) GrantManagerAccess added in v0.23.0

func (form *RecordUpsert) GrantManagerAccess()

GrantManagerAccess updates the form access level to "manager" allowing directly changing some system record fields (often used with auth collection records).

func (*RecordUpsert) GrantSuperuserAccess added in v0.23.0

func (form *RecordUpsert) GrantSuperuserAccess()

GrantSuperuserAccess updates the form access level to "superuser" allowing directly changing all system record fields, including those marked as "Hidden".

func (*RecordUpsert) HasManageAccess added in v0.23.0

func (form *RecordUpsert) HasManageAccess() bool

HasManageAccess reports whether the form has "manager" or "superuser" level access.

func (*RecordUpsert) Load added in v0.23.0

func (form *RecordUpsert) Load(data map[string]any)

Load loads the provided data into the form and the related record.

func (*RecordUpsert) ResetAccess added in v0.23.0

func (form *RecordUpsert) ResetAccess()

ResetAccess resets the form access level to the accessLevelDefault.

func (*RecordUpsert) SetApp added in v0.23.0

func (form *RecordUpsert) SetApp(app core.App)

SetApp replaces the current form app instance.

This could be used for example if you want to change at later stage before submission to change from regular -> transactional app instance.

func (*RecordUpsert) SetContext added in v0.23.0

func (form *RecordUpsert) SetContext(ctx context.Context)

SetContext assigns ctx as context of the current form.

func (*RecordUpsert) SetRecord added in v0.23.0

func (form *RecordUpsert) SetRecord(record *core.Record)

SetRecord replaces the current form record instance.

func (*RecordUpsert) Submit

func (form *RecordUpsert) Submit() error

Submit validates the form specific validations and attempts to save the form record.

type TestEmailSend added in v0.5.0

type TestEmailSend struct {
	Email      string `form:"email" json:"email"`
	Template   string `form:"template" json:"template"`
	Collection string `form:"collection" json:"collection"` // optional, fallbacks to _superusers
	// 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 TestS3Filesystem added in v0.16.0

type TestS3Filesystem struct {

	// The name of the filesystem - storage or backups
	Filesystem string `form:"filesystem" json:"filesystem"`
	// contains filtered or unexported fields
}

TestS3Filesystem defines a S3 filesystem connection test.

func NewTestS3Filesystem added in v0.16.0

func NewTestS3Filesystem(app core.App) *TestS3Filesystem

NewTestS3Filesystem creates and initializes new TestS3Filesystem form.

func (*TestS3Filesystem) Submit added in v0.16.0

func (form *TestS3Filesystem) Submit() error

Submit validates and performs a S3 filesystem connection test.

func (*TestS3Filesystem) Validate added in v0.16.0

func (form *TestS3Filesystem) Validate() error

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

Jump to

Keyboard shortcuts

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