aboutsummaryrefslogtreecommitdiff
path: root/db/verification.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-05 10:05:40 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commitaf542e339e5a611d2a1b5876450bee841b577640 (patch)
tree987f4fce83d49605a0a81d68fcfac9b2d57cf8a7 /db/verification.go
parent493fc8e025fd613d9faf0b573d610e4a0e0c0228 (diff)
removed redis dependency
Diffstat (limited to 'db/verification.go')
-rw-r--r--db/verification.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/db/verification.go b/db/verification.go
index 562503d..a178d52 100644
--- a/db/verification.go
+++ b/db/verification.go
@@ -491,7 +491,7 @@ func Captcha() string {
}
func HasValidation(ctx *fiber.Ctx, actor activitypub.Actor) bool {
- id, _ := GetPassword(ctx)
+ id, _ := GetPasswordFromSession(ctx)
if id == "" || (id != actor.Id && id != config.Domain) {
//http.Redirect(w, r, "/", http.StatusSeeOther)
@@ -501,19 +501,10 @@ func HasValidation(ctx *fiber.Ctx, actor activitypub.Actor) bool {
return true
}
-func GetPassword(r *fiber.Ctx) (string, string) {
- c := r.Cookies("session_token")
+func GetPasswordFromSession(r *fiber.Ctx) (string, string) {
+ cookie := r.Cookies("session_token")
- sessionToken := c
-
- response, err := Cache.Do("GET", sessionToken)
- if err != nil {
- return "", ""
- }
-
- token := fmt.Sprintf("%s", response)
-
- parts := strings.Split(token, "|")
+ parts := strings.Split(cookie, "|")
if len(parts) > 1 {
return parts[0], parts[1]