Skip to content

Commit b82df28

Browse files
committed
fix backwards compat
1 parent b3d2a1d commit b82df28

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

router.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func authenticate(store *datastore.Datastore, fn http.HandlerFunc, authMethod st
133133
// logrus.Info("2", redirectURL)
134134
}
135135

136-
logrus.Info("3", redirectURL)
137136
http.Redirect(w, req, redirectURL, http.StatusMovedPermanently)
138137
return
139138
}
@@ -143,24 +142,30 @@ func authenticate(store *datastore.Datastore, fn http.HandlerFunc, authMethod st
143142
// if store.Settings.CheckCSRFViaReferrer {
144143

145144
// }
145+
logrus.Info("xx")
146146

147+
logrus.Info("method", authMethod)
147148
if authMethod == security.NoAuth {
148149
fn(w, req)
149150
return
150151
}
152+
logrus.Info("yy")
151153

152154
tableName := "person" // default
153155
api := bone.GetValue(req, "api")
154156
if api == "api" || api == "admin" {
155157
// default - backwards compatibility
156158
tableName = "person" // we already did this above, this is just for clarity. the default should ALWAYS BE person
157-
} else {
159+
} else if api != "" {
158160
tableName = api
159161
}
160162

161163
// if we are at this point then we want a login
162164
// check for a logged in user. We always check this incase we need it
163-
loggedInUser, _ := security.New(req, store).LoggedInUser()
165+
loggedInUser, err := security.New(req, store).LoggedInUser()
166+
if err != nil {
167+
logrus.Error("Something wrong with Auth", err)
168+
}
164169
if loggedInUser != nil && loggedInUser.TableName == tableName { // we are in the correct section of the website
165170
fn(w, req)
166171
return

0 commit comments

Comments
 (0)