<commit_before><?php

namespace Laravolt\Auth\Http\Controllers\Cas;

class Login extends CasController
{
    public function __invoke()
    {
        cas()->authenticate();

        $email = (config('cas.cas_masquerade')) ? cas()->user() : array_get(cas()->getAttributes(), 'email');
        $user = app(config('auth.providers.users.model'))->whereEmail($email)->first();

        if ($user && auth()->login($user)) {
            return redirect()->home();
        } else {
            return redirect()->route('auth::login')->withError(trans('auth::login_cas_failed'));
        }
    }
}<commit_msg>allow to modify cas login response<commit_after><?php

namespace Laravolt\Auth\Http\Controllers\Cas;

use Illuminate\Http\Request;

class Login extends CasController
{
    public function __invoke(Request $request)
    {
        cas()->authenticate();

        $email = (config('cas.cas_masquerade')) ? cas()->user() : array_get(cas()->getAttributes(), 'email');
        $user = app(config('auth.providers.users.model'))->whereEmail($email)->first();
        $loginService = app('laravolt.auth.login');

        if ($user && auth()->login($user)) {
            if (method_exists($loginService, 'authenticated')) {
                return $loginService->authenticated($request, $user);
            }

            return redirect()->home();
        } else {
            return redirect()->route('auth::login')->withError(trans('auth::login_cas_failed'));
        }
    }
}
{'fraction_non_alphanumeric': 0.18107556160653507, 'fraction_numerical': 0.0, 'mean_word_length': 3.07202216066482, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2868451', 'n_tokens_mistral': 417, 'n_tokens_neox': 409, 'n_words': 68}