Package com.sugar.users

Examples of com.sugar.users.SystemUsers


    public void contextInitialized (ServletContextEvent sce) {
        final ServletContext context = sce.getServletContext();
       
        fillSuperUserBean (context);
       
        SystemUsers sysUsers = null;
        try {
            final File data = retrieveDataFile(context);

            if (true == data.isFile()) {
                ObjectInputStream in = new ObjectInputStream (new FileInputStream (data));
View Full Code Here


    }

    @Override
    public void contextDestroyed (ServletContextEvent sce) {
        final ServletContext context = sce.getServletContext();
        final SystemUsers sysUsers = (SystemUsers) context.getAttribute ("sysUsers");
       
        if (null != sysUsers) {
            try {
                final File data = retrieveDataFile(context);
               
View Full Code Here

    protected void processRequest (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType ("text/html;charset=UTF-8");
       
        String userToDeleteLogin = (String) request.getParameter ("delete");
       
        SystemUsers sysUsers = (SystemUsers) request.getServletContext().getAttribute ("sysUsers");
        List <User> usersList = sysUsers.getUsers();
       
        usersList.remove (sysUsers.getUserByLogin (userToDeleteLogin));
       
        response.sendRedirect ("protected/adminPanel.jsp");
    }
View Full Code Here

public class LoginServlet extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
       
        final SystemUsers sysUsers = (SystemUsers) request.getServletContext().getAttribute ("sysUsers");
        final User user = (User) request.getSession().getAttribute ("user");
       
        final String login = (String) request.getParameter("login");
        final String password = (String) request.getParameter("password");
       
        final UserImpl adminUser = (UserImpl) request.getServletContext().getAttribute ("adminUser");
        if (true == adminUser.getLogin().equals(login) && true == adminUser.getPassword().equals(password)) {
            user.setLogin (login);
            user.setPassword (password);
            user.setIsAdmin (true);

            response.sendRedirect("protected/index.jsp");
        } else {
            final User sysUser = sysUsers.getUserByLogin(login);
            if (null == sysUser) {
                response.sendRedirect("protected/registration.jsp");
            } else {
                if (true == sysUser.getLogin().equals(login) && true == sysUser.getPassword().equals(password)) {
                    user.setLogin (login);
View Full Code Here

       
        if (true == isCaptchaCorrect(request)) {
            final String login = (String) request.getParameter("login");
            final String password = (String) request.getParameter("password");

            final SystemUsers sysUsers = (SystemUsers) request.getServletContext().getAttribute("sysUsers");
            User user = (User) request.getSession().getAttribute ("user");
           
            final UserImpl adminUser = (UserImpl) request.getServletContext().getAttribute ("adminUser");
            if (true == adminUser.getLogin().equals(login) && true == adminUser.getPassword().equals(password)) {
                user.setLogin (login);
                user.setPassword (password);
                user.setIsAdmin (true);

                response.sendRedirect ("protected/index.jsp");
            } else {
                final User sysUser = sysUsers.getUserByLogin (login);
                if (null == sysUser) {
                    UserImpl newUser = new UserImpl();
                    newUser.setLogin (login);
                    newUser.setPassword (password);
                    newUser.setIsAdmin (false);

                    request.getSession().setAttribute("user", newUser);

                    sysUsers.addUser(newUser);
                } else {
                    if (true == sysUser.getLogin().equals(login) && true == sysUser.getPassword().equals(password)) {
                        if (true == user.isNewUser()) {
                            user.setLogin (login);
                            user.setPassword (password);
View Full Code Here

TOP

Related Classes of com.sugar.users.SystemUsers

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.