return genLoginTemplate(context, null, "Sesjonen eksisterer ikke. Hendelsen er loggf&oslash;rt.");
return genLoginTemplate(context, null, "Sesjonen eksisterer ikke. Hendelsen er loggf&oslash;rt.", NOSESSION);
    private Template attemptLogin(HttpServletRequest request, HttpServletResponse response, Context context) throws ParseErrorException, ResourceNotFoundException, Exception {        log.finer("attemptLogin(HttpServletRequest, HttpServletResponse, Context)");        Session session = null;        String id       = request.getParameter("id");        String username = request.getParameter("username");        String password = request.getParameter("password");        // Get session        try {            session = getSession(id);            if (session == null) {                return genLoginTemplate(context, null, "Sesjonen eksisterer ikke. Hendelsen er loggf&oslash;rt.");            }        }                catch (SessionException e) {            return genLoginTemplate(context, null, e.getMessage());        }        // Authenticate        try {            Credentials c = new Credentials(username, password);            if (!session.authenticateUser(c)) {                log.info("Authentication failed");                if (getSession(id) == null) {                    // Max login tries has been reached. Session is                    // terminated.                    return genLoginTemplate(context, null, "Maks antall innloggingsfors&oslash;k er oppn&aring;dd.");                }                else                    return genLoginTemplate(context, session.getDescriptor().getID(), "Feil brukernavn/passord.");            }        }                 catch (BackendException e) {            // A user-friendly message would be preferable...            log.severe("BackendException caught and re-thrown as ServletException");            throw new ServletException(e);        }         catch (SessionException e) {            // A user-friendly message would be preferable...            log.severe("SessionException caught and re-thrown as ServletException");            throw new ServletException(e);        }        /* Success; redirect to the original session URL and         * include the updated session ID. */        response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);          response.setHeader("Location", session.getDescriptor().getURL()+"?id="+session.getDescriptor().getID());        log.info("Redirect to Mellon: "+session.getDescriptor().getURL()+"?id="+session.getDescriptor().getID());            return null; // Do not use template for redirect.    }