Documentation ¶
Index ¶
- func CheckError(err error)
- func CookieDecode(w http.ResponseWriter, r *http.Request)
- func GetLogout(w http.ResponseWriter, r *http.Request)
- func HandlePost(r *http.Request) map[string][]string
- func ServeCreds(w http.ResponseWriter, r *http.Request)
- func ServeGenPw(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)
- func UploadCredFile(w http.ResponseWriter, r *http.Request)
- type CookieUser
- type Creds
- type Email
- type FileUploaded
- type GenPassword
- type Login
- type Logout
- 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 GetLogout ¶
func GetLogout(w http.ResponseWriter, r *http.Request)
GetLogout logout the user by clearing the cookie value
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)
TODO: not sure 100% need test ServeCreds update and delete User creds if the front-end credential has been changed
func ServeGenPw ¶
func ServeGenPw(w http.ResponseWriter, r *http.Request)
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
func UploadCredFile ¶
func UploadCredFile(w http.ResponseWriter, r *http.Request)
UploadCredFile handle uploading csv file here
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 FileUploaded ¶
FileUploaded struct holds informations about how success is the process of uploading credential file
type GenPassword ¶
type GenPassword struct {
Value string
}
type Login ¶
type Login struct {
IsLog bool `json:"IsLog"`
}
Login login struct holds values that we need in the frontend to check if we have successfully logged in
type Logout ¶
type Logout struct {
IsLogout bool `json:"IsLogout"`
}
Logout holds a bool value to indicate which the user is logged out or not
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