email

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailHelper

type EmailHelper struct {
	// contains filtered or unexported fields
}

func NewEmailHelper

func NewEmailHelper(store db.PostgresStore, redis redis.Store, cfg util.Config) *EmailHelper

func (*EmailHelper) ChangePasswordAuth

func (s *EmailHelper) ChangePasswordAuth(ctx context.Context, params SendEmail) error

func (*EmailHelper) CreateEmailAuth

func (s *EmailHelper) CreateEmailAuth(ctx context.Context, email string) (uuid.UUID, error)

func (*EmailHelper) SendEmail

func (s *EmailHelper) SendEmail(types NotifType, params ...string) error

NotifType is the type of notification params[0] = email address, params[1] = ip address/token, params[2] = uuid params[2] is required for signup only

func (*EmailHelper) SendEmailWithNotif

func (s *EmailHelper) SendEmailWithNotif(ctx context.Context, params SendEmail) error

func (*EmailHelper) VerifyEmailAuth

func (s *EmailHelper) VerifyEmailAuth(ctx context.Context, uid string, token int) (bool, error)

type NotifBody

type NotifBody string
const (
	NotifBodyLogin  NotifBody = "Your account was just accessed from a %v. If you did not initiate this login, please reset your password immediately."
	NotifBodySignUp NotifBody = `` /* 458-byte string literal not displayed */

	NotifBodyChangePass NotifBody = `` /* 375-byte string literal not displayed */

	NotifBodyPassChanging NotifBody = `` /* 305-byte string literal not displayed */

)

func (NotifBody) Format

func (n NotifBody) Format(Format ...string) string

here enum for the result email body for signup, the format is [0] = token, [1] = base url [2] = uuid

func (NotifBody) String

func (n NotifBody) String() string

type NotifHeader

type NotifHeader string
const (
	NotifHeaderLogin      NotifHeader = "Login Notification"
	NotifHeaderSignUp     NotifHeader = "Welcome to Project!"
	NotifHeaderChangePass NotifHeader = "Password Changed"
)

type NotifType

type NotifType string
const (
	NotifTypeLike         NotifType = "like"
	NotifTypeComment      NotifType = "comment"
	NotifTypeFollow       NotifType = "follow"
	NotifTypeMention      NotifType = "mention"
	NotifTypeShare        NotifType = "share"
	NotifTypeRetweet      NotifType = "retweet"
	NotifTypeLogin        NotifType = "login"
	NotifTypeAds          NotifType = "ads"
	NotifTypeSignUp       NotifType = "signup"
	NotifTypeChangePass   NotifType = "password change"
	NotifTypePassChanging NotifType = "password-changing"
)

type SendEmail

type SendEmail struct {
	AccountID []int64
	Params    []string
	Username  string
	Type      NotifType
	TimeSend  time.Time
}

Jump to

Keyboard shortcuts

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