<commit_before><?php

namespace App\Http\Controllers\Auth;

use HMS\Entities\User;
use HMS\Auth\PasswordStore;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Events\Users\UserPasswordChanged;

class ChangePasswordController extends Controller
{
    /** @var PasswordStore */
    protected $passwordStore;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(PasswordStore $passwordStore)
    {
        $this->passwordStore = $passwordStore;
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function edit()
    {
        return view('user.changePassword')->with('user', \Auth::user());
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $user = \Auth::user();

        $valideCurrentPassword = \Auth::guard()->validate([
            $user->getAuthIdentifierName() => $user->getAuthIdentifier(),
            'password' => $request->currentPassword,
            ]);

        if ( ! $valideCurrentPassword) {
            flash('Your current password does not matches with the password you provided. Please try again.')->error();

            return redirect()->back();
        }<commit_msg>ChangePassword: docblock<commit_after><?php

namespace App\Http\Controllers\Auth;

use HMS\Entities\User;
use HMS\Auth\PasswordStore;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Events\Users\UserPasswordChanged;

class ChangePasswordController extends Controller
{
    /** @var PasswordStore */
    protected $passwordStore;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(PasswordStore $passwordStore)
    {
        $this->passwordStore = $passwordStore;
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function edit()
    {
        return view('user.changePassword')->with('user', \Auth::user());
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $user = \Auth::user();

        $valideCurrentPassword = \Auth::guard()->validate([
            $user->getAuthIdentifierName() => $user->getAuthIdentifier(),
            'password' => $request->currentPassword,
            ]);

        if ( ! $valideCurrentPassword) {
            flash('Your current password does not matches with the password you provided. Please try again.')->error();

            return redirect()->back();
        }
{'fraction_non_alphanumeric': 0.12512820512820513, 'fraction_numerical': 0.0, 'mean_word_length': 2.5210589651022866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '5040244', 'n_tokens_mistral': 781, 'n_tokens_neox': 789, 'n_words': 186}