feat (user): adjust for auth, hide pass

This commit is contained in:
dpurbosakti
2025-08-19 14:26:19 +07:00
parent 0c5aa0becf
commit f80cba1cf5
20 changed files with 305 additions and 35 deletions

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"`
}