verifyemail

package
v0.0.0-...-db1ba95 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: ISC Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const PINDigits = 4

PINDigits is the number of digits in the PIN code.

Variables

This section is empty.

Functions

This section is empty.

Types

type PIN

type PIN int

PIN describes a PIN code.

const InvalidPIN PIN = 0000

InvalidPIN is an invalid PIN to be used as a placeholder.

func GeneratePIN

func GeneratePIN() PIN

GeneratePIN generates a random PIN code for use.

func (PIN) Format

func (pin PIN) Format() string

Format always formats the PIN as a 4-digit number without checking.

func (PIN) String

func (pin PIN) String() string

String formats a PIN code from 0001 to 9999. Anything else is invalid.

type PINStore

type PINStore interface {
	io.Closer
	acmregister.ContainsContext

	// GeneratePIN generates a new PIN that's assigned to the given email.
	//
	// TODO: invalidate the old PIN if there's already an existing one.
	GeneratePIN(discord.GuildID, discord.UserID) (PIN, error)
	// ValidatePIN validates the email associated with the given PIN. PINStores
	// should use its underlying SubmissionStore for this.
	ValidatePIN(discord.GuildID, discord.UserID, PIN) (*acmregister.MemberMetadata, error)
}

PINStore describes an interface that stores the state for verifying PINs over email.

type SMTPInfo

type SMTPInfo struct {
	Host         string
	Email        string
	Password     string
	TemplatePath string
}

type SMTPVerifier

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

func NewSMTPVerifier

func NewSMTPVerifier(info SMTPInfo, store PINStore) (*SMTPVerifier, error)

func (*SMTPVerifier) SendConfirmationEmail

func (v *SMTPVerifier) SendConfirmationEmail(ctx context.Context, member acmregister.Member) error

SendConfirmationEmail sends a confirmation email to the recipient with the email address.

type ShibbolethVerifier

type ShibbolethVerifier struct {
	// URL is a Shibboleth URL that redirects to the SSO portal.
	URL string
}

ShibbolethVerifier implements VerifyEmail.

func (ShibbolethVerifier) VerifyEmail

func (v ShibbolethVerifier) VerifyEmail(ctx context.Context, email acmregister.Email) error

VerifyEmail implements acmregister.EmailVerifier.

Jump to

Keyboard shortcuts

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