mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#1947 puan modülü
This commit is contained in:
parent
72aeef0d14
commit
ebc26ec741
@ -0,0 +1,17 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Events;
|
||||
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UserActivatedByMail
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $user;
|
||||
|
||||
public function __construct($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Http\Controller;
|
||||
|
||||
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
use Anomaly\UsersModule\User\Register\Command\HandleActivateRequest;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Visiosoft\ProfileModule\Events\UserActivatedByMail;
|
||||
|
||||
class RegisterController extends PublicController
|
||||
{
|
||||
private $encrypter;
|
||||
private $userRepository;
|
||||
|
||||
public function __construct(Encrypter $encrypter, UserRepositoryInterface $userRepository)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->encrypter = $encrypter;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function activate()
|
||||
{
|
||||
if (!$this->dispatch(new HandleActivateRequest())) {
|
||||
|
||||
$this->messages->error('anomaly.module.users::error.activate_user');
|
||||
|
||||
return $this->redirect->to('/');
|
||||
}
|
||||
|
||||
$user = $this->userRepository->findByEmail($this->encrypter->decrypt(request()->email));
|
||||
event(new UserActivatedByMail($user));
|
||||
|
||||
$this->messages->success('anomaly.module.users::success.activate_user');
|
||||
$this->messages->success('anomaly.module.users::message.logged_in');
|
||||
|
||||
return $this->redirect->to($this->request->get('redirect', '/'));
|
||||
}
|
||||
}
|
||||
@ -16,19 +16,8 @@ use Anomaly\UsersModule\User\UserAuthenticator;
|
||||
*/
|
||||
class HandleAutomaticRegistration
|
||||
{
|
||||
|
||||
/**
|
||||
* The form builder.
|
||||
*
|
||||
* @var RegisterFormBuilder
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
/**
|
||||
* Create a new HandleAutomaticRegistration instance.
|
||||
*
|
||||
* @param RegisterFormBuilder $builder
|
||||
*/
|
||||
public function __construct(Register2FormBuilder $builder)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
|
||||
@ -7,19 +7,8 @@ use Visiosoft\ProfileModule\Profile\Register2\Register2FormBuilder;
|
||||
|
||||
class HandleEmailRegistration
|
||||
{
|
||||
|
||||
/**
|
||||
* The form builder.
|
||||
*
|
||||
* @var RegisterFormBuilder
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
/**
|
||||
* Create a new HandleEmailRegistration instance.
|
||||
*
|
||||
* @param RegisterFormBuilder $builder
|
||||
*/
|
||||
public function __construct(Register2FormBuilder $builder)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
|
||||
@ -16,19 +16,8 @@ use Illuminate\Notifications\AnonymousNotifiable;
|
||||
*/
|
||||
class HandleManualRegistration
|
||||
{
|
||||
|
||||
/**
|
||||
* The form builder.
|
||||
*
|
||||
* @var RegisterFormBuilder
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
/**
|
||||
* Create a new HandleManualRegistration instance.
|
||||
*
|
||||
* @param RegisterFormBuilder $builder
|
||||
*/
|
||||
public function __construct(Register2FormBuilder $builder)
|
||||
{
|
||||
$this->builder = $builder;
|
||||
|
||||
@ -4,10 +4,12 @@ use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
use Anomaly\UsersModule\User\Event\UserHasRegistered;
|
||||
use Anomaly\UsersModule\User\UserActivator;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\ProfileModule\Profile\Register2\Command\HandleAutomaticRegistration;
|
||||
use Visiosoft\ProfileModule\Profile\Register2\Command\HandleEmailRegistration;
|
||||
use Visiosoft\ProfileModule\Profile\Register2\Command\HandleManualRegistration;
|
||||
|
||||
/**
|
||||
* Class RegisterFormHandler
|
||||
@ -24,14 +26,12 @@ class Register2FormHandler
|
||||
/**
|
||||
* Handle the form.
|
||||
*
|
||||
* @param Repository $config
|
||||
* @param Dispatcher $events
|
||||
* @param UserRepositoryInterface $users
|
||||
* @param Register2FormBuilder $builder
|
||||
* @param UserActivator $activator
|
||||
*/
|
||||
public function handle(
|
||||
Repository $config,
|
||||
Dispatcher $events,
|
||||
UserRepositoryInterface $users,
|
||||
Register2FormBuilder $builder,
|
||||
@ -42,8 +42,6 @@ class Register2FormHandler
|
||||
return;
|
||||
}
|
||||
|
||||
$profile_parameters = array();
|
||||
|
||||
/* Create Profile in Register */
|
||||
$domain = setting_value('streams::domain');
|
||||
$domain = str_replace('https://', '', $domain);
|
||||
@ -66,11 +64,26 @@ class Register2FormHandler
|
||||
|
||||
/* @var UserInterface $user */
|
||||
$user = $register;
|
||||
$builder->setFormEntry($register);
|
||||
|
||||
$activator->start($user);
|
||||
$activator->force($user);
|
||||
|
||||
$mode = config('anomaly.module.users::config.activation_mode', 'automatic');
|
||||
|
||||
switch ($mode) {
|
||||
case 'automatic':
|
||||
dispatch_now(new HandleAutomaticRegistration($builder));
|
||||
break;
|
||||
|
||||
case 'manual':
|
||||
dispatch_now(new HandleManualRegistration($builder));
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
dispatch_now(new HandleEmailRegistration($builder));
|
||||
break;
|
||||
}
|
||||
|
||||
$events->dispatch(new UserHasRegistered($user));
|
||||
Auth::login($user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,6 +141,10 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
'uses' => 'Visiosoft\ProfileModule\Http\Controller\Admin\UsersController@exportUsers'
|
||||
],
|
||||
|
||||
'users/activate' => [
|
||||
'ttl' => 0,
|
||||
'uses' => 'Visiosoft\ProfileModule\Http\Controller\RegisterController@activate',
|
||||
],
|
||||
|
||||
// Cache links
|
||||
'ajax/get-user-info' => 'Visiosoft\ProfileModule\Http\Controller\CacheController@getUserInfo',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user