Registrace uživatelů. TODO:
- hashovat heslo, aby se mohl přihlásit
- generovat náhodný token (csrf)
1 <?xml version="1.0" encoding="UTF-8"?>
2 <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
3 xmlns:c="http://java.sun.com/jsp/jstl/core"
4 xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
5 xmlns:fn="http://java.sun.com/jsp/jstl/functions"
8 <jsp:useBean id="uzivatel" class="cz.frantovo.nekurak.dto.Uzivatel" scope="request"/>
9 <jsp:useBean id="uzivatelPredRegistraci" class="cz.frantovo.nekurak.web.UzivatelPredRegistraci" scope="request"/>
10 <jsp:useBean id="registraceUzivatele" class="cz.frantovo.nekurak.web.RegistraceUzivatele" scope="session"/>
12 <h1><fmt:message key="registrace.nadpis"/></h1>
15 <c:when test="${param.akceRegistrace == 'kontrola'}">
16 <jsp:setProperty name="uzivatel" property="*"/>
17 <jsp:setProperty name="uzivatelPredRegistraci" property="uzivatel" value="${uzivatel}"/>
18 <jsp:setProperty name="registraceUzivatele" property="uzivatel" value="${uzivatelPredRegistraci}"/>
20 <p><fmt:message key="registrace.kontrola"/></p>
23 <fmt:message key="dto.uzivatel.prezdivka"/>: <c:out value="${uzivatel.prezdivka}"/><br/>
24 <fmt:message key="dto.uzivatel.jmeno"/>: <c:out value="${uzivatel.jmeno}"/><br/>
25 <fmt:message key="dto.uzivatel.prijmeni"/>: <c:out value="${uzivatel.prijmeni}"/><br/>
26 <fmt:message key="dto.uzivatel.email"/>: <c:out value="${uzivatel.email}"/><br/>
30 <a href="?akce=registrovatUzivatele&amp;akceRegistrace=dokonceni&amp;token=${fn:escapeXml(uzivatelPredRegistraci.token)}">
31 <fmt:message key="registrace.potvrdit"/>
36 <c:when test="${param.akceRegistrace == 'dokonceni'}">
38 <jsp:setProperty name="registraceUzivatele" property="token" value="${param.token}"/>
41 <c:when test="${registraceUzivatele.dokonciRegistraci}">
43 <fmt:message key="registrace.hotovo"/>&#160;
44 <a href="?akce=prihlaseni">
45 <fmt:message key="registrace.hotovo.prihlasit"/>
51 Zaznamenali jsme pokus o CSRF nebo vypršela relace
52 a uživatel se pokouší dokončit registraci po dlouhé době.
54 <p><fmt:message key="registrace.chybnyToken"/></p>
61 <form method="post" action="?akce=registrovatUzivatele&amp;akceRegistrace=kontrola">
63 <fmt:message key="dto.uzivatel.prezdivka.tip" var="prezdivkaTip"/>
64 <label title="${prezdivkaTip}"><fmt:message key="dto.uzivatel.prezdivka"/>: <input type="text" name="prezdivka" maxlength="255"/></label><br/>
65 <label><fmt:message key="dto.uzivatel.heslo"/>: <input type="password" name="heslo" maxlength="255"/></label><br/>
66 <label><fmt:message key="dto.uzivatel.heslo.kontrola"/>: <input type="password" name="heslo_kontrola" maxlength="255"/></label><br/>
68 <label><fmt:message key="dto.uzivatel.jmeno"/>: <input type="text" name="jmeno" maxlength="255"/></label><br/>
69 <label><fmt:message key="dto.uzivatel.prijmeni"/>: <input type="text" name="prijmeni" maxlength="255"/></label><br/>
70 <label><fmt:message key="dto.uzivatel.email"/>: <input type="text" name="email" maxlength="255"/></label><br/>
71 <button value="submit"><fmt:message key="registrace.tlacitko"/></button>