mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-25 10:20:38 +00:00
UI/UX improvements
This commit is contained in:
@@ -5,20 +5,17 @@ use App\Users\Models\User;
|
||||
use App\Users\DTO\CreateUserData;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
|
||||
class CreateNewUserAction extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
protected StatefulGuard $guard,
|
||||
protected AutoSubscribeForMeteredBillingAction $autoSubscribeForMeteredBilling,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Validate and create a new user.
|
||||
*/
|
||||
public function __invoke(CreateUserData $data)
|
||||
public function __invoke(CreateUserData $data): User
|
||||
{
|
||||
$settings = get_settings([
|
||||
'user_verification', 'subscription_type',
|
||||
@@ -53,9 +50,6 @@ class CreateNewUserAction extends Controller
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
// Log in if verification is disabled
|
||||
if (! $data->password || ! intval($settings['user_verification'])) {
|
||||
$this->guard->login($user);
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ use App\Users\DTO\CreateUserData;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Users\Actions\CreateNewUserAction;
|
||||
use App\Users\Requests\RegisterUserRequest;
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
|
||||
class RegisterUserController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
public CreateNewUserAction $createNewUser,
|
||||
protected CreateNewUserAction $createNewUser,
|
||||
protected StatefulGuard $guard,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -27,7 +29,12 @@ class RegisterUserController extends Controller
|
||||
$data = CreateUserData::fromRequest($request);
|
||||
|
||||
// Register user
|
||||
($this->createNewUser)($data);
|
||||
$user = ($this->createNewUser)($data);
|
||||
|
||||
// Log in if verification is disabled
|
||||
if (! $user->password || ! intval(get_settings('user_verification'))) {
|
||||
$this->guard->login($user);
|
||||
}
|
||||
|
||||
return response('User successfully registered.', 201);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class CreateUserData extends DataTransferObject
|
||||
'email' => $array['email'],
|
||||
'avatar' => $array['avatar'],
|
||||
'password' => $array['password'] ?? null,
|
||||
'oauth_provider' => $array['oauth_provider'],
|
||||
'oauth_provider' => $array['oauth_provider'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use VueFileManager\Subscription\App\User\Traits\Billable;
|
||||
* @property string email
|
||||
* @property mixed favouriteFolders
|
||||
* @property string role
|
||||
* @property string email_verified_at
|
||||
* @method static count()
|
||||
* @method static sortable(string[] $array)
|
||||
* @method static forceCreate(array $array)
|
||||
|
||||
Reference in New Issue
Block a user