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

use App\Http\Controllers\Controller;
use App\Http\Requests;

use App\Models\User;
use App\Models\SchoolAdmin;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;


class UserProfileController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    public function getMe()
    {
        $user = Auth::user();
        $user->is_admin = SchoolAdmin::where('user_id', $user->id)->count() == 1;

        return response(['user' => $user], 200);
    }

    public function verifyMyPassword(Request $request)
    {
        $this->validate($request, [
            'password' => '<PASSWORD>'
        ]);

        $currentUser = Auth::user();
        $password = $request->input('password');
        if ($currentUser && Auth::attempt(['email' => $currentUser->email, 'password' => $password])) {<commit_msg>make sure we check for user before setting is admin<commit_after><?php namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Requests;

use App\Models\User;
use App\Models\SchoolAdmin;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;


class UserProfileController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    public function getMe()
    {
        $user = Auth::user();
        if ($user !== null) {
            $user->is_admin = SchoolAdmin::where('user_id', $user->id)->count() == 1;
        }
        
        return response(['user' => $user], 200);
    }

    public function verifyMyPassword(Request $request)
    {
        $this->validate($request, [
            'password' => '<PASSWORD>'
        ]);

        $currentUser = Auth::user();
        $password = $request->input('password');
        if ($currentUser && Auth::attempt(['email' => $currentUser->email, 'password' => $password])) {
{'fraction_non_alphanumeric': 0.15332690453230471, 'fraction_numerical': 0.003857280617164899, 'mean_word_length': 2.653169014084507, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '405586', 'n_tokens_mistral': 605, 'n_tokens_neox': 603, 'n_words': 132}