validation

package
v0.0.0-...-d3d53d6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Validation services

This package contains validation services implemented by itsyou.online itself.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidCode denotes that the supplied code is invalid
	ErrInvalidCode = errors.New("Invalid code")
	//ErrInvalidOrExpiredKey denotes that the key is not found, it can be invalid or expired
	ErrInvalidOrExpiredKey = errors.New("Invalid key")
)

Functions

This section is empty.

Types

type EmailService

type EmailService interface {
	Send(receipients []string, subject string, message string) (err error)
}

EmailService is the interface for an email communication channel, should be used by the IYOEmailAddressValidationService

type IYOEmailAddressValidationService

type IYOEmailAddressValidationService struct {
	EmailService EmailService
}

IYOEmailAddressValidationService is the itsyou.online implementation of a EmailAddressValidationService

func (*IYOEmailAddressValidationService) ConfirmValidation

func (service *IYOEmailAddressValidationService) ConfirmValidation(request *http.Request, key, secret string) (err error)

ConfirmValidation checks if the supplied code matches the username and key

func (*IYOEmailAddressValidationService) ExpireValidation

func (service *IYOEmailAddressValidationService) ExpireValidation(request *http.Request, key string) (err error)

ExpireValidation removes a pending validation

func (*IYOEmailAddressValidationService) IsConfirmed

func (service *IYOEmailAddressValidationService) IsConfirmed(request *http.Request, key string) (confirmed bool, err error)

IsConfirmed checks wether a validation request is already confirmed

func (*IYOEmailAddressValidationService) RequestPasswordReset

func (service *IYOEmailAddressValidationService) RequestPasswordReset(request *http.Request, username string, emails []string) (key string, err error)

RequestPasswordReset Request a password reset

func (*IYOEmailAddressValidationService) RequestValidation

func (service *IYOEmailAddressValidationService) RequestValidation(request *http.Request, username string, email string, confirmationurl string) (key string, err error)

RequestValidation validates the email address by sending an EMail

type IYOPhonenumberValidationService

type IYOPhonenumberValidationService struct {
	SMSService SMSService
}

IYOPhonenumberValidationService is the itsyou.online implementation of a PhonenumberValidationService

func (*IYOPhonenumberValidationService) ConfirmValidation

func (service *IYOPhonenumberValidationService) ConfirmValidation(request *http.Request, key, code string) (err error)

ConfirmValidation checks if the supplied code matches the username and key

func (*IYOPhonenumberValidationService) ExpireValidation

func (service *IYOPhonenumberValidationService) ExpireValidation(request *http.Request, key string) (err error)

ExpireValidation removes a pending validation

func (*IYOPhonenumberValidationService) IsConfirmed

func (service *IYOPhonenumberValidationService) IsConfirmed(request *http.Request, key string) (confirmed bool, err error)

IsConfirmed checks wether a validation request is already confirmed

func (*IYOPhonenumberValidationService) RequestValidation

func (service *IYOPhonenumberValidationService) RequestValidation(request *http.Request, username string, phonenumber user.Phonenumber, confirmationurl string) (key string, err error)

RequestValidation validates the phonenumber by sending an SMS

type SMSService

type SMSService interface {
	Send(phonenumber string, message string) (err error)
}

SMSService is the interface an sms communication channel should have to be used by the IYOPhonenumberValidationService

Jump to

Keyboard shortcuts

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