| 1 |
|
package net.sourceforge.pebble.plugins; |
| 2 |
|
|
| 3 |
|
import org.apache.commons.lang.StringEscapeUtils; |
| 4 |
|
|
| 5 |
|
import javax.servlet.jsp.JspWriter; |
| 6 |
|
import java.io.IOException; |
| 7 |
|
|
| 8 |
|
|
| 9 |
|
@author |
| 10 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0,5 |
|
| 11 |
|
public class PasswordPluginConfigType implements PluginConfigType { |
| 12 |
|
|
| 13 |
|
public static final PasswordPluginConfigType INSTANCE = new PasswordPluginConfigType(); |
| 14 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0,29 |
|
| 15 |
0
|
public void render(JspWriter writer, PluginConfig pluginConfig, String value) throws IOException {... |
| 16 |
0
|
writer.print("<input type=\"password\" name=\""); |
| 17 |
0
|
writer.print(PLUGIN_PROPERTY_NAME_PREFIX); |
| 18 |
0
|
writer.print(pluginConfig.getKey()); |
| 19 |
0
|
writer.print("\" value=\""); |
| 20 |
0
|
if (value != null) { |
| 21 |
0
|
writer.print(StringEscapeUtils.escapeHtml(value)); |
| 22 |
|
} |
| 23 |
0
|
writer.print("\"/>"); |
| 24 |
|
} |
| 25 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0,8 |
|
| 26 |
0
|
public String validate(PluginConfig pluginConfig, String value) {... |
| 27 |
0
|
String regex = pluginConfig.getProperties().getProperty("regex"); |
| 28 |
0
|
if (regex != null && value != null) |
| 29 |
|
{ |
| 30 |
0
|
if (!value.matches(regex)) |
| 31 |
|
{ |
| 32 |
0
|
return "Property " + pluginConfig.getName() + " must match regular expression " + regex; |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
| 36 |
0
|
return null; |
| 37 |
|
} |
| 38 |
|
} |