Documentation ¶
Overview ¶
Package users - авторизация, регистрация юзеров и проверка прав для разделов сайта
Index ¶
- Constants
- Variables
- func GeneratePassword(email string) (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func GetSession(r *http.Request, name string) *sessions.Session
- func HandleGoogleCallback(w http.ResponseWriter, r *http.Request)
- func HandlerActivateUser(w http.ResponseWriter, r *http.Request)
- func HandlerProfile(w http.ResponseWriter, r *http.Request)
- func HandlerSignIn(w http.ResponseWriter, r *http.Request)
- func HandlerSignOut(w http.ResponseWriter, r *http.Request)
- func HandlerSignUp(w http.ResponseWriter, r *http.Request)
- func HashPassword(password string) interface{}
- func IsLogin(r *http.Request) string
- func SaveSession(w http.ResponseWriter, r *http.Request, id int, email string)
- func SendMail(email, password string)
- func SetSessionPath(fSession string)
- type UserRecord
Constants ¶
const NOT_AUTHORIZE = "Нет данных об авторизации!"
NOT_AUTHORIZE message for response
Variables ¶
var (
Store = sessions.NewFilesystemStore("/var/lib/php/session", []byte("travel.com.ua"))
)
Functions ¶
func GeneratePassword ¶
GeneratePassword run password by email
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GetSession ¶
GetSession return session for current user (create is needing)
func HandleGoogleCallback ¶
func HandleGoogleCallback(w http.ResponseWriter, r *http.Request)
HandleGoogleCallback Эти callback было бы неплохо регистрировать в одну общую библиотеку для авторизации
func HandlerActivateUser ¶
func HandlerActivateUser(w http.ResponseWriter, r *http.Request)
HandlerActivateUser - obsolete
func HandlerProfile ¶
func HandlerProfile(w http.ResponseWriter, r *http.Request)
HandlerProfile show data on profile current user
func HandlerSignIn ¶
func HandlerSignIn(w http.ResponseWriter, r *http.Request)
HandlerSignIn run user authorization
func HandlerSignOut ¶
func HandlerSignOut(w http.ResponseWriter, r *http.Request)
HandlerSignOut sign out current user & show authorization form
func HandlerSignUp ¶
func HandlerSignUp(w http.ResponseWriter, r *http.Request)
HandlerSignUp регистрация нового пользователя с генерацией пароля и отсылка письмо об регистрации пароль отсылаем в письме, у себя храним только кеш @/user/signup/
func HashPassword ¶
func HashPassword(password string) interface{}
HashPassword create hash from {password} & return checksumm
func SaveSession ¶
SaveSession save in session some data from user
func SendMail ¶
func SendMail(email, password string)
SendMail create mail with new {password} & send to {email}
func SetSessionPath ¶
func SetSessionPath(fSession string)
SetSessionPath set path for session storage
Types ¶
type UserRecord ¶
UserRecord for user data
func CheckUserCredentials ¶
func CheckUserCredentials(login string, password string) (row UserRecord, err error)
CheckUserCredentials check user data & return id + name