feat: add gitlab oauth, cleanup code

This commit is contained in:
2024-11-17 19:49:42 +07:00
parent a6cc450ea7
commit 83d0ed380d
29 changed files with 297 additions and 89 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ package models
import (
"encoding/json"
"rul.sh/vaulterm/server/lib"
"rul.sh/vaulterm/server/utils"
)
const (
@@ -36,7 +36,7 @@ func (k *Keychain) EncryptData(data interface{}) error {
return err
}
enc, err := lib.Encrypt(string(jsonData))
enc, err := utils.Encrypt(string(jsonData))
if err == nil {
k.Data = enc
}
@@ -45,7 +45,7 @@ func (k *Keychain) EncryptData(data interface{}) error {
func (k *Keychain) DecryptData(data interface{}) error {
// Decrypt stored data
dec, err := lib.Decrypt(k.Data)
dec, err := utils.Decrypt(k.Data)
if err != nil {
return err
}
+6 -6
View File
@@ -12,12 +12,12 @@ const (
type User struct {
Model
Name string `json:"name"`
Username string `json:"username" gorm:"unique"`
Password string `json:"-"`
Email string `json:"email" gorm:"unique"`
Role string `json:"role" gorm:"default:user;not null;index:users_role_idx;type:varchar(8)"`
Image string `json:"image" gorm:"type:varchar(255)"`
Name string `json:"name"`
Username *string `json:"username" gorm:"unique"`
Password string `json:"-"`
Email *string `json:"email" gorm:"unique"`
Role string `json:"role" gorm:"default:user;not null;index:users_role_idx;type:varchar(8)"`
Image string `json:"image" gorm:"type:varchar(255)"`
Teams []*TeamMembers `json:"teams" gorm:"foreignKey:UserID"`
Accounts []*UserAccount `json:"accounts" gorm:"foreignKey:UserID"`