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