models

package
v0.0.0-...-baf0b24 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEmail

func CheckEmail(email string) error

CheckEmail checks the email online with full validation

func SessionEncoding

func SessionEncoding(bs []byte) string

SessionEncoding utility function to generate specific Encding for session

func SessionHash

func SessionHash(stok, data string) string

SessionHash utility function to generate hash based on token

Types

type Session

type Session struct {
	CreatedOn     time.Time     `json:"createdon" bson:"createdon"`
	UserTag       string        `json:"usertag" bson:"usertag"`
	RequestHash   string        `json:"requesthash" bson:"requesthash"`
	ResponseHash  string        `json:"responsehash" bson:"responsehash"`
	SessionToken  string        `json:"sessiontoken" bson:"sessiontoken"`
	LastUpdate    time.Time     `json:"lastupdate" bson:"lastupdate"`
	LastAccessURI string        `json:"lastaccessuri" bson:"lastaccessuri"`
	Duration      time.Duration `json:"duration" bson:"duration"`
}

Session specific user logon session

func NewSession

func NewSession(user string, dur time.Duration) *Session

NewSession create a new session

func (*Session) UpdateSession

func (s *Session) UpdateSession(data string) bool

UpdateSession the session with current time

type User

type User struct {
	Email string `json:"email" bson:"email"`
	PHash []byte `json:"phash" bson:"phash"` // Password Hash
}

User data type

func NewUser

func NewUser(email, pass string) (*User, error)

NewUser Creates a New User with proper encoding

func (User) CheckPassword

func (u User) CheckPassword(pass string) error

CheckPassword as the same suggests

func (*User) SetPassword

func (u *User) SetPassword(pass string)

SetPassword assigns the Base64 encoded Password hash

Jump to

Keyboard shortcuts

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