authentication

package
v0.0.0-...-1bc63cf Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateAccount

func ActivateAccount(w http.ResponseWriter, r *http.Request)

ActivateAccount gets the userID from database that matches the username variable sent in.

func ActivateTokenInDB

func ActivateTokenInDB(db *sql.DB, token string) error

ActivateTokenInDB ...

func Authenticating

func Authenticating(w http.ResponseWriter, r *http.Request)

Authenticating endpoint parses the form data the user sent in and authenticates the user if it is valid.

func EmailIsValid

func EmailIsValid(email string) bool

EmailIsValid checks if the email is valid and returns it in boolean form.

func GetHost

func GetHost(db *sql.DB) (string, error)

GetHost gets the SiteUrl value in the settings table in the database.

func GetMailSender

func GetMailSender(db *sql.DB) (string, error)

GetMailSender gets the MailSender value in the settings table in the database.

func GetPasswordHashFromUsername

func GetPasswordHashFromUsername(db *sql.DB, username string) (string, error)

GetPasswordHashFromUsername returns the password hash from the database associated with the username sent in.

func GetPostmarkClient

func GetPostmarkClient(db *sql.DB) (*postmark.Client, error)

GetPostmarkClient gets the PostmarkToken value in the settings table in the database.

func GetRegistrationMailSubject

func GetRegistrationMailSubject(db *sql.DB) (string, error)

GetRegistrationMailSubject gets the RegistrationMailSubject value in the settings table in the database.

func GetUserIDFromUsername

func GetUserIDFromUsername(db *sql.DB, username string) (int, error)

GetUserIDFromUsername gets the userID from database that matches the username variable sent in.

func InsertActivationToken

func InsertActivationToken(db *sql.DB, userID int64, activationToken string) error

InsertActivationToken inserts the activation token into the database

func InsertNewUser

func InsertNewUser(db *sql.DB, email string, username string, password string) (int64, error)

InsertNewUser inserts the user into the database.

func SetSessionUsername

func SetSessionUsername(w http.ResponseWriter, r *http.Request, username string) error

SetSessionUsername sets the session username for the user to the username variable sent in.

func SignIn

func SignIn(w http.ResponseWriter, r *http.Request)

SignIn endpoint displays a HTML page.

func SignOut

func SignOut(w http.ResponseWriter, r *http.Request)

SignOut endpoint removes the username from the session.

func SignUp

func SignUp(w http.ResponseWriter, r *http.Request)

SignUp endpoint returns the Sign up HTML page.

func SignUpNewUser

func SignUpNewUser(w http.ResponseWriter, r *http.Request)

SignUpNewUser endpoint parses the form for signing up and inserts the user into the database and sends a verification email.

Types

type Page

type Page struct {
	Title string
	Paths []helpers.Path
}

Page is a generic HTML page with only the necessary data.

type VerificationMail

type VerificationMail struct {
	Host            string
	ActivationToken string
}

VerificationMail contains the data to render the verification mail HTML page.

Jump to

Keyboard shortcuts

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