utils

package
v0.0.0-...-622c2fc Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecipient

func AddRecipient(name, address string)

AddRecipient adds a recipient in the recipients list A recipient can have "user@example.com" format OR

func CheckPassword

func CheckPassword(plain, storedPasswordInDatabase string) bool

CheckPassword compares a plain password with the equivelant hashed, returns true if they match, false otherwise

func GeneratePassword

func GeneratePassword(password string) (string, error)

GeneratePassword generates a hashed password from a string

func RemoveRecipient

func RemoveRecipient(address string)

RemoveRecipient removes the given recipient from the recipients list

func SendMail

func SendMail(subject, message string)

SendMail uses all values from config subject and message must be given manually

func SendMailFromTemplate

func SendMailFromTemplate(templateName, subjectTemplate string)

SendMailFromTemplate sends template based email templateName the name of the template (email body) subjectTemplate the filename of the template for the subject (email subject)

func SendSimpleMail

func SendSimpleMail(service string, port int, username, password, from, to, subject, message string)

SendSimpleMail sends mail, all values are being inserted manually

func ValidateRegistration

func ValidateRegistration(registration *Registration) []string

ValidateRegistration validates registration fields, returns a slice of strings containing errors if validation fails else the slice should be empty.

Types

type Registration

type Registration struct {
	Username   string `json:"username"`
	Password   string `json:"password"`
	PasswordRe string `json:"passwordRe"`
	Email      string `json:"email"`
}

Jump to

Keyboard shortcuts

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