Documentation
¶
Index ¶
- Constants
- func CheckCookie(r *http.Request) bool
- func CheckMail(email string) bool
- func ClearSession(w http.ResponseWriter)
- func GetCookieValue(r *http.Request) (string, error)
- func GetUsername(r *http.Request) (username string)
- func Login(username string, password string) bool
- func Register(username string, password string, email string) bool
- func SetSession(username string, w http.ResponseWriter) (*http.Cookie, error)
- func UpdatePassword(email, password string) bool
Constants ¶
View Source
const DB string = "./server/database.db"
DB const variable indicates the path of the sqlite3 file
Variables ¶
This section is empty.
Functions ¶
func CheckCookie ¶
CheckCookie function checks if there is already a cookie or not
func ClearSession ¶
func ClearSession(w http.ResponseWriter)
ClearSession function Clears the cookie by modifying the cookie's MaxAge
func GetCookieValue ¶
GetCookieValue From *http.request get the Cookie if available
func GetUsername ¶
GetUsername function takes http request as input and returns the username who was encoded before in the cookie
func SetSession ¶
SetSession function takes username and the http response Writer as inputs Then Encode User's username and use it as a session cookie finally sets the cookie for the user otherwise it returns an error
func UpdatePassword ¶
UpdatePassword update user password
Types ¶
This section is empty.