<%@ page extends="oneit.servlets.jsp.FormJSP" %>

<%@ include file="/setuprequest.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>

<%! protected String getName (ServletConfig config) { return "email_verified_jsp"; } %>

<%@ include file="inc/htmlheader_nopriv.jsp" %>

<%
    ORMProcessState     process     =   (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
    ObjectTransaction   objTran     =   process.getTransaction ();
    String              nextPage    =   WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME).getLink(request);

    //to process company user verification
    String              id          =   request.getParameter("id");
    String              key         =   request.getParameter("key");
            
    if(id!=null && key!=null)
    {
        CompanyUser companyUser =   CompanyUser.searchIdPin(objTran, Long.parseLong(id), key);

        if(companyUser!=null && companyUser.getIsEmailChanged()==Boolean.TRUE)
        {
            session =   request.getSession();
            session.invalidate();
            
            session =   request.getSession(true);
            session.setAttribute("EmailToVerify", companyUser.getUser());
            
            response.sendRedirect(nextPage);
            
            return;
        }
    }
%>
    
    <h3>Verification Error</h3>
    <p><span>Access expired.</span></p>
    
<%@ include file="inc/htmlfooter_nopriv.jsp" %>