<commit_before><?php

/**
 * This page shows a username/password login form, and passes information from it
 * to the sspmod_core_Auth_UserPassBase class, which is a generic class for
 * username/password authentication.
 *
 * @author <NAME>, UNINETT AS.
 * @package simpleSAMLphp
 * @version $Id$
 */

if (!array_key_exists('AuthState', $_REQUEST)) {
	throw new SimpleSAML_Error_BadRequest('Missing AuthState parameter.');
}
$authStateId = $_REQUEST['AuthState'];

if (array_key_exists('username', $_REQUEST)) {
	$username = $_REQUEST['username'];
} else {<commit_msg>Redirect the user if refreshing the login page and the session is lost (without entering credentials). Will improve user experience<commit_after><?php

/**
 * This page shows a username/password login form, and passes information from it
 * to the sspmod_core_Auth_UserPassBase class, which is a generic class for
 * username/password authentication.
 *
 * @author <NAME>, UNINETT AS.
 * @package simpleSAMLphp
 * @version $Id$
 */

if (!array_key_exists('AuthState', $_REQUEST)) {
	throw new SimpleSAML_Error_BadRequest('Missing AuthState parameter.');
}
$authStateId = $_REQUEST['AuthState'];

try {
	/* Retrieve the authentication state. */
	$state = SimpleSAML_Auth_State::loadState($authStateId, sspmod_core_Auth_UserPassBase::STAGEID);
} catch(Exception $e) {
	if (array_key_exists('SessionLostURL', $_REQUEST)) {
		SimpleSAML_Utilities::redirect($_REQUEST['SessionLostURL']);
	}
}

if (array_key_exists('username', $_REQUEST)) {
	$username = $_REQUEST['username'];
} else {
{'fraction_non_alphanumeric': 0.1265332472562944, 'fraction_numerical': 0.0, 'mean_word_length': 5.981981981981982, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2995740', 'n_tokens_mistral': 470, 'n_tokens_neox': 464, 'n_words': 131}