Added login and logout

This commit is contained in:
Nedim
2023-11-06 11:22:51 +01:00
parent e47336dc8d
commit 367b5d51f2
9 changed files with 359 additions and 11 deletions

18
models/session_token.go Normal file
View File

@@ -0,0 +1,18 @@
package models
type SessionToken struct {
BaseModel
UserID uint `json:"userId"`
Token string `json:"token"`
IsActive bool `json:"isActive"`
}
func (SessionToken) Update() (bool, error) {
return false, nil
}
func (SessionToken) Create() (bool, error) {
return false, nil
}
func (SessionToken) Delete() (bool, error) {
return false, nil
}

View File

@@ -2,12 +2,13 @@ package models
type User struct {
BaseModel
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Avatar string `json:"avatar"`
IsActive bool `json:"isActive" gorm:"default:false"`
CompanyID uint `json:"companyId"`
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Avatar string `json:"avatar"`
IsActive bool `json:"isActive" gorm:"default:false"`
CompanyID uint `json:"companyId"`
LoginAttempts int `gorm:"default:0"`
}
type ResetPasswordRequest struct {