authweb

package
v1.3.2-0...-4312943 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired(path string) gin.HandlerFunc

AuthRequired returns the middleware that requires logged in and redirects to login page if the request is unauthorized.

func OrgRequired

func OrgRequired(path string) gin.HandlerFunc

OrgRequired returns the middleware that requires organization and redirects to org register page if the user is without org.

func Register

func Register(router gin.IRouter, conf Config)

Register register auth web in router

Types

type Config

type Config struct {
	Traced     bool
	Manager    *auth.Manager
	PathPrefix string
}

Config defines the web config.

type LoginData

type LoginData struct {
	webbase.Data

	FormInputEmail        string
	FormInputPassword     string
	FormInputCallback     string
	FormInputAction       string
	FormLoginBtnAction    string
	FormRegisterBtnAction string

	Callback string
}

LoginData defines the data for login.html template.

type PageData

type PageData struct {
	webbase.Data

	FormInputEmail string
	FormBtnAction  string
	FormInputName  string

	Users []User
	Admin bool
}

PageData defines the data for links.html template.

type User

type User struct {
	Email string
}

User defines a user data for template

type Web

type Web struct {
	webbase.Base
	// contains filtered or unexported fields
}

Web defines the web handler module.

func New

func New(conf Config) *Web

New returns a new web handler module.

func (*Web) HandleLoginForm

func (w *Web) HandleLoginForm(ginctx *gin.Context)

HandleLoginForm handle request to create org user.

func (*Web) HandleOrgRegisterForm

func (w *Web) HandleOrgRegisterForm(ginctx *gin.Context)

HandleOrgRegisterForm handle request to create org.

func (*Web) HandleSetOrgUserForm

func (w *Web) HandleSetOrgUserForm(ginctx *gin.Context)

HandleSetOrgUserForm handle request to create org user.

func (*Web) Login

func (w *Web) Login() gin.HandlerFunc

Login returns the login and register page.

func (*Web) OrgRegister

func (w *Web) OrgRegister() gin.HandlerFunc

OrgRegister sets org.

func (*Web) SetOrgUser

func (w *Web) SetOrgUser() gin.HandlerFunc

SetOrgUser sets org user.

Jump to

Keyboard shortcuts

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