<commit_before><?php declare(strict_types=1);

namespace controller;

use util\app;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class password_reset_token
{
    public function password_reset_token(Request $request, app $app, string $token):Response
    {
        $data = $app['data_token']->retrieve($token, 'password_reset', $app['pp_schema']);

        if (!$data)
        {
            $app['alert']->error('Het reset-token is niet meer geldig.');
            $app['link']->redirect('password_reset', $app['pp_ary'], []);
        }

        $user_id = $data['user_id'];

        if ($request->isMethod('POST'))
        {
            $password = $request->request->get('password');

            if ($error_token = $app['form_token']->get_error())
            {
                $app['alert']->error($error_token);
            }
            else if (!($app['password_strength']->get($password) < 50))
            {
                $app['db']->update($app['pp_schema'] . '.users',
                    ['password' => hash('<PASSWORD>', $password)],
                    ['id' => $user_id]);

                $app['user_cache']->clear($user_id, $app['pp_schema']);
                $app['alert']->success('Paswoord opgeslagen.');

                $app['queue.mail']->queue([
                    'schema'	=> $app['pp_schema'],
                    'to' 		=> $app['mail_addr_user']->get_active($user_id, $app['pp_schema']),
                    'template'	=> 'password_reset/user',
                    'vars'		=> [
                        'password'		=> <PASSWORD>,
                        'user_id'		=> $user_id,
                    ],
                ], 10000);

                $data = $app['data_token']->del($token, 'password_reset', $app['pp_schema']);
                $app['link']->redirect('login', $app['pp_ary'], []);
            }
            else
            {
                $app['alert']->error('Het paswoord is te zwak.');
            }
        }

        $app['heading']->add('Nieuw paswoord ingeven.');
        $app['heading']->fa('key');

        $app['assets']->add([
            'generate_password.js',
        ]);

        $out = '<div class="panel panel-info">';
        $out .= '<div class="panel-heading">';

        $out .= '<form method="post" role="form">';

        $out .= '<div class="form-group">';
        $out .= '<label for="password">Nieuw paswoord</label>';
        $out .= '<div class="input-group">';
        $out .= '<span class="input-group-addon">';
        $out .= '<i class="fa fa-key"></i>';
        $out .= '</span>';
        $out .= '<input type="text" class="form-control" id="password" name="password" ';
        $out .= 'value="';
        $out .= $password;
        $out .= '" required>';
        $out .= '<span class="input-group-btn">';
        $out .= '<button class="btn btn-default" type="button" ';
        $out .= 'data-generate-password>Genereer</button>';
        $out .= '</span>';
        $out .= '</div>';
        $out .= '</div>';

        $out .= '<input type="submit" class="btn btn-primary btn-lg" value="Bewaar paswoord" name="zend">';
        $out .= $app['form_token']->get_hidden_input();
        $out .= '</form>';

        $out .= '</div>';
        $out .= '</div>';

        $app['menu']->set('login');

        return $app->render('base/sidebar.html.twig', [
            'content'   => $out,
            'schema'    => $app['pp_schema'],
        ]);
    }
}
<commit_msg>fix unset variable<commit_after><?php declare(strict_types=1);

namespace controller;

use util\app;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class password_reset_token
{
    public function password_reset_token(Request $request, app $app, string $token):Response
    {
        $data = $app['data_token']->retrieve($token, 'password_reset', $app['pp_schema']);
        $password = $request->request->get('password', '');

        if (!$data)
        {
            $app['alert']->error('Het reset-token is niet meer geldig.');
            $app['link']->redirect('password_reset', $app['pp_ary'], []);
        }

        $user_id = $data['user_id'];

        if ($request->isMethod('POST'))
        {
            if ($error_token = $app['form_token']->get_error())
            {
                $app['alert']->error($error_token);
            }
            else if (!($app['password_strength']->get($password) < 50))
            {
                $app['db']->update($app['pp_schema'] . '.users',
                    ['password' => hash('<PASSWORD>', $password)],
                    ['id' => $user_id]);

                $app['user_cache']->clear($user_id, $app['pp_schema']);
                $app['alert']->success('Paswoord opgeslagen.');

                $app['queue.mail']->queue([
                    'schema'	=> $app['pp_schema'],
                    'to' 		=> $app['mail_addr_user']->get_active($user_id, $app['pp_schema']),
                    'template'	=> 'password_reset/user',
                    'vars'		=> [
                        'password'		=> <PASSWORD>,
                        'user_id'		=> $user_id,
                    ],
                ], 10000);

                $data = $app['data_token']->del($token, 'password_reset', $app['pp_schema']);
                $app['link']->redirect('login', $app['pp_ary'], []);
            }
            else
            {
                $app['alert']->error('Het paswoord is te zwak.');
            }
        }

        $app['heading']->add('Nieuw paswoord ingeven.');
        $app['heading']->fa('key');

        $app['assets']->add([
            'generate_password.js',
        ]);

        $out = '<div class="panel panel-info">';
        $out .= '<div class="panel-heading">';

        $out .= '<form method="post" role="form">';

        $out .= '<div class="form-group">';
        $out .= '<label for="password"><PASSWORD></label>';
        $out .= '<div class="input-group">';
        $out .= '<span class="input-group-addon">';
        $out .= '<i class="fa fa-key"></i>';
        $out .= '</span>';
        $out .= '<input type="text" class="form-control" id="password" name="password" ';
        $out .= 'value="';
        $out .= $password;
        $out .= '" required>';
        $out .= '<span class="input-group-btn">';
        $out .= '<button class="btn btn-default" type="button" ';
        $out .= 'data-generate-password>Genereer</button>';
        $out .= '</span>';
        $out .= '</div>';
        $out .= '</div>';

        $out .= '<input type="submit" class="btn btn-primary btn-lg" value="Bewaar paswoord" name="zend">';
        $out .= $app['form_token']->get_hidden_input();
        $out .= '</form>';

        $out .= '</div>';
        $out .= '</div>';

        $app['menu']->set('login');

        return $app->render('base/sidebar.html.twig', [
            'content'   => $out,
            'schema'    => $app['pp_schema'],
        ]);
    }
}

{'fraction_non_alphanumeric': 0.2121342512908778, 'fraction_numerical': 0.002294893861158921, 'mean_word_length': 1.9200167504187604, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 118, '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': '2958550', 'n_tokens_mistral': 2144, 'n_tokens_neox': 2079, 'n_words': 347}