auth

package
v0.0.0-...-1cb6917 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(c *gin.Context, nowip string) (userid string, err error)

Check 检测用户是否登陆 if len(nowip) > 0 check nowip == lasip 则验证通过

func ErrCodeDesc

func ErrCodeDesc(code string) string

ErrCodeDesc 错误描述

func ForgotPassword

func ForgotPassword()

ForgotPassword 忘记密码

func Login

func Login(c *gin.Context)

Login admin

func Logout

func Logout(c *gin.Context)

Logout user states

func Register

func Register(c *gin.Context)

Register admin 注册管理用户

func Renewal

func Renewal(c *gin.Context) (err error)

Renewal user states

func ResetPassword

func ResetPassword(c *gin.Context)

ResetPassword 开始密码重置 账户 接收 key:重置的对象(email,tel,username) | value:对象内容对应的内容 令牌 token 密码 passwd

func Token

func Token(c *gin.Context, jp JWTPayload) (token []byte, err error)

Token 登录后发放令牌 JWT

Types

type JWTPayload

type JWTPayload struct {
	Issuer   string
	Subject  string
	Audience []string
	UserID   string
	IP       string
}

JWTPayload ...

type ManageResets

type ManageResets struct {
	gorm.Model
	UUID   string `gorm:"type:varchar(36);not null;unique; column:uuid"` // uuid
	Method string `gorm:"type:varchar(32)"`                              // 验证方法
	Email  string `gorm:"type:varchar(512)"`                             // 邮箱
	Tel    string `gorm:"type:varchar(512)"`                             // 实名制验证
	Token  string `gorm:"type:varchar(512)"`                             // 证件类型
}

ManageResets ... 重置密码的作用

type ManageUser

type ManageUser struct {
	gorm.Model
	UUID      string `gorm:"type:varchar(64);not null;unique;column:uuid"` // 用户 uuid
	Name      string `gorm:"type:varchar(128)"`                            // 用户名
	NickName  string `gorm:"type:varchar(128);column:nick_name"`           // 昵称
	RealName  string `gorm:"type:varchar(128)"`                            // 真实姓名
	Email     string `gorm:"type:varchar(36);not null;unique"`             // 邮箱
	Tel       string `gorm:"type:varchar(16);unique"`                      // 实名制验证
	IDCard    string `gorm:"type:varchar(32);column:id_card"`              // 证件号码
	CardClass string `gorm:"type:varchar(32);column:card_class"`           // 证件类型
	Passwd    string `gorm:"type:varchar(512)"`                            // 密码
	Code      string `gorm:"type:varchar(32)"`                             // 混淆加密代码
	IP        string `gorm:"type:varchar(128);column:ip"`                  // 最近一次登陆IP
	Privilege string `gorm:"type:varchar(1024)"`                           // 拥有的权限
	Audience  string `gorm:"type:varchar(1024)"`                           // 可访问的域
}

ManageUser table Encryption of user information 用户隐私信息通过 aes 加密处理,不可直观获得

Jump to

Keyboard shortcuts

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