Files
gateway-mnp-dbc/dbcmnpsrc/FE/mnpdev/mnp/web/jsp/Login.jsp
2024-05-13 12:54:14 +02:00

131 lines
4.0 KiB
Plaintext

<%@page errorPage="ErrorPage.jsp" %>
<%@page import = "java.util.*, mnp.exception.*, mnp.objects.ui.*,mnp.utility.ui.Res,mnp.servlets.util.SessionManager"%>
<html>
<head>
<title>Pagina di Log-In</title>
<%
// Ripulisco eventualmente la sessione
System.out.println("isNew :"+request.getSession(false).isNew());
Enumeration e = session.getAttributeNames();
while(e.hasMoreElements()) {
session.removeAttribute((String)e.nextElement());
}
%>
<jsp:useBean id="LoginBean" scope="session" class="mnp.objects.ui.LoginBean" />
<jsp:setProperty name="LoginBean" property="*" />
</head>
<LINK REL="stylesheet" TYPE="text/css" HREF="<%=Res.ApplContext%>/jsp/normal.css" >
<BODY class = "normal">
<%
Res.ApplContext = request.getContextPath();
Res.ReqURL = "https://" + request.getServerName()+":"+
request.getServerPort()+
request.getContextPath();
//Res.ResAbsPath = pageContext.getServletContext().getInitParameter("applPath");
//if(true) throw new Exception("pippo");
System.out.println("Res.ApplContext :"+Res.ApplContext);
System.out.println("Res.ReqURL : "+Res.ReqURL);
System.out.println("Res.ResAbsPath : "+Res.ResAbsPath);
if(request.getParameter("Send")!=null) {
String IP = request.getRemoteAddr();
int retCode = LoginBean.checkUser();
/* * 1: login ok
* 0: errore interno
* -1: utente sconosciuto
* -2: utente già loggato
* -3: password errata
*/
//Se la sessione è vecchia NON mi interessa se l _utente è
//già Loggato...vado avanti....!
/*
System.out.println(" E' una sessione nuova : "+session.isNew());
System.out.println(" codice : "+retCode);
if( (!session.isNew()) && (retCode == -2) ){
retCode = 1;
}
*/
if(retCode!=1){
switch(retCode) {
case -3: throw new BadPasswordException();
case -2: throw new userLoggedException();
case -1: throw new userUnknownException();
case 0 :
default: throw new Exception("Errore interno");
}
}
session.setAttribute("sessionManager", new SessionManager(LoginBean.getUserID()));
%>
<jsp:forward page="/MainDispatcher"/>
<%}%>
<table width = "100%">
<TR><td width = "100%" bgcolor = "#D61414">&nbsp</td><TR>
</table>
<table width = "100%" border = "0">
<tr>
<td HEIGHT = "100%" width = "10%" bgcolor = "#D61414" valign = "top">
<IMG src ="<%=Res.ApplContext%>/images/LogoTim.gif">
</td>
<td align = "right" valign = "top" width = "90%">
<BR>
<i><b><FONT face = "Times New Roman" color = "#455598" size = 4 weight = "700">MNP-CANALE ALTERNATIVO</Font></b></i>
<form method="post" action="<%=Res.ApplContext%>/jsp/Login.jsp" name="">
<TABLE border = 0 align = "center" width = "100%">
<BR>
<TR>
<TD align = "center" colspan = "3"><FONT face = "Arial" color = "#455598" size = 4><b><u>MNP</u></b></font></TD>
</TR>
<TR><TD colspan = "3" >&nbsp</TD></TR>
<TR><TD colspan = "3" >&nbsp</TD></TR>
<TR>
<TD align = "center" colspan = "3" ><FONT face = "Arial" color = "#455598" size = 2><b><u>UserID :</u></b></FONT></TD>
</TR>
<TD align = "center" colspan = "3" ><input type="text" name="userID"></TD>
</TR>
<TR>
<TD align = "center" colspan = "3" ><FONT face = "Arial" color = "#455598" size = 2><b><u>Password :</u></b></FONT></TD>
</TR>
<TR>
<TD align = "center" colspan = "3" ><input type="password" name="password"></TD>
</TR>
<TR><TD colspan = "3">&nbsp</TD></TR>
<TR>
<TD align = "center" colspan = "3" ><input type="submit" name="Send" value=" Log-In "></TD>
</TR>
<TR><TD colspan = "3">&nbsp</TD></TR>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>&nbsp</td></tr>
</TABLE>
<!-- </td></tr></table> -->
</form>
<!-- tabella x menu verticale-->
</td>
</tr>
</table>
<!-- <hr class = "riga"> -->
<!-- tabella x menu -->
</body>
</html>