<commit_before><?php namespace App\Http\Controllers;

use View;
use Auth;
use Response;
use Redirect;
use Request;
use Validator;
use Hash;
use App\User;
use App\Society;
use App\Event;
use App\Subscription;
use Illuminate\Database\Eloquent\ModelNotFoundException;

class UserController extends Controller
{
	
/*
|--------------------------------------------------------------------------
| User Controller
|--------------------------------------------------------------------------
|
| 
|
*/
	/**
	 * Render front page view
	 * @return VIEW welcome
	 */
	public function index( ){
		return View::make( 'welcome' );
	}
	
	/**
	 * Render registration view
	 * @return VIEW register
	 */
    public function register( ){
        return View::make( 'users.register' );
    }

    /**
     * Creates a new user
     * 	Data should be POSTed to this function only
     * @return REDIRECT home
     */
    public function store( ){
    	// Only allow following fields to be submitted
        $data = Request::only( [
                    'username',
                    'password',
                    'password_confirmation',
                    'email'
                ]);

        // Validate all input
        $validator = Validator::make( $data, [
                    'username'  => 'required|unique:users|min:5|alpha_num',
                    'email'     => 'email|required|unique:users',
                    'password'  => '<PASSWORD>'
                ]);

        if( $validator->fails( ) ){
        	// If validation fails, redirect back to 
        	// registration form with errors
            return Redirect::back( )
                    ->withErrors( $validator )
                    ->withInput( );
        }

        // Hash the password
        $data['password'] = <PASSWORD>::make($data['password']);

        // Create the new user
        $newUser = User::create( $data );

        if( $newUser ){
            Auth::login($newUser);

        	// If successful, go to home
        	return Redirect::route( 'subscriptions' );<commit_msg>Dispatch EstablishUserSubscription job on registration<commit_after><?php namespace App\Http\Controllers;

use View;
use Auth;
use Response;
use Redirect;
use Request;
use Validator;
use Hash;
use App\User;
use App\Society;
use App\Event;
use App\Subscription;
use App\Jobs\EstablishUserSubscription;
use Illuminate\Database\Eloquent\ModelNotFoundException;

class UserController extends Controller
{
	
/*
|--------------------------------------------------------------------------
| User Controller
|--------------------------------------------------------------------------
|
| 
|
*/
	/**
	 * Render front page view
	 * @return VIEW welcome
	 */
	public function index( ){
		return View::make( 'welcome' );
	}
	
	/**
	 * Render registration view
	 * @return VIEW register
	 */
    public function register( ){
        return View::make( 'users.register' );
    }

    /**
     * Creates a new user
     * 	Data should be POSTed to this function only
     * @return REDIRECT home
     */
    public function store( ){
    	// Only allow following fields to be submitted
        $data = Request::only( [
                    'username',
                    'password',
                    'password_confirmation',
                    'email'
                ]);

        // Validate all input
        $validator = Validator::make( $data, [
                    'username'  => 'required|unique:users|min:5|alpha_num',
                    'email'     => 'email|required|unique:users',
                    'password'  => '<PASSWORD>'
                ]);

        if( $validator->fails( ) ){
        	// If validation fails, redirect back to 
        	// registration form with errors
            return Redirect::back( )
                    ->withErrors( $validator )
                    ->withInput( );
        }

        // Hash the password
        $data['password'] = <PASSWORD>::make($data['password']);

        // Create the new user
        $newUser = User::create( $data );

        if( $newUser ){
            Auth::login($newUser);

            $this->dispatch(new EstablishUserSubscription($newUser));

        	// If successful, go to home
        	return Redirect::route( 'subscriptions' );
{'fraction_non_alphanumeric': 0.18181818181818182, 'fraction_numerical': 0.0004710315591144607, 'mean_word_length': 1.5507507507507508, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, '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': '3615865', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1067, 'n_words': 290}