@Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String action = request.getParameter("act");
        if(action != null) {
            try {
                RequestContext context = new RequestContext(request);
                if(context.isLogged()) {
                    String login = context.getLogin();
                    if(action.equals("changepass")) {
                        changePassword(login, request, response);
                        return;
                    }
                    if(action.equals("lang")) {
                        String lang = request.getParameter("lang");
                        changeLanguage(login, lang);
                        response.sendRedirect("settings.jsp?tip=ok");
                        return;
                    }
                } else {
                    if(action.equals("lang")) {
                        String lang = request.getParameter("lang");
                        changeDefaultLanguage(lang, response);
                        response.sendRedirect("index.jsp");
                    } else {
                        response.sendRedirect("login.jsp");
                    }
                    
                    return;
                }
            } catch(SQLException e) {
                log.error("SQLException caught in Settings servlet.", e);
                response.sendRedirect("error.jsp?err=dberr");
                return;
            }
        }
        
        response.sendRedirect("settings.jsp");
    }