Removed visit count from view.
[microbotany.git] / register.scm
1 ;; Register a new user
2 ;;
3
4 (lambda (uri)
5   (import (chicken file)
6           (chicken io)
7           uri-common simple-sha1)
8   (for-each eval (with-input-from-file "garden.scm" read-list))
9   (let ((query (uri-query uri)))
10     (if (null? query)
11         (serve-query "User name")
12         (let* ((username (symbol->string (caar query)))
13                (hash (string->sha1sum (conc username
14                                             (number->string (pseudo-random-integer 10000))))))
15           (with-output-to-file (conc "accounts/" hash)
16             (lambda ()
17               (write (make-garden username))))
18           (redirect-permanent (update-uri uri path: '(/ "microbotany" "view.scm")
19                                               query: `((,hash . #t))))))))
20                     
21                             
22
23