<commit_before><?php
class Authenticator {
    private $dbh;

    function __construct() {
	$this->dbh = Database::instance()->connection();
    }

    function authenticate($creds) {
	$query = "select status from users "
	    . "where username = ? and password = ?";
	$sth = $this->dbh->prepare($query);
	$sth->execute(array($creds['username'], $creds['password']));
	$row = $sth->fetch();

	$ret = array();
	if ($row['status'] == false) {
	    $ret['valid'] = false;
	    $ret['msg'] = 'Authentication failed';
	} elseif ($status == 'inactive') {
	    $ret['valid'] = false;
	    $ret['msg'] = 'This user account is inactive';
	} elseif ($status == 'active') {
	    $ret['valid'] = true;
	    $ret['msg'] = 'Logged in as ' . $creds['username'];
	} else {
	    $ret['valid'] = false;
	    $ret['msg'] = 'An unknown error occurred';
	}

	return $ret;
    }
}
<commit_msg>Use 'auth' as key in the result hash instead of 'valid'.<commit_after><?php
class Authenticator {
    private $dbh;

    function __construct() {
	$this->dbh = Database::instance()->connection();
    }

    function authenticate($creds) {
	$query = "select status from users "
	    . "where username = ? and password = ?";
	$sth = $this->dbh->prepare($query);
	$sth->execute(array($creds['username'], $creds['password']));
	$row = $sth->fetch();

	$ret = array();
	if ($row['status'] == false) {
	    $ret['auth'] = false;
	    $ret['msg'] = 'Authentication failed';
	} elseif ($status == 'inactive') {
	    $ret['auth'] = false;
	    $ret['msg'] = 'This user account is inactive';
	} elseif ($status == 'active') {
	    $ret['auth'] = true;
	    $ret['msg'] = 'Logged in as ' . $creds['username'];
	} else {
	    $ret['auth'] = false;
	    $ret['msg'] = 'An unknown error occurred';
	}

	return $ret;
    }
}

{'fraction_non_alphanumeric': 0.2150477259966311, 'fraction_numerical': 0.0, 'mean_word_length': 3.455, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5608456', 'n_tokens_mistral': 633, 'n_tokens_neox': 606, 'n_words': 144}