<%@ page language="java" import="com.iwon.userreg.*,com.iwon.forms.*,com.iwon.cookie.*" session="false" %> <% /* Parameters: * return_url * pchk - 1 to check password and stay signed in * err - error code from LoginHandler * uh=1 - generate usernum hash and add to return_url as "h" parameter */ RegistrationHandler.setIRCookie (request, response); String sReturnURL = FormHandler.getValue (request, "return_url"); String sRegisterJSP = "http://registration.iwon.com/reg/register.jsp"; sRegisterJSP = FormHandler.addReturnURL (sRegisterJSP, sReturnURL); boolean bCheckPassword = FormHandler.checkValue (request, "pchk", "1"); // Set temporary cookie to test whether browser accepts cookies CookieUtil.setSessionCookie (response, "acceptsCookies", "yes", false); LoginHandler handler = new LoginHandler(); boolean bError = false; String sError = ""; boolean bGenerateHash = FormHandler.checkValue (request, "uh", "1"); // Rebuild sThisURL so that it doesn't include err param StringBuffer sbQueryString = new StringBuffer (100); if (bCheckPassword) sbQueryString.append( "&pchk=1"); if (bGenerateHash) sbQueryString.append( "&uh=1"); String sThisURL = "http://registration.iwon.com/reg/login.jsp"; if (sbQueryString.length() > 0) sThisURL += "?" + sbQueryString.substring (1); sThisURL = FormHandler.addReturnURL (sThisURL, sReturnURL); String sNoPCheckURL = FormHandler.addReturnURL ("http://registration.iwon.com/reg/login.jsp", sReturnURL); String sUserNum = CookieUtil.getCookieValue (request, "user_num"); String sUserName = CookieUtil.getCookieValue (request, "user_nme"); boolean bSignedIn = sUserNum != null && sUserName != null && sUserName.length() > 0; if (!bSignedIn) bCheckPassword = false; String sErrorCode = FormHandler.getValue (request, "err"); if (sErrorCode != null) { bError = true; int iErrorCode = Integer.parseInt (sErrorCode); switch (iErrorCode) { case LoginHandler.iLOGIN_PARAM_MISSING: sError = "Please enter your member name and password."; break; case LoginHandler.iLOGIN_INVALID_NAME: sError = "The member name you have entered is incorrect. Please try again."; break; case LoginHandler.iLOGIN_INVALID_PASSWORD: sError = "The password you have entered is incorrect. Please try again."; break; case LoginHandler.iLOGIN_ACCOUNT_DISABLED: sError = "We're sorry, but your account has been deactivated."; break; default: throw new IllegalArgumentException ("Unknown error code: " + iErrorCode); } } // Delete existing cookies if (!bCheckPassword && !bError) { LoginHandler.processLogout (response); bSignedIn = false; sUserNum = null; sUserName = null; } %> iWon - Sign In
IWON : Sign in  
<% if (bError) { %>
OOPS! THERE'S A PROBLEM.
<%= sError %>
If you have lost your Member name or Password, please click here for more information.



<% } /* end if error */ %>
<% if (bCheckPassword) { %>Enter your Password and then click Sign in.<% } else { %>Enter your Member name and Password and then click Sign in.<% } %>
<% FormHandler.writeHiddenField (out, "return_url", sReturnURL); if (bGenerateHash) FormHandler.writeHiddenField (out, "uh", "1"); if (bCheckPassword) { FormHandler.writeHiddenField (out, "pchk", "1"); FormHandler.writeHiddenField (out, "membername", sUserName); } %> <% if (bCheckPassword) { %> <% } %>
Member name <% if (bCheckPassword) { %><%= sUserName %><% } else { %>" maxlength=32 size=20><% } %>
  I am not <%= sUserName %>
Password
 
I am not registered
I forgot my Member name and/or Password