user

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package user is for authentication

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Admin

func Admin(w http.ResponseWriter, r *http.Request)

Admin is the user admin

func Auth

Authenticated handler

func Exists

func Exists(u string) bool

func Login

func Login(username, password string) (*Account, *Session, error)

Login a user

func LoginHandler

func LoginHandler(w http.ResponseWriter, r *http.Request)

func Logout

func Logout(username string, sess *Session) error

Logout the user

func LogoutHandler

func LogoutHandler(w http.ResponseWriter, r *http.Request)

func Register

func Register()

func Signup

func Signup(username, password string) error

Signup a user

func SignupHandler

func SignupHandler(w http.ResponseWriter, r *http.Request)

func Verify

func Verify(sessID, user string) error

Verify a session

Types

type Account

type Account struct {
	ID       string
	Username string
	Password string
	Created  time.Time
}

func Get

func Get(r *http.Request) (*Account, error)

type Session

type Session struct {
	ID       string
	Username string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳