summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.scm7
-rw-r--r--makefile1
2 files changed, 4 insertions, 4 deletions
diff --git a/main.scm b/main.scm
index b269e23..a57d8c2 100644
--- a/main.scm
+++ b/main.scm
@@ -112,14 +112,13 @@
(define (parent-id p) (fifth p))
(define (children-count p) (sixth p))
-
-(define users (alist->hash-table '(("lawrence" . "pw") ("demo" . "pw") ("dan" . "pw"))))
+(define users (alist->hash-table `(("example" . ,(crypt "pw")))))
(define apikeys (make-hash-table))
(define (login username password)
- (let ([pw-in-db (hash-table-ref/default users username #f)])
- (and password (equal? password pw-in-db)
+ (let ([pw-hash-in-db (hash-table-ref/default users username #f)])
+ (and password (string=? (crypt password pw-hash-in-db) pw-hash-in-db)
(let ([apikey (number->string (pseudo-random-integer 340282366920938463463374607431768211455))])
(hash-table-set! apikeys apikey username)
apikey))))
diff --git a/makefile b/makefile
index 24791ff..b840280 100644
--- a/makefile
+++ b/makefile
@@ -6,6 +6,7 @@ build: ./main.scm build-cpp
# -C -Ilib/
chicken-csc -static ./main.scm \
-L -lsqlite3 \
+ -L -lcrypt \
-L lib/exif_wrapper.o \
-L /lib/libexiv2.so \
-L /usr/lib/libstdc++.so.6 \