payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / app.sml
diff --git a/app.sml b/app.sml
index 6d603ea..98b8c75 100644 (file)
--- a/app.sml
+++ b/app.sml
@@ -114,29 +114,29 @@ fun approve (app, msg) =
        Mail.mwrite (mail, "To: ");
        Mail.mwrite (mail, #email entry);
        Mail.mwrite (mail, "\n");
-       Mail.mwrite (mail, Util.readFile "/home/hcoop/portal/welcome.txt");
+       Mail.mwrite (mail, Util.readFile (Config.staticFilesRoot ^ "welcome.txt"));
        Mail.mwrite (mail, msg);
        OS.Process.isSuccess (Mail.mclose mail)
     end
 
 fun preAdd app =
-    ignore (C.dml (getDb ()) ($`UPDATE MemberApp
-                               SET status = 5
-                               WHERE id = ^(C.intToSql app)`))
-
-fun add app =
     let
        val _ = C.dml (getDb ()) ($`UPDATE MemberApp
-                                   SET status = 4
+                                   SET status = 5
                                    WHERE id = ^(C.intToSql app)`)
 
        val app = lookupApp app
+    in
+       ()
+    end
 
-       val outf = TextIO.openOut (Config.passwordFiles ^ #name app)
+fun add app =
+    let
+       val appR = lookupApp app
     in
-       TextIO.output (outf, #unix_passwd app);
-       TextIO.output1 (outf, #"\n");
-       TextIO.closeOut outf
+       ignore (C.dml (getDb ()) ($`UPDATE MemberApp
+                                   SET status = 4
+                                   WHERE id = ^(C.intToSql app)`))
     end
 
 fun welcome app =
@@ -148,7 +148,7 @@ fun welcome app =
        Mail.mwrite (mail, "To: ");
        Mail.mwrite (mail, #email app);
        Mail.mwrite (mail, "\n");
-       Mail.mwrite (mail, Util.readFile "/home/hcoop/portal/paid.txt");
+       Mail.mwrite (mail, Util.readFile (Config.staticFilesRoot ^ "paid.txt"));
        ignore (Mail.mclose mail)
     end
 
@@ -170,9 +170,9 @@ fun readFile fname =
        before TextIO.closeIn inf
     end
 
-fun readTosBody () = readFile "/home/hcoop/public_html/tos.body.html"
-fun readTosAgree () = readFile "/home/hcoop/public_html/tos.agree.html"
-fun readTosMinorAgree () = readFile "/home/hcoop/public_html/tos.agree.minor.html"
+fun readTosBody () = readFile (Config.staticFilesRoot ^ "tos.body.html")
+fun readTosAgree () = readFile (Config.staticFilesRoot ^ "tos.agree.html")
+fun readTosMinorAgree () = readFile (Config.staticFilesRoot ^ "tos.agree.minor.html")
 
 fun searchPaypal paypal =
     C.map (getDb ()) mkAppRow ($`SELECT id, name, rname, gname, email, forward, uses, other, passwd, status, applied, ipaddr, confirmed, decided,