java/nekurak.net-web/web/WEB-INF/casti/registrovatUzivatele.jsp
author František Kučera <franta-hg@frantovo.cz>
Thu, 04 Mar 2010 12:02:41 +0100
changeset 51 d01685a7e07d
child 52 4c0408690ebf
permissions -rw-r--r--
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"
     6 	  version="2.0">
     7 
     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"/>
    11 
    12     <h1><fmt:message key="registrace.nadpis"/></h1>
    13 
    14     <c:choose>
    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}"/>
    19 
    20 	    <p><fmt:message key="registrace.kontrola"/></p>
    21 
    22 	    <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/>
    27 	    </p>
    28 
    29 	    <p>
    30 		<a href="?akce=registrovatUzivatele&amp;amp;akceRegistrace=dokonceni&amp;amp;token=${fn:escapeXml(uzivatelPredRegistraci.token)}">
    31 		    <fmt:message key="registrace.potvrdit"/>
    32 		</a>
    33 	    </p>
    34 
    35 	</c:when>
    36 	<c:when test="${param.akceRegistrace == 'dokonceni'}">
    37 
    38 	    <jsp:setProperty name="registraceUzivatele" property="token" value="${param.token}"/>
    39 
    40 	    <c:choose>
    41 		<c:when test="${registraceUzivatele.dokonciRegistraci}">
    42 		    <p>
    43 			<fmt:message key="registrace.hotovo"/>&amp;#160;
    44 			<a href="?akce=prihlaseni">
    45 			    <fmt:message key="registrace.hotovo.prihlasit"/>
    46 			</a>
    47 		    </p>
    48 		</c:when>
    49 		<c:otherwise>
    50 		    <!--
    51 		    Zaznamenali jsme pokus o CSRF nebo vypršela relace
    52 		    a uživatel se pokouší dokončit registraci po dlouhé době.
    53 		    -->
    54 		    <p><fmt:message key="registrace.chybnyToken"/></p>
    55 		</c:otherwise>
    56 	    </c:choose>
    57 
    58 
    59 	</c:when>
    60 	<c:otherwise>
    61 	    <form method="post" action="?akce=registrovatUzivatele&amp;amp;akceRegistrace=kontrola">
    62 		<fieldset>
    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/>
    67 		    <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>
    72 		</fieldset>
    73 	    </form>
    74 	</c:otherwise>
    75     </c:choose>
    76 
    77 
    78 
    79 
    80 </jsp:root>