this.id = id;
try {
PreparedStatement ps = DatabaseConnection.getInstance().prepare(
- "SELECT `fname`, `lname` FROM `users` WHERE id=?");
+ "SELECT `fname`, `lname`, `dob` FROM `users` WHERE id=?");
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
fname = rs.getString(1);
lname = rs.getString(2);
+ dob = rs.getDate(3);
}
rs.close();
} catch (SQLException e) {
package org.cacert.gigi.pages.wot;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.util.HashMap;
import java.util.Map;
import org.cacert.gigi.Language;
+import org.cacert.gigi.User;
import org.cacert.gigi.output.Outputable;
+import org.cacert.gigi.output.Template;
+import org.cacert.gigi.util.HTMLEncoder;
public class AssuranceForm implements Outputable {
+ User assuree;
+ static final Template templ;
+ static {
+ templ = new Template(new InputStreamReader(
+ AssuranceForm.class.getResourceAsStream("AssuranceForm.templ")));
+ }
+
+ public AssuranceForm(int assuree) {
+ this.assuree = new User(assuree);
+ }
@Override
public void output(PrintWriter out, Language l, Map<String, Object> vars) {
-
+ HashMap<String, Object> res = new HashMap<String, Object>();
+ res.putAll(vars);
+ res.put("fname", HTMLEncoder.encodeHTML(assuree.getFname()));
+ res.put("mname",
+ assuree.getMname() == null ? "" : HTMLEncoder
+ .encodeHTML(assuree.getMname()));
+ res.put("lname", HTMLEncoder.encodeHTML(assuree.getLname()));
+ res.put("suffix",
+ assuree.getSuffix() == null ? "" : HTMLEncoder
+ .encodeHTML(assuree.getSuffix()));
+ templ.output(out, l, res);
}
-
}
--- /dev/null
+<form method="POST">\r
+<table class="wrapper" width="600">\r
+<tr><td colspan="2" class="title"><?=_Assurance Confirmation?></td></tr>\r
+<tr><td colspan="2" class="DataTD"><?=s,$fname,$mname,$lname,$suffix,Please check the following details match against what you witnessed when you met %s %s %s %s in person. You MUST NOT proceed unless you are sure the details are correct. You may be held responsible by the CAcert Arbitrator for any issues with this Assurance.?>\r
+</td></tr>\r
+</table>\r
+</form>
\ No newline at end of file
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.cacert.gigi.User;
import org.cacert.gigi.database.DatabaseConnection;
import org.cacert.gigi.output.DateSelector;
import org.cacert.gigi.output.Template;
+import org.cacert.gigi.pages.LoginPage;
import org.cacert.gigi.pages.Page;
public class AssurePage extends Page {
if (pi.length() > 1) {
out.println("I am a Placeholder for the Assurance form # ");
out.println(pi.substring(1));
+ User myself = LoginPage.getUser(req);
+ int mid = Integer.parseInt(pi.substring(1));
+ if (mid == myself.getId()) {
+ out.println("Cannot assure myself.");
+ return;
+ }
+
+ new AssuranceForm(mid).output(out, getLanguage(req),
+ new HashMap<String, Object>());;
} else {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("DoB", ds);