| ACCEPTED
| REJECTED
| ADDED
+ | BEING_ADDED
val readTosBody : unit -> string
val readTosAgree : unit -> string
paypal : string option, checkout : string option }
val lookupApp : int -> app
- val listApps : status -> app list
+ val listApps : status list -> app list
val votes : int -> (int * string) list
val vote : int * int -> unit
val deny : int * string -> bool
val approve : int * string -> bool
+ val preAdd : int -> unit
val add : int -> unit
val abortAdd : int -> unit
val welcome : int -> unit
| ACCEPTED
| REJECTED
| ADDED
+ | BEING_ADDED
val statusFromInt =
fn 0 => CONFIRMING
| 2 => ACCEPTED
| 3 => REJECTED
| 4 => ADDED
+ | 5 => BEING_ADDED
| _ => raise C.Sql "Bad status"
val statusToInt =
| ACCEPTED => 2
| REJECTED => 3
| ADDED => 4
+ | BEING_ADDED => 5
fun statusFromSql v = statusFromInt (C.intFromSql v)
fun statusToSql s = C.intToSql (statusToInt s)
SOME row => mkAppRow row
| NONE => raise Fail "Membership application not found"
-fun listApps status =
+fun listApps statuses =
C.map (getDb ()) mkAppRow ($`SELECT id, name, rname, gname, email, forward, uses, other, passwd, status, applied, ipaddr, confirmed, decided,
msg, unix_passwd, paypal, checkout
FROM MemberApp
- WHERE status = ^(statusToSql status)
+ WHERE status IN (^(String.concatWith "," (map statusToSql statuses)))
AND NOT (status = 2 AND decided < CURRENT_TIMESTAMP - INTERVAL '1 MONTH')
ORDER BY applied`)
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 = 3
+ SET status = 4
WHERE id = ^(C.intToSql app)`)
val app = lookupApp app
val apply : application -> string option
val validEmail : string -> bool
- val validUser : string -> bool
+ val validUsername : string -> bool
val userExists : string -> bool
val confirm : int * string -> bool
fun validDomain s =
size s > 0 andalso size s < 100 andalso List.all validHost (String.fields (fn ch => ch = #".") s)
-fun validUser s =
- size s > 0 andalso size s < 50 andalso List.all
- (fn ch => isIdent ch orelse ch = #"." orelse ch = #"_" orelse ch = #"-" orelse ch = #"+")
- (String.explode s)
+fun validUsername name =
+ size name <= 12
+ andalso size name > 0
+ andalso Char.isLower (String.sub (name, 0))
+ andalso CharVector.all Char.isAlphaNum name
fun validEmailUser s =
size s > 0 andalso size s < 50 andalso List.all
%><h3>Please enter your contact e-mail address</h3><%
elseif uses = "" then
%><h3>Please enter your proposed uses</h3><%
- elseif not (App.validUser name) then
+ elseif not (App.validUsername name) then
%><h3>Invalid requested username</h3><%
elseif App.userExists name then
%><h3>That username is already in use.</b><h3><%
%><h3>Pending applications</h3><%
- foreach appl in App.listApps App.ACCEPTED do %>
+ foreach appl in App.listApps [App.ACCEPTED, App.BEING_ADDED] do %>
<br><hr><br>
<table class="blanks">
<tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
<tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
<tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
<tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+ <% if #status appl = App.BEING_ADDED then %><tr> <td colspan="2" align="left"><font color="red"><b>WARNING: Someone already followed the add link for this application. Maybe he forgot to finish.</b></font></td></tr><% end %>
</table>
<% if root then %>
showNormal := false;
val id = Web.stoi ($"add");
val appl = App.lookupApp id;
- App.add id %>
+ App.preAdd id %>
First, run this on deleuze:
<blockquote><tt>new-user <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
<% if showNormal then %>
<h3>Pending applications</h3>
-<% foreach appl in App.listApps App.PENDING do %>
+<% foreach appl in App.listApps [App.PENDING] do %>
<br><hr><br>
<table class="blanks">
<tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td></tr>
C.dml (getDb ()) ($`DELETE FROM WebUser WHERE id = ^(C.intToSql id)`)
fun validUsername name =
- size name <= 10
+ size name <= 12
andalso size name > 0
andalso Char.isLower (String.sub (name, 0))
andalso CharVector.all Char.isAlphaNum name
val bal = Balance.lookupBalance (#bal you);
val deposit = Balance.depositAmount (#id bal) %>
-<h3>Your balance: $<% Util.sub (#amount bal, deposit) %><br>
-Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>)</h3>
+<!--h3>Your balance: $<% Util.sub (#amount bal, deposit) %><br>
+Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>)</h3-->
+
+<h3>Your balance: $<% #amount bal %></h3>
+
<% if (iff Group.inGroupName "money" then $"lookback" = "" else $"audit" <> "") then %><h3>Sum of all active balances: $<% Balance.sumOwnedBalances () %></h3><% end %>
<a href="money?cmd=list">List all transactions</a><br>
<tr> <td><% #d trn %></td> <td><a href="money?trn=<% #id trn %>"><% Web.html (#descr trn) %></a></td> <td><% amount %>/<% #amount trn %></td> </tr>
<% end %>
</table>
-<b>Balance: $<% Util.sub (#amount bal, deposit) %></b><br>
-<b>Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>)
+<!--b>Balance: $<% Util.sub (#amount bal, deposit) %></b><br>
+<b>Deposit: $<% deposit %></b> (3 months of dues at your current <a href="pledge">pledge level</a>)-->
+
+<b>Balance: $<% #amount bal %></b>
<% val polls = Poll.listCurrentPolls ();
switch polls of
Money.applyCharges trn
end;
+ App.add ap;
+
if $"subscribe" = "on" then
if not (Pref.subscribe ("hcoop-announce", $"name" ^ Init.emailSuffix)) then
%><h3>Error subscribing to hcoop-announce</h3><%