users

package
v1.0.283 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package users - авторизация, регистрация юзеров и проверка прав для разделов сайта

Index

Constants

View Source
const NOT_AUTHORIZE = "Нет данных об авторизации!"

NOT_AUTHORIZE message for response

Variables

View Source
var (
	Store = sessions.NewFilesystemStore("/var/lib/php/session", []byte("travel.com.ua"))
)

Functions

func GeneratePassword

func GeneratePassword(email string) (string, error)

GeneratePassword run password by email

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

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

func GenerateRandomString(s int) (string, error)

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

func GetSession(r *http.Request, name string) *sessions.Session

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 IsLogin

func IsLogin(r *http.Request) string

IsLogin return ID current user or panic()

func SaveSession

func SaveSession(w http.ResponseWriter, r *http.Request, id int, email string)

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

type UserRecord struct {
	Id   int
	Name string
	Sex  int
}

UserRecord for user data

func CheckUserCredentials

func CheckUserCredentials(login string, password string) (row UserRecord, err error)

CheckUserCredentials check user data & return id + name

Jump to

Keyboard shortcuts

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