Commit d32c36f0 authored by Charlie's avatar Charlie Committed by GitHub

Merge pull request #3 from ReFlar/analysis-zeLQDA

Apply fixes from StyleCI
parents b672b4ba 48e427a3
<?php
<?php
/*
* This file is part of reflar/user-management.
*
......@@ -12,38 +13,39 @@
namespace Reflar\UserManagement\Api\Controllers;
use Reflar\UserManagement\Api\Serializers\StrikeSerializer;
use Reflar\UserManagement\Commands\DeleteStrike;
use Reflar\UserManagement\Commands\ServeStrike;
use Flarum\Api\Controller\AbstractResourceController;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Reflar\UserManagement\Api\Serializers\StrikeSerializer;
use Reflar\UserManagement\Commands\DeleteStrike;
use Reflar\UserManagement\Commands\ServeStrike;
use Tobscure\JsonApi\Document;
use Zend\Diactoros\UploadedFile;
class ServeStrikeController extends AbstractResourceController
{
public $serializer = StrikeSerializer::class;
protected $bus;
public function __construct(Dispatcher $bus)
{
$this->bus = $bus;
}
protected function data(ServerRequestInterface $request, Document $document)
{
$actor = $request->getAttribute('actor');
$id = array_get($request->getParsedBody(), 'id');
if (isset($id)) {
return $this->bus->dispatch(
return $this->bus->dispatch(
new DeleteStrike($id, $actor)
);
} else {
$post_id = array_get($request->getParsedBody(), 'post_id');
$reason = array_get($request->getParsedBody(), 'reason');
return $this->bus->dispatch(
new ServeStrike($post_id, $reason, $actor)
);
}
}
}
\ No newline at end of file
}
......@@ -39,7 +39,7 @@ class RegisterUser
{
if (app()->make(SettingsRepositoryInterface::class)->get('ReFlar-recaptcha') == true) {
app()->make(RecaptchaValidator::class)->assertValid([
'g-recaptcha-response' => array_get($data, 'attributes.g-recaptcha-response')
'g-recaptcha-response' => array_get($data, 'attributes.g-recaptcha-response'),
]);
}
$this->actor = $actor;
......
......@@ -104,9 +104,8 @@ class RegisterUserHandler
$age = array_get($data, 'attributes.age');
$gender = ucfirst(strtolower(array_get($data, 'attributes.gender')));
if ($this->settings->get('ReFlar-emailRegEnabled') == true) {
$email = $username . '@' . $username . '.com';
$email = $username.'@'.$username.'.com';
}
// If a valid authentication token was provided as an attribute,
// then we won't require the user to choose a password.
......
......@@ -61,7 +61,7 @@ class UserValidator extends AbstractValidator
];
$this->settings = app()->make(SettingsRepositoryInterface::class);
if ($this->settings->get('ReFlar-emailRegEnabled') == false) {
$validator['email'] = ['required', 'email', 'unique:users,email'.$idSuffix];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment