1
0
mirror of https://github.com/typemill/typemill.git synced 2025-01-17 13:28:19 +01:00

Version 1.4.3: Validate inactive user, add raw userdata

This commit is contained in:
trendschau 2021-01-05 21:17:22 +01:00
parent 1f063a6778
commit 1df78a636d
3 changed files with 14 additions and 4 deletions

View File

@ -615,7 +615,7 @@ class SettingsController extends Controller
# set navigation active
$navigation['Users']['active'] = true;
return $this->render($response, 'settings/user.twig', array(
'settings' => $settings,
'acl' => $this->c->acl,
@ -624,7 +624,7 @@ class SettingsController extends Controller
'userform' => $userform, // field model, needed to generate frontend-field
'userdata' => $userdata, // needed to fill form with data
'route' => $route->getName() // needed to set link active
));
));
}
public function listUser($request, $response)

View File

@ -58,8 +58,9 @@ class Validation
# checks if username is free when create new user
Validator::addRule('userAvailable', function($field, $value, array $params, array $fields) use ($user)
{
$userdata = $user->getUser($value);
if($userdata){ return false; }
$activeUser = $user->getUser($value);
$inactiveUser = $user->getUser("_" . $value);
if($activeUser OR $inactiveUser){ return false; }
return true;
}, 'taken');

View File

@ -34,6 +34,15 @@
{% endfor %}
{% if is_role('administrator') %}
<fieldset>
<div class="large">
<legend>Raw Userdata (readonly for admins)</legend>
<textarea readonly="readonly" rows="10">{{ userdata|json_encode(constant('JSON_PRETTY_PRINT')) }}</textarea>
</div>
</fieldset>
{% endif %}
</fieldset>
</section>