<commit_before>package rgms.infrastructure;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.*;
import rgms.model.User;

/**
 *
 * @author Tyler 2
 */
public class AuthenticationManager {
    
    public static Session LoadCurrentSession() {
        return null;
    }
    
    public static Session Login(String username, String password, boolean rememberMe) {
        Session userSession = null;
        
        try {
            JDBCConnection conn = new JDBCConnection();
            
            String query = "SELECT * FROM Users WHERE Username='" + username +
                    "' AND Passphrase='" + password + "'" ;
            
            try {
                conn.getConnection();
                
                ResultSet rs = conn.executeQuery(query);
                
                /**
                 * Since usernames are unique, there should only be at most
                 * one set returned by the query
                 */
                if (rs != null && rs.next()) {
                    userSession = createSession(rs);
                }
                
                conn.setDone();
            } catch (Exception e) {
                 Logger.getLogger(AuthenticationManager.class.getName()).log(Level.SEVERE, null, e);
            }
            
        } catch (Exception ex) {
            Logger.getLogger(AuthenticationManager.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return userSession;
    }
    
    private static Session createSession(ResultSet rs) throws SQLException {
        
        
        String rsUsername = rs.getString("Username");
        String rsPassword = rs.getString("<PASSWORD>phrase");
        int rsUserId = Integer.parseInt(rs.getString("Id"));
        String rsFirstName = rs.getString("Firstname");
        String rsLastName = rs.getString("Lastname");
        String rsImageReference = rs.getString("ImageReference");

        User thisUser = new User(rsUserId, rsFirstName, rsLastName, rsUsername, rsPassword, rsImageReference);
        Session session = new Session(false, rsUserId, thisUser);
        return session;
    }
}
<commit_msg>Changes how AuthMan logs errors and Adds createUser method<commit_after>package rgms.infrastructure;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.*;

import rgms.model.User;

/**
 *
 * @author Tyler 2
 */
public class AuthenticationManager {
    
	private static final Logger logger = Logger.getLogger(AuthenticationManager.class.getName());
	
	public static Session LoadCurrentSession() {
        return null;
    }
    
    public static Session Login(String username, String password, boolean rememberMe) {
        Session userSession = null;
        
        try {
            JDBCConnection conn = new JDBCConnection();
            
            String query = "SELECT * FROM Users WHERE Username='" + username +
                    "' AND Passphrase='" + password + "'" ;
            
            try {
                conn.getConnection();
                
                ResultSet rs = conn.executeQuery(query);
                
                /**
                 * Since usernames are unique, there should only be at most
                 * one set returned by the query
                 */
                if (rs != null && rs.next()) {
                    userSession = CreateSession(rs);
                }
                
                conn.setDone();
            } catch (SQLException sql) {
                 logger.log(Level.SEVERE, "Unable to execute query: " + query, sql);
            }
            
        } catch (Exception jdbc) {
            logger.log(Level.SEVERE, "Unable to establish a connection to the JDBC", jdbc);
        }
        
        return userSession;
    }
    
    public static User CreateUser(ResultSet rs) throws SQLException {
    	String rsUsername = rs.getString("Username");
        String rsPassword = rs.getString("<PASSWORD>");
        int rsUserId = Integer.parseInt(rs.getString("Id"));
        String rsFirstName = rs.getString("Firstname");
        String rsLastName = rs.getString("Lastname");
        String rsImageReference = rs.getString("ImageReference");

        User thisUser = new User(rsUserId, rsFirstName, rsLastName, rsUsername, rsPassword, rsImageReference);
        return thisUser;
    }
    
    public static Session CreateSession(ResultSet rs) throws SQLException {
        User thisUser = CreateUser(rs);
    	Session session = new Session(false, thisUser.getId(), thisUser);
        return session;
    }
}

{'fraction_non_alphanumeric': 0.09363458613947426, 'fraction_numerical': 0.00043449923962633063, 'mean_word_length': 1.8454882571075402, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2007386', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1117, 'n_words': 305}