<commit_before><?php

namespace App\Http\Controllers;

// Laravel
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;

// Custom
use App\Http\Requests\UserRequest;
use App\Models\User;

class UserController extends Controller
{
    // Create a new user
    public function create(UserRequest $request)
    {
        // Create user based on post input
        $input = $request->all();
        $input['password'] = <PASSWORD>($input['password']);
        $user = User::create($input);

        // Is this the first user?
        if($user->id == 1)
        {
            $user->role = 'admin';
        }
        else
        {
            // Otherwise assign to volunteer role by default
            $user->role = 'volunteer';
        }

        $user->save();

        $request->session()->flash('success', 'Your account has been registered, you may now log in.');
        return redirect('/login');
    }<commit_msg>Updated registration to automatically log you in<commit_after><?php

namespace App\Http\Controllers;

// Laravel
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;

// Custom
use App\Http\Requests\UserRequest;
use App\Models\User;

class UserController extends Controller
{
    // Create a new user
    public function create(UserRequest $request)
    {
        // Create user based on post input
        $input = $request->all();
        $input['password'] = <PASSWORD>($input['password']);
        $user = User::create($input);

        // Is this the first user?
        if($user->id == 1)
        {
            $user->role = 'admin';
        }
        else
        {
            // Otherwise assign to volunteer role by default
            $user->role = 'volunteer';
        }

        $user->save();
        $this->auth->loginUsingID($user->id);

        $request->session()->flash('success', 'Your account has been registered, you are now logged in.');
        return redirect('/');
    }
{'fraction_non_alphanumeric': 0.13652392947103276, 'fraction_numerical': 0.0010075566750629723, 'mean_word_length': 2.2504091653027825, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, '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': '4256164', 'n_tokens_mistral': 545, 'n_tokens_neox': 551, 'n_words': 151}