mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
emails: fix and confirm function of all emails
both custom and standard emails tested, quite a few fixes made, including to an old bug with admin notifs.
This commit is contained in:
13
auth.go
13
auth.go
@@ -40,7 +40,11 @@ func (app *appContext) logIpErr(gc *gin.Context, user bool, out string) {
|
||||
}
|
||||
|
||||
func (app *appContext) webAuth() gin.HandlerFunc {
|
||||
return app.authenticate
|
||||
if NO_API_AUTH_DO_NOT_USE {
|
||||
return app.bogusAuthenticate
|
||||
} else {
|
||||
return app.authenticate
|
||||
}
|
||||
}
|
||||
|
||||
func (app *appContext) authLog(v any) { app.debug.PrintfCustomLevel(4, lm.FailedAuthRequest, v) }
|
||||
@@ -138,6 +142,13 @@ func (app *appContext) authenticate(gc *gin.Context) {
|
||||
gc.Next()
|
||||
}
|
||||
|
||||
// bogusAuthenticate is for use with NO_API_AUTH_DO_NOT_USE, it sets the jfId/userId value from NO_API_AUTH_FORCE_JF_ID.
|
||||
func (app *appContext) bogusAuthenticate(gc *gin.Context) {
|
||||
gc.Set("jfId", NO_API_AUTH_FORCE_JFID)
|
||||
gc.Set("userId", NO_API_AUTH_FORCE_JFID)
|
||||
gc.Next()
|
||||
}
|
||||
|
||||
func checkToken(token *jwt.Token) (interface{}, error) {
|
||||
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
|
||||
return nil, fmt.Errorf("Unexpected signing method %v", token.Header["alg"])
|
||||
|
||||
Reference in New Issue
Block a user