<commit_before><?php namespace Plugins\RainLab\User\Components;

use Auth;
use Modules\Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;

class User extends ComponentBase
{

    public function componentDetails()
    {
        return [
            'name' => 'User Provider',
            'description' => 'Provides user-based utilities.'
        ];
    }

    public function defineProperties()
    {
        return [];
    }

    /**
     * Returns the logged in user, if available
     */
    public function active()
    {
        if (!Auth::check())
            return null;

        return Auth::getUser();
    }

}<commit_msg>Users should be able to log out<commit_after><?php namespace Plugins\RainLab\User\Components;

use Auth;
use Redirect;
use Modules\Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;

class User extends ComponentBase
{

    public function componentDetails()
    {
        return [
            'name' => 'User Provider',
            'description' => 'Provides user-based utilities.'
        ];
    }

    public function defineProperties()
    {
        return [];
    }

    /**
     * Returns the logged in user, if available
     */
    public function active()
    {
        if (!Auth::check())
            return null;

        return Auth::getUser();
    }

    /**
     * Log out the user
     *
     * Usage:
     *   <a data-request="user::onLogout">Sign out</a>
     */
    public function onLogout()
    {
        Auth::logout();
        return Redirect::to('/');
    }

}
{'fraction_non_alphanumeric': 0.11874197689345314, 'fraction_numerical': 0.0, 'mean_word_length': 2.08102766798419, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '2927766', 'n_tokens_mistral': 448, 'n_tokens_neox': 430, 'n_words': 110}