src/main/java/com/webcheckers/ui/PostSigninRoute.java
@Override
    public Object handle(Request request, Response response){

        // Gets the username
        final String name = request.queryParams(USERNAME_PARAM);

        // attempt to sign in player
        Player player = lobby.signIn(name);

        // check if the sign in was successful
        if(player != null) {

            // Adds the current session to the sessions so that attributes can be added to the session
            sessions.put(name, request.session());

            // Adds the current player to the session
            request.session().attribute(GetHomeRoute.CURRENT_USER, player);

            response.redirect("./");

            return null;
        } else {

            //Generates the error to display as an attribute for the GetSigninRoute
            if(!PlayerLobby.isValidUsername(name)) {
                request.session().attribute(GetHomeRoute.ERROR, Message.error("Please only use alpha-numeric characters"));
            }
            else{
                request.session().attribute(GetHomeRoute.ERROR, Message.error("Already signed in"));
            }

            // Redirects back to the signin page
            response.redirect("./getsignin");

            // Reroutes back to the signin route with an error message
            return null;
        }
    }
/**
     * Handles a request for a sign in
     * @param request the HTTP request
     * @param response the HTTP response
     * @return the rendered HTML code for the signin page
     */
Handles a request for a sign in
@param request the HTTP request
@param response the HTTP response
@return the rendered HTML code for the signin page
Handles a request for a sign in @param request the HTTP request @param response the HTTP response @return the rendered HTML code for the signin page
@Override
    public Object handle(Request request, Response response){
        final String name = request.queryParams(USERNAME_PARAM);
        Player player = lobby.signIn(name);
        if(player != null) {
            sessions.put(name, request.session());
            request.session().attribute(GetHomeRoute.CURRENT_USER, player);
            response.redirect("./");
            return null;
        } else {
            if(!PlayerLobby.isValidUsername(name)) {
                request.session().attribute(GetHomeRoute.ERROR, Message.error("Please only use alpha-numeric characters"));
            }
            else{
                request.session().attribute(GetHomeRoute.ERROR, Message.error("Already signed in"));
            }
            response.redirect("./getsignin");
            return null;
        }
    }
@ Override public Object handle ( Request request , Response response ) { final String name = request . queryParams ( USERNAME_PARAM ) ; Player player = lobby . signIn ( name ) ; if ( player != null ) { sessions . put ( name , request . session ( ) ) ; request . session ( ) . attribute ( GetHomeRoute . CURRENT_USER , player ) ; response . redirect ( "./" ) ; return null ; } else { if ( ! PlayerLobby . isValidUsername ( name ) ) { request . session ( ) . attribute ( GetHomeRoute . ERROR , Message . error ( "Please only use alpha-numeric characters" ) ) ; } else { request . session ( ) . attribute ( GetHomeRoute . ERROR , Message . error ( "Already signed in" ) ) ; } response . redirect ( "./getsignin" ) ; return null ; } }
Handles a request for a sign in
 @param request the HTTP request
 @param response the HTTP response
 @return the rendered HTML code for the signin page
Handles a request for a sign in @param request the HTTP request @param response the HTTP response @return the rendered HTML code for the signin page
// Gets the username
 // attempt to sign in player
 // check if the sign in was successful
 // Adds the current session to the sessions so that attributes can be added to the session
 // Adds the current player to the session
 //Generates the error to display as an attribute for the GetSigninRoute
 // Redirects back to the signin page
 // Reroutes back to the signin route with an error message
