settings

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmailPage

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

EmailPage endpoint displays the users email and adds a possibility to update the email.

func PasswordPage

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

PasswordPage endpoint is a page with an empty form for updating the username. Note: Cannot be served as a static HTML page since we still need some data like username.

func UpdateEmail

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

UpdateEmail endpoint parses the data from the form page and updates the email in the database.

func UpdatePassword

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

UpdatePassword parses the password form and insert the new password in the database, hashed.

func UpdateUserEmail

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

UpdateUserEmail updates the users email in the database based on the username.

func UpdateUserPassword

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

UpdateUserPassword takes the raw password string and hashes it with BCrypt and inserts the new password into the database.

func UserPage

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

UserPage endpoint returns the private profile page or general settings page for the user.

Types

type PageData

type PageData struct {
	User  UserPageData
	Paths []helpers.Path
}

PageData struct is used for the data being rendered and should not be used in other structs.

type UserPageData

type UserPageData struct {
	Title      string
	Username   string
	UserEmail  string
	Registered string
}

UserPageData stored all of the data connected to the user for the profile and setting pages.

func GetUserSettings

func GetUserSettings(db *sql.DB, username string, title string) (UserPageData, error)

GetUserSettings gets all of the user settings from the database based on the username.

Jump to

Keyboard shortcuts

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