1 13 package info.magnolia.cms.gui.control; 14 15 import info.magnolia.cms.core.Content; 16 17 import org.apache.commons.codec.binary.Base64; 18 import org.apache.commons.lang.StringUtils; 19 20 21 26 public class Password extends ControlSuper { 27 28 public Password() { 29 } 30 31 public Password(String name, String value) { 32 super(name, value); 33 } 34 35 public Password(String name, Content websiteNode) { 36 super(name, websiteNode); 37 } 38 39 public String getHtml() { 40 StringBuffer html = new StringBuffer (); 41 String value = StringUtils.EMPTY; 42 if (this.getEncoding() == ENCODING_BASE64) { 43 String valueDecoded = new String (Base64.decodeBase64(this.getValue().getBytes())); 45 46 for (int i = 0; i < valueDecoded.length(); i++) { 47 value += " "; } 49 } 50 else if (this.getEncoding() == ENCODING_UNIX) { 51 value = StringUtils.EMPTY; 52 } 53 else { 54 value = this.getValue(); 55 } 56 html.append("<input type=\"password\""); html.append(" name=\"" + this.getName() + "\""); html.append(" id=\"" + this.getName() + "\""); html.append(" value=\"" + value + "\""); html.append(getHtmlEvents()); 61 html.append(this.getHtmlCssClass()); 62 html.append(this.getHtmlCssStyles()); 63 html.append(" />"); if (this.getSaveInfo()) { 65 html.append(this.getHtmlSaveInfo()); 66 } 67 return html.toString(); 68 } 69 } 70 | Popular Tags |