auth

package
v0.0.0-...-d742106 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuth

func NewAuth(cfg AuthConfig, store store, mailer mailer.Mailer) authImpl

func NewStorePg

func NewStorePg(db *sql.DB) storePg

func NewStoreSqlite

func NewStoreSqlite(db *sql.DB) storeSqlite

Types

type Auth

type Auth interface {
	Signup(email, password, lang string) (confirmationTokenStr string, err error)
	ResendConfirmationMail(email, lang string) (confirmationTokenStr string, err error)
	ConfirmSignup(confirmationTokenStr string) error
	Signin(email, password string) (sessionTokenStr string, err error)
	ForgotPasword(email, lang string) (resetTokenStr string, err error)
	ResetPassword(resetTokenStr, newPassword string) error

	ChangePassword(sessionTokenStr, oldPassword, newPassword string) error
	ChangeEmail(sessionTokenStr, password, newEmail string) error

	GetUsers(adminKey string) ([]User, error)
	CreateUser(adminKey, email, password, lang string) error
	ChangeUserPassword(adminKey, userId, newPassword string) error
	ChangeUserEmail(adminKey, userId, newEmail string) error
	RemoveUsers(adminKey string, userIds ...string) error

	RemoveUnconfirmedUsers(adminKey string) error
}

type AuthConfig

type AuthConfig struct {
	AdminKey               string
	JwtKey                 string
	MaxUnconfirmedUsersAge string
	MaxResetKeyAge         string
	FromEmail              string
	ConfirmationEmail      AuthMailConfig
	ResetPasswordEmail     AuthMailConfig
}

type AuthMailConfig

type AuthMailConfig map[string]struct {
	Subject string
	Body    string
}

type User

type User struct {
	Id          string
	CreatedAt   time.Time
	Email       string
	Lang        string
	ConfirmedAt time.Time
}

Jump to

Keyboard shortcuts

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