87 lines
1.9 KiB
Text
87 lines
1.9 KiB
Text
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
|
pageEncoding="UTF-8"%>
|
|
<%@ page import="com.stephenschafer.email.Util"%>
|
|
<%@ page import="com.stephenschafer.email.Session"%>
|
|
<%@ page import="com.stephenschafer.email.User"%>
|
|
<%
|
|
final User user = Util.identify(session);
|
|
if (user == null) {
|
|
session.setAttribute("return-servlet-path", request.getServletPath());
|
|
session.setAttribute("return-query-string", request.getQueryString());
|
|
response.sendRedirect("login.jsp");
|
|
return;
|
|
}
|
|
String message = null;
|
|
if ("post".equalsIgnoreCase(request.getMethod())) {
|
|
final String password1 = request.getParameter("password1");
|
|
final String password2 = request.getParameter("password2");
|
|
if (!password1.equals(password2)) {
|
|
message = "Passwords don't match.";
|
|
}
|
|
else {
|
|
Util.changePassword(user.getId(), password1);
|
|
response.sendRedirect("index.jsp");
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
message = null;
|
|
}
|
|
%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>Password</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
font-size: 10pt;
|
|
}
|
|
|
|
table {
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
}
|
|
|
|
table {
|
|
border-spacing: 0px;
|
|
}
|
|
|
|
table.td {
|
|
padding: 0px;
|
|
}
|
|
|
|
div.buttons {
|
|
margin-top: 10px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<%
|
|
if (message != null) {
|
|
%><div class="fail">
|
|
<%=message%>
|
|
</div>
|
|
<%
|
|
}
|
|
%><form name="register" action="register.jsp" method="post">
|
|
<table>
|
|
<tr>
|
|
<td>Password</td>
|
|
<td><input type="password" name="password1" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Confirm password</td>
|
|
<td><input type="password" name="password2" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Display name</td>
|
|
<td><input type="text" name="displayName" /></td>
|
|
</tr>
|
|
</table>
|
|
<div class="buttons">
|
|
<button type="submit">Register</button>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html>
|