java/nekurak.net-web/web/WEB-INF/casti/registrovatUzivatele.jsp
author František Kučera <franta-hg@frantovo.cz>
Thu Mar 04 12:02:41 2010 +0100 (2010-03-04)
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)
franta-hg@51
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@51
     2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
franta-hg@51
     3
	  xmlns:c="http://java.sun.com/jsp/jstl/core"
franta-hg@51
     4
	  xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
franta-hg@51
     5
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
franta-hg@51
     6
	  version="2.0">
franta-hg@51
     7
franta-hg@51
     8
    <jsp:useBean id="uzivatel" class="cz.frantovo.nekurak.dto.Uzivatel" scope="request"/>
franta-hg@51
     9
    <jsp:useBean id="uzivatelPredRegistraci" class="cz.frantovo.nekurak.web.UzivatelPredRegistraci" scope="request"/>
franta-hg@51
    10
    <jsp:useBean id="registraceUzivatele" class="cz.frantovo.nekurak.web.RegistraceUzivatele" scope="session"/>
franta-hg@51
    11
franta-hg@51
    12
    <h1><fmt:message key="registrace.nadpis"/></h1>
franta-hg@51
    13
franta-hg@51
    14
    <c:choose>
franta-hg@51
    15
	<c:when test="${param.akceRegistrace == 'kontrola'}">
franta-hg@51
    16
	    <jsp:setProperty name="uzivatel" property="*"/>
franta-hg@51
    17
	    <jsp:setProperty name="uzivatelPredRegistraci" property="uzivatel" value="${uzivatel}"/>
franta-hg@51
    18
	    <jsp:setProperty name="registraceUzivatele" property="uzivatel" value="${uzivatelPredRegistraci}"/>
franta-hg@51
    19
franta-hg@51
    20
	    <p><fmt:message key="registrace.kontrola"/></p>
franta-hg@51
    21
franta-hg@51
    22
	    <p>
franta-hg@51
    23
		<fmt:message key="dto.uzivatel.prezdivka"/>: <c:out value="${uzivatel.prezdivka}"/><br/>
franta-hg@51
    24
		<fmt:message key="dto.uzivatel.jmeno"/>: <c:out value="${uzivatel.jmeno}"/><br/>
franta-hg@51
    25
		<fmt:message key="dto.uzivatel.prijmeni"/>: <c:out value="${uzivatel.prijmeni}"/><br/>
franta-hg@51
    26
		<fmt:message key="dto.uzivatel.email"/>: <c:out value="${uzivatel.email}"/><br/>
franta-hg@51
    27
	    </p>
franta-hg@51
    28
franta-hg@51
    29
	    <p>
franta-hg@51
    30
		<a href="?akce=registrovatUzivatele&amp;amp;akceRegistrace=dokonceni&amp;amp;token=${fn:escapeXml(uzivatelPredRegistraci.token)}">
franta-hg@51
    31
		    <fmt:message key="registrace.potvrdit"/>
franta-hg@51
    32
		</a>
franta-hg@51
    33
	    </p>
franta-hg@51
    34
franta-hg@51
    35
	</c:when>
franta-hg@51
    36
	<c:when test="${param.akceRegistrace == 'dokonceni'}">
franta-hg@51
    37
franta-hg@51
    38
	    <jsp:setProperty name="registraceUzivatele" property="token" value="${param.token}"/>
franta-hg@51
    39
franta-hg@51
    40
	    <c:choose>
franta-hg@51
    41
		<c:when test="${registraceUzivatele.dokonciRegistraci}">
franta-hg@51
    42
		    <p>
franta-hg@51
    43
			<fmt:message key="registrace.hotovo"/>&amp;#160;
franta-hg@51
    44
			<a href="?akce=prihlaseni">
franta-hg@51
    45
			    <fmt:message key="registrace.hotovo.prihlasit"/>
franta-hg@51
    46
			</a>
franta-hg@51
    47
		    </p>
franta-hg@51
    48
		</c:when>
franta-hg@51
    49
		<c:otherwise>
franta-hg@51
    50
		    <!--
franta-hg@51
    51
		    Zaznamenali jsme pokus o CSRF nebo vypršela relace
franta-hg@51
    52
		    a uživatel se pokouší dokončit registraci po dlouhé době.
franta-hg@51
    53
		    -->
franta-hg@51
    54
		    <p><fmt:message key="registrace.chybnyToken"/></p>
franta-hg@51
    55
		</c:otherwise>
franta-hg@51
    56
	    </c:choose>
franta-hg@51
    57
franta-hg@51
    58
franta-hg@51
    59
	</c:when>
franta-hg@51
    60
	<c:otherwise>
franta-hg@51
    61
	    <form method="post" action="?akce=registrovatUzivatele&amp;amp;akceRegistrace=kontrola">
franta-hg@51
    62
		<fieldset>
franta-hg@51
    63
		    <fmt:message key="dto.uzivatel.prezdivka.tip" var="prezdivkaTip"/>
franta-hg@51
    64
		    <label title="${prezdivkaTip}"><fmt:message key="dto.uzivatel.prezdivka"/>: <input type="text" name="prezdivka" maxlength="255"/></label><br/>
franta-hg@51
    65
		    <label><fmt:message key="dto.uzivatel.heslo"/>: <input type="password" name="heslo" maxlength="255"/></label><br/>
franta-hg@51
    66
		    <label><fmt:message key="dto.uzivatel.heslo.kontrola"/>: <input type="password" name="heslo_kontrola" maxlength="255"/></label><br/>
franta-hg@51
    67
		    <br/>
franta-hg@51
    68
		    <label><fmt:message key="dto.uzivatel.jmeno"/>: <input type="text" name="jmeno" maxlength="255"/></label><br/>
franta-hg@51
    69
		    <label><fmt:message key="dto.uzivatel.prijmeni"/>: <input type="text" name="prijmeni" maxlength="255"/></label><br/>
franta-hg@51
    70
		    <label><fmt:message key="dto.uzivatel.email"/>: <input type="text" name="email" maxlength="255"/></label><br/>
franta-hg@51
    71
		    <button value="submit"><fmt:message key="registrace.tlacitko"/></button>
franta-hg@51
    72
		</fieldset>
franta-hg@51
    73
	    </form>
franta-hg@51
    74
	</c:otherwise>
franta-hg@51
    75
    </c:choose>
franta-hg@51
    76
franta-hg@51
    77
franta-hg@51
    78
franta-hg@51
    79
franta-hg@51
    80
</jsp:root>