feat (user): adjust for auth, hide pass
This commit is contained in:
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package authentication
|
||||
|
||||
import (
|
||||
dg "github.com/karincake/apem/db-gorm-mysql"
|
||||
)
|
||||
|
||||
// just return the error code
|
||||
func GetAndCheck(input, condition any) (eCode string) {
|
||||
result := dg.I.Where(condition).Find(input)
|
||||
if result.Error != nil {
|
||||
return "fetch-fail"
|
||||
} else if result.RowsAffected == 0 {
|
||||
return "auth-login-incorrect"
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetDocName(id uint) string {
|
||||
return "authentication"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package authentication
|
||||
|
||||
type TokenType string
|
||||
|
||||
const AccessToken = "Access"
|
||||
const RefreshToken = "Refresh"
|
||||
|
||||
type AuthInfo struct {
|
||||
Uuid string
|
||||
User_Id int
|
||||
User_Name string
|
||||
// User_Email string
|
||||
// User_Ref_Id int
|
||||
// User_Position_Code string
|
||||
}
|
||||
|
||||
type AuthCfg struct {
|
||||
AtSecretKey string `yaml:"atSecretKey"`
|
||||
RtSecretKey string `yaml:"rtSecretKey"`
|
||||
}
|
||||
Reference in New Issue
Block a user