this.ticket = ticket;
}
- public void setName(String fname, String mname, String lname, String suffix) throws GigiApiException {
+ public boolean setName(Name newName) throws GigiApiException {
+ if (newName.equals(target.getName())) {
+ return false;
+ }
writeSELog("SE Name change");
- target.setName(new Name(fname, lname, mname, suffix));
+ target.setName(newName);
+ return true;
}
- public void setDob(Date dob) throws GigiApiException {
+ public boolean setDob(Date dob) throws GigiApiException {
+ if (dob.toString().equals(target.getDoB().toString())) {
+ return false;
+ }
writeSELog("SE dob change");
target.setDoB(dob);
+ return true;
}
public void revokeAllCertificates() throws GigiApiException {
return target;
}
+ public void submitSupportAction() throws GigiApiException {
+ target.rawUpdateUserData();
+ }
+
}
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.Template;
+import sun.security.pkcs11.Secmod.DbMode;
+
public class SupportUserDetailsForm extends Form {
private static Template t;
private SupportedUser user;
+ private DateSelector dobSelector;
+
static {
t = new Template(FindDomainForm.class.getResource("SupportUserDetailsForm.templ"));
}
public SupportUserDetailsForm(HttpServletRequest hsr, SupportedUser user) {
super(hsr);
this.user = user;
+ dobSelector = new DateSelector("dobd", "dobm", "doby", user.getTargetUser().getDoB());
}
@Override
public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException {
-
- return false;
+ if (user.getTicket() == null) {
+ return false;
+ }
+ dobSelector.update(req);
+ String fname = req.getParameter("fname");
+ String mname = req.getParameter("mname");
+ String lname = req.getParameter("lname");
+ String suffix = req.getParameter("suffix");
+ if (fname == null || mname == null || lname == null | suffix == null) {
+ throw new GigiApiException("Incomplete request!");
+ }
+ if ( !dobSelector.isValid()) {
+ throw new GigiApiException("Invalid date of birth!");
+ }
+ Name newName = new Name(fname, lname, mname, suffix);
+ if (user.setDob(dobSelector.getDate()) | user.setName(newName)) {
+ user.submitSupportAction();
+ }
+ return true;
}
@Override
vars.put("lname", name.getLname());
vars.put("suffix", name.getSuffix());
vars.put("assurer", user.canAssure());
- vars.put("dob", new DateSelector("dobd", "dobm", "doby", user.getDoB()));
+ vars.put("dob", dobSelector);
vars.put("blockedassurer", user.isInGroup(Group.BLOCKEDASSURER));
vars.put("codesign", user.isInGroup(Group.CODESIGNING));
vars.put("orgassurer", user.isInGroup(Group.ORGASSURER));