Documentation
¶
Index ¶
- func CheckError(err error)
- func CookieDecode(w http.ResponseWriter, r *http.Request)
- func HandlePost(r *http.Request) map[string][]string
- func ServeCreds(w http.ResponseWriter, r *http.Request)
- func ServeLogin(w http.ResponseWriter, r *http.Request)
- func ServeRegister(w http.ResponseWriter, r *http.Request)
- func ServeShow(w http.ResponseWriter, r *http.Request)
- func ServepwForget(w http.ResponseWriter, r *http.Request)
- type CookieUser
- type Creds
- type Email
- type Login
- type Password
- type Register
- type Token
- type User
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func CheckError(err error)
CheckError function check if err not nil then log the error
func CookieDecode ¶
func CookieDecode(w http.ResponseWriter, r *http.Request)
CookieDecode decode the cookie and get the username
func HandlePost ¶
HandlePost function handles Post http method Gets input from form and returns it as map[string][]string
func ServeCreds ¶
func ServeCreds(w http.ResponseWriter, r *http.Request)
ServeCreds update and delete User creds if the front-end credential has been changed
func ServeLogin ¶
func ServeLogin(w http.ResponseWriter, r *http.Request)
ServeLogin handle login process
func ServeRegister ¶
func ServeRegister(w http.ResponseWriter, r *http.Request)
ServeRegister Serve Registration
func ServeShow ¶
func ServeShow(w http.ResponseWriter, r *http.Request)
ServeShow Show User credentials
func ServepwForget ¶
func ServepwForget(w http.ResponseWriter, r *http.Request)
ServepwForget function that handles password recovery process
Types ¶
type CookieUser ¶
type CookieUser struct {
Username string `json:Username`
}
CookieUser struct holds username of the current user in the session
type Creds ¶
type Creds struct {
Updated bool `json:"Updated"`
}
Creds send Updated if the db is updated
type Login ¶
type Login struct { IsLog bool `json:"IsLog"` CookieName string `json:"CookieName"` CookieValue string `json:"CookieValue"` }
Login login struct holds values that we need in the frontend to check if we have successfully logged in
type Password ¶
type Password struct {
Updated bool `json:"Updated"`
}
Password password struct holds a value which is Updated to inform the frontend that the user password is updated
type Register ¶
type Register struct {
IsReg bool `json:"IsReg"`
}
Register IsReg value is sent to inform that the user is successfully registred
type Token ¶
type Token struct {
Code string
}
Token is the code that we send to the user to restore his password