<commit_before><%@page import="java.util.regex.*"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.sql.*"%>
<%@page import="javax.naming.*"%>
<%@page import="java.security.*"%>
<%@page import="java.util.regex.*"%>


<div id="main_column">
<%
String redir_url = "" + request.getParameter("redir");
String username = "" + request.getParameter("username");

if (username == null || "null".equals(username)) {
%>

<div style="text-align: center;">
<center>
<h2>Choose your username:</h2>

<div>
	Please choose your player name:
</div>

<form name="guest_user" action="/wireframe.jsp" method="get">
<input id="usr" type="text" size="20" name="username" value="">
<input type="hidden" name="redir" value="<%= redir_url %>">
<input type="hidden" name="do" value="guest_user">
<input class="button" type="submit" value="Login">
</form>

<br><br><br>



</div>

<script>
	$( ".button").button();
	$( "#usr").focus();
</script>


<% } else { 

  String PATTERN_VALIDATE_ALPHA_NUMERIC = "[0-9a-zA-Z\\.]*";
  Pattern p = Pattern.compile(PATTERN_VALIDATE_ALPHA_NUMERIC);
  if (!p.matcher(username).matches()) {
     out.println("<h3>Invalid username, it contains invalid characters. Please go back, and try again.</h3>");
  } else if(username.equals("null") || username.length() >= 32 || username.length() <= 3 ) {
     out.println("<h3>Invalid username, it is too long or short. Please go back, and try again.</h3>");
  } else {

   Context env = (Context)(new InitialContext().lookup("java:comp/env"));<commit_msg>More feedback on username selection.<commit_after><%@page import="java.util.regex.*"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.sql.*"%>
<%@page import="javax.naming.*"%>
<%@page import="java.security.*"%>
<%@page import="java.util.regex.*"%>


<div id="main_column">
<%
String redir_url = "" + request.getParameter("redir");
String username = "" + request.getParameter("username");

if (username == null || "null".equals(username)) {
%>

<div style="text-align: center;">
<center>
<h2>Choose your username:</h2>

<div>
	Please choose your player name:
</div>

<form name="guest_user" action="/wireframe.jsp" method="get">
<input id="usr" type="text" size="20" name="username" value="">
<input type="hidden" name="redir" value="<%= redir_url %>">
<input type="hidden" name="do" value="guest_user">
<input class="button" type="submit" value="Login">
</form>

<br><br><br>



</div>

<script>
	$( ".button").button();
	$( "#usr").focus();
</script>


<% } else { 

  String PATTERN_VALIDATE_ALPHA_NUMERIC = "[0-9a-zA-Z\\.]*";
  Pattern p = Pattern.compile(PATTERN_VALIDATE_ALPHA_NUMERIC);
  if (!p.matcher(username).matches()) {
    out.println("<h2>Invalid username<h2><h3> Your username contains invalid characters. Please go back, and try again.</h3>");
  } else if(username.length() >= 32 ) {
    out.println("<h2>Invalid username</h2><h3>Your username was too long. Please go back, choose a username shorter than 32 characters and log in again.</h3>");
  } else if(username.equals("null") || username.length() <= 3 ) {
    out.println("<h2>Invalid username</h2><h3>Your username is too short. Please go back, choose a username longer than 3 characters and try again.</h3>");

  } else {

   Context env = (Context)(new InitialContext().lookup("java:comp/env"));
{'fraction_non_alphanumeric': 0.22372588540167002, 'fraction_numerical': 0.010653613590555715, 'mean_word_length': 5.433333333333334, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 81, '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': '4321147', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1200, 'n_words': 270}