<% /** * $RCSfile: login.jsp,v $ * $Revision: 1.1 $ * $Date: 2012/10/10 11:09:41 $ */ %> <%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> <%@ page import="com.Yasna.forum.*, com.Yasna.forum.util.*" errorPage="errorforum.jsp" %> <%@ page contentType="text/html; charset=iso-8859-1"%> <%String contextpath=request.getContextPath(); %> Common Template
  Home | About Us | FAQ | Career | Contact Us | Feedback | Ask | Forum
 
 
   
<% //////////////////////// // Authorization check // check for the existence of an authorization token Authorization authToken = SkinUtils.getUserAuthorization(request,response); // if the token was null, they're not authorized. Since this skin will // allow guests to view forums, we'll set a "guest" authentication // token String keyparam=""; keyparam=(String) request.getParameter("keyparam"); //out.print("keyparam-->"+keyparam); if(keyparam==null||keyparam.equalsIgnoreCase("")) {keyparam="";} if( authToken == null ) { out.print("authToken is null"); authToken = AuthorizationFactory.getAnonymousAuthorization(); } String reply1=(String) request.getParameter("reply"); try{ if(reply1.equalsIgnoreCase("true")){ //out.println(""); request.setAttribute("reply",true); } }catch(Exception e){ e.printStackTrace(); } //out.println(""); if (reply1==null) reply1=""; //out.print("reply1-->"+reply1); String forum1=(String) request.getParameter("forum"); if (forum1==null) forum1=""; //out.print("forum1-->"+forum1); String thread1=(String) request.getParameter("thread"); if (thread1==null) thread1=""; //out.print("thread1-->"+thread1); String message1=(String) request.getParameter("message"); if (message1==null) message1=""; String subject=(String) request.getParameter("subject"); //out.print("subject-->"+subject); if (subject==null) subject=""; //out.print("message1-->"+message1); %> <% /////////////////////// // page forum variables // do not delete these ForumFactory forumFactory = ForumFactory.getInstance(authToken); User user = forumFactory.getProfileManager().getUser(authToken.getUserID()); long userLastVisitedTime = SkinUtils.getLastVisited(request,response); %> <% ///////////////////////////// // get parameters, do a login // do a login if a login is requested boolean doLogin = ParamUtils.getBooleanParameter(request,"doLogin"); String loginUsername = ParamUtils.getParameter(request,"username"); if( loginUsername == null ) { loginUsername=""; } String loginPassword = ParamUtils.getParameter(request,"password"); if( loginPassword == null ) { loginPassword=""; } boolean autoLogin = ParamUtils.getCheckboxParameter(request,"autoLogin"); String referringPage = ParamUtils.getParameter(request,"referer"); if(keyparam=="postreply" ||keyparam.equalsIgnoreCase("postreply")) { boolean errors = false; String errorMessage = ""; if( doLogin ) { //out.println("Good Afternoon"); if( loginUsername == null || loginPassword == null ) { errors = true; errorMessage = "Please enter a username and password."; } if( !errors ) { try { SkinUtils.setUserAuthorization( request,response,loginUsername ); //out.println(""); // at this point if no exceptions were thrown, the user is // logged in, so redirect to the page that sent us here: %> <%return; } catch( UnauthorizedException e ) { errors = true; errorMessage = "Invalid username or password."; } } } } boolean errors = false; String errorMessage = ""; if( doLogin ) { if( loginUsername == null || loginPassword == null ) { errors = true; errorMessage = "Please enter a username and password."; } if( !errors ) { try { SkinUtils.setUserAuthorization( request,response,loginUsername ); // at this point if no exceptions were thrown, the user is // logged in, so redirect to the page that sent us here: //out.println(""); response.sendRedirect(referringPage); return; } catch( UnauthorizedException e ) { errors = true; errorMessage = "Invalid username or password."; } } } %> <% ////////////////////// // Header file include // The header file looks for the variable "title" String title = "Yazd Forums: Login"; %> <%@ include file="header.jsp" %> <% //////////////////// // Breadcrumb bar // The breadcrumb file looks for the variable "breadcrumbs" which // represents a navigational path, ie "Home > My Forum > Hello World" String[][] breadcrumbs = { { "Home", "home.do" }, { "Login", "" } }; %> <%@ include file="breadcrumb.jsp" %> <% /////////////////////// // breadcrumb variables // change these values to customize the look of your breadcrumb bar // Colors String loginBgcolor = "#f88a0b"; String loginFgcolor = "#fef3e5"; String loginHeaderColor = "#fdd3a4"; %>

Login

<% if( errors ) { %>

Error: <%= errorMessage %>

<% } %>
">
Username ">
Password ">
(?)

<%if(keyparam=="postreply" || keyparam.equalsIgnoreCase("postreply")){ %> Don't have an account? Create one. <%} else {%> Don't have an account? Create one. <%} %>