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