controllers

package
v0.0.0-...-70da31f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cliente_mongo = db.ConnectDB()
View Source
var TokenDBhandler *mongo.Collection = Cliente_mongo.Database("SOOA_users").Collection("tokens")
View Source
var UserDBhandler *mongo.Collection = Cliente_mongo.Database("SOOA_users").Collection("users")

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CreateToken

func CreateToken(userun string, seconds int, role string) models.Token

create a token given a user username and a expiration date in seconds

func GetUserByUN

func GetUserByUN(response http.ResponseWriter, request *http.Request)

func HashPassword

func HashPassword(password string) (string, error)

func Login

func Login(response http.ResponseWriter, request *http.Request)

login function that returns a token if the user is valid

func NewUser

func NewUser(response http.ResponseWriter, request *http.Request)

Types

This section is empty.

Jump to

Keyboard shortcuts

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