authentication

package
v0.0.0-...-a9c285c Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UsernameKey = "username"
	EmailKey    = "email"
)
View Source
const (
	Matematica Materie = "Matematica"
	Biologie           = "Biologie"
	Fizica             = "Fizica"
)
View Source
const (
	A Varianta = "A"
	B          = "B"
	C          = "C"
	D          = "D"
)

Variables

This section is empty.

Functions

func Auth

func Auth() gin.HandlerFunc

func Connect

func Connect(connectionString string) (*gorm.DB, error)

func GenerateJWT

func GenerateJWT(email string, username string) (tokenString string, err error)

func Migrate

func Migrate(instance *gorm.DB) error

Types

type Calificativ

type Calificativ struct {
	Student   uint   `gorm:"primarykey" json:"student_id"`
	Profesor  uint   `json:"profesor_id"`
	Exam      string `gorm:"primarykey" json:"exam"`
	Exercitiu int    `gorm:"primarykey" json:"exercitiu"`
	Varianta  string `json:"varianta"`
}

type Clasa

type Clasa struct {
	Nume        string `gorm:"primarykey" json:"nume"`
	ProfMate    string `gorm:"foreignkey" json:"prof_mate"`
	ProfFizica  string `gorm:"foreignkey" json:"prof_fizica"`
	ProfBio     string `gorm:"foreignkey" json:"prof_bio"`
	ProfRomana  string `gorm:"foreignkey" json:"prof_romana"`
	ProfEngleza string `gorm:"foreignkey" json:"prof_engleza"`
}

type Exam

type Exam struct {
	Nume string `gorm:"primarykey" json:"nume"`
}

type Exercitiu

type Exercitiu struct {
	Numar    string `gorm:"primarykey" json:"numar"`
	Variante string `json:"variante"`
	Materie  string `json:"materie"`
	Exam     string `gorm:"primarykey" json:"exam"`
}

type JWTClaim

type JWTClaim struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	jwt.StandardClaims
}

func ValidateToken

func ValidateToken(signedToken string) (t *JWTClaim, err error)

type Materie

type Materie string

type Profesor

type Profesor struct {
	User
	IsAdmin bool   `json:"is_admin"`
	Materie string `json:"materie"`
}

type Student

type Student struct {
	User
	Absent      bool   `json:"absent"`
	Clasa       string `gorm:"foreignkey" json:"clasa"`
	ExamStiinta string `gorm:"foreignkey" json:"exam_stiinta"`
	ExamLimba   string `gorm:"foreignkey" json:"exam_limba"`
}

func NewStudent

func NewStudent(nume, prenume, clasa, email, password, examStiinta, examLimba string) *Student

type User

type User struct {
	gorm.Model
	Nume     string `json:"nume"`
	Prenume  string `json:"prenume"`
	Username string `json:"username" gorm:"unique"`
	Email    string `json:"email"`
	Password string `json:"password"`
	Type     string `json:"type"`
}

func (*User) CheckPassword

func (user *User) CheckPassword(providedPassword string) error

func (*User) HashPassword

func (user *User) HashPassword(password string) error

type Varianta

type Varianta string

Jump to

Keyboard shortcuts

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