1 /*******************************************************************************
2 * Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
3 *******************************************************************************/
4 package com.att.authz.gui.pages;
6 import static com.att.xgen.html.HTMLGen.TABLE;
8 import java.io.IOException;
10 import com.att.authz.env.AuthzTrans;
11 import com.att.authz.gui.AuthGUI;
12 import com.att.authz.gui.BreadCrumbs;
13 import com.att.authz.gui.NamedCode;
14 import com.att.authz.gui.Page;
15 import org.onap.aaf.inno.env.APIException;
16 import org.onap.aaf.inno.env.Slot;
17 import com.att.xgen.Cache;
18 import com.att.xgen.DynamicCode;
19 import com.att.xgen.Mark;
20 import com.att.xgen.html.HTMLGen;
22 public class PassChangeForm extends Page {
24 static final String HREF = "/gui/passwd";
25 static final String NAME = "PassChange";
26 static final String fields[] = {"id","current","password","password2","startDate"};
28 public PassChangeForm(final AuthGUI gui, final Page ... breadcrumbs) throws APIException, IOException {
29 super(gui.env,NAME,HREF, fields,
30 new BreadCrumbs(breadcrumbs),
31 new NamedCode(true,"content") {
32 private final Slot sID = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[0]);
34 public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
35 // p tags not closing right using .p() - causes issues in IE8 password form - so using leaf for the moment
36 hgen.leaf("p").text("You are requesting a new Mechanical Password in the AAF System. " +
37 "So that you can perform clean migrations, you will be able to use both this " +
38 "new password and the old one until their respective expiration dates.").end()
39 .leaf("p").text("Note: You must be a Namespace Admin where the MechID resides.").end()
40 .incr("form","method=post");
41 Mark table = new Mark(TABLE);
43 cache.dynamic(hgen, new DynamicCode<HTMLGen, AuthGUI, AuthzTrans>() {
45 public void code(AuthGUI gui, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen hgen) throws APIException, IOException {
46 // GregorianCalendar gc = new GregorianCalendar();
47 // System.out.println(gc.toString());
48 String incomingID= trans.get(sID, "");
50 .input(fields[0],"ID*",true,"value="+incomingID)
51 .input(fields[1],"Current Password*",true,"type=password")
52 .input(fields[2],"New Password*",true, "type=password")
53 .input(fields[3], "Reenter New Password*",true, "type=password")
54 // .input(fields[3],"Start Date",false,"type=date", "value="+
55 // Chrono.dateOnlyFmt.format(new Date(System.currentTimeMillis()))
61 hgen.tagOnly("input", "type=submit", "value=Submit")