1 ! Copyright (c) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs kernel namespaces validators html.forms urls
4 http.server.dispatchers
5 furnace furnace.auth furnace.auth.providers furnace.actions
7 IN: furnace.auth.features.registration
9 : <register-action> ( -- action )
11 { realm "features/registration/register" } >>template
15 { "username" [ v-username ] }
16 { "realname" [ [ v-one-line ] v-optional ] }
17 { "new-password" [ v-password ] }
18 { "verify-password" [ v-password ] }
19 { "email" [ [ v-email ] v-optional ] }
20 { "captcha" [ v-captcha ] }
27 "username" value <user>
28 "realname" value >>realname
29 "new-password" value >>encoded-password
33 users new-user [ user-exists ] unless*
35 realm get init-user-profile
37 URL" $realm" <redirect>
41 : allow-registration ( login -- login )
42 <register-action> "register" add-responder ;
44 : allow-registration? ( -- ? )
45 realm get responders>> "register" swap key? ;