<?php

namespace LaraBB\User\Actions;

use LaraBB\User\UI\Web\Requests\Login;

/**
 * Class LoginAction
 * @package LaraBB\User\Actions
 */
class LoginAction
{
    public function __construct()
    {
    }

    /**
     * @param Login $request
     * @return bool
     */
    public function run(Login $request): bool
    {
        return auth()->attempt([
            'email_hashed' => hash('sha512', $request->post('login-email')),
            'password'     => $request->post('login-password')
        ], $request->has('remember-me'));
    }
}
