Application pipeline seems to be working
authoradamch <adamch>
Sun, 18 Nov 2007 23:03:07 +0000 (23:03 +0000)
committeradamch <adamch>
Sun, 18 Nov 2007 23:03:07 +0000 (23:03 +0000)
app.sig
app.sml
apps.mlt
config.sig
config.sml
paid.txt [new file with mode: 0644]
users.mlt
welcome.txt

diff --git a/app.sig b/app.sig
index 3842d29..00cc343 100644 (file)
--- a/app.sig
+++ b/app.sig
@@ -29,4 +29,5 @@ sig
     val approve : int * string -> bool
     val add : int -> unit
     val abortAdd : int -> unit
+    val welcome : int -> unit
 end
diff --git a/app.sml b/app.sml
index 15727a6..93a94eb 100644 (file)
--- a/app.sml
+++ b/app.sml
@@ -114,9 +114,31 @@ fun approve (app, msg) =
     end
 
 fun add app =
-    ignore (C.dml (getDb ()) ($`UPDATE MemberApp
-                               SET status = 3
-                               WHERE id = ^(C.intToSql app)`))
+    let
+       val _ = C.dml (getDb ()) ($`UPDATE MemberApp
+                                   SET status = 3
+                                   WHERE id = ^(C.intToSql app)`)
+
+       val app = lookupApp app
+
+       val outf = TextIO.openOut (Config.passwordFiles ^ #name app)
+    in
+       TextIO.output (outf, #unix_passwd app);
+       TextIO.closeOut outf
+    end
+
+fun welcome app =
+    let
+       val app = lookupApp app
+
+       val mail = Mail.mopen ()
+    in
+       Mail.mwrite (mail, "To: ");
+       Mail.mwrite (mail, #email app);
+       Mail.mwrite (mail, "\n");
+       Mail.mwrite (mail, Util.readFile "/home/hcoop/portal/paid.txt");
+       ignore (Mail.mclose mail)
+    end
 
 fun abortAdd app =
     ignore (C.dml (getDb ()) ($`UPDATE MemberApp
index af6e1bf..395beca 100644 (file)
--- a/apps.mlt
+++ b/apps.mlt
@@ -87,10 +87,8 @@ elseif $"add" <> "" then
        val appl = App.lookupApp id;
        App.add id %>
 
-First, create this UNIX user:
-<blockquote><tt>portal_adduser <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
-
-<p>You should then run <tt>visudo</tt> to add <% #name appl %> to the <tt>MEMBERS</tt> group.  If you're not transmitting <% #name appl %>'s password to him by other means, run <tt>savepass <% #name appl %> &lt;password&gt;</tt> to save it in <tt>~<% #name appl %>/.pass</tt>.  If <% #name appl %> is bootstrapping with public-key ssh, don't forget to run <tt>savekey <% #name appl %> &lt;authorized_keys file location&gt;</tt>.</p>
+First, run this on deleuze:
+<blockquote><tt>magic-create-user-wrapper <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
 
 <form action="users" method="post">
 <input type="hidden" name="app" value="<% #id appl %>">
index d3ca805..22145f9 100644 (file)
@@ -6,5 +6,6 @@ val emailSuffix : string
 val boardEmail : string
 val dbstring : string
 val kerberosSuffix : string
+val passwordFiles : string
 
 end
index ab7cfec..b8c441a 100644 (file)
@@ -8,5 +8,7 @@ val boardEmail = "board" ^ emailSuffix
 val dbstring = "dbname='hcoop_hcoop' user='www-data'"
 
 val kerberosSuffix = "@HCOOP.NET"
+                    
+val passwordFiles = "/var/lib/portal/"
 
 end
diff --git a/paid.txt b/paid.txt
new file mode 100644 (file)
index 0000000..2b5cace
--- /dev/null
+++ b/paid.txt
@@ -0,0 +1,11 @@
+Bcc: payment@hcoop.net
+Subject: Your HCoop account has been created!
+From: HCoop Board of Directors <board@hcoop.net>
+
+Your new account at hcoop.net has been created.
+
+You should now read this wiki page, which contains important information for new
+members and describes how you can start using your account:
+  http://wiki2.hcoop.net/MemberManual/GettingStarted/AccountCreated
+
+It's a good idea to read it all the way through before proceeding.
index 1cd37f0..1a3201c 100644 (file)
--- a/users.mlt
+++ b/users.mlt
@@ -31,8 +31,13 @@ if $"cmd" = "Create" then
                                if not (Pref.subscribe ("hcoop-announce", $"name" ^ Init.emailSuffix)) then
                                        %><h3>Error subscribing to hcoop-announce</h3><%
                                end
-                       end %>
-                       <h3>Member added</h3>
+                       end;
+
+                       if $"nomail" = "" then
+                               App.welcome ap
+                       end
+
+                       %><h3>Member added</h3>
 <%             end
        end
 elseif $"mod" <> "" then
index 47aa515..feabf14 100644 (file)
@@ -1,9 +1,12 @@
 Subject: Welcome to HCoop!
 From: HCoop Board of Directors <board@hcoop.net>
 
-The HCoop Board of Directors has voted to accept your membership application.  Welcome to our family! :-)
+The HCoop Board of Directors has voted to accept your membership application.
+Welcome to our family! :-)
 
-You should now read this wiki page, which describes how we can complete your joining process:
-    http://wiki.hcoop.net/wiki/NewMember
+You should now read this wiki page, which describes how we can complete your
+joining process:
+  http://wiki2.hcoop.net/MemberManual/GettingStarted/NewMember
 
-It's a good idea to read it all the way through and then follow the instructions on payment and account creation.
+It's a good idea to read it all the way through and then follow the instructions
+on payment and account creation.