Removed bug in backend of users

This commit is contained in:
Christian Wolf 2019-04-17 15:04:40 +02:00
parent 22566986a8
commit b08b01689f
3 changed files with 6 additions and 4 deletions

View File

@ -106,14 +106,14 @@ class ClubsUser
/**
* @param string $user
*/
public function setUser(string $user)
public function setUser(string $user, bool $force = false)
{
if($this->id === 'new')
$valid = self::isUserNameFree($user);
else
$valid = self::isUserNameFree($user, $this->id);
if(! $valid)
if(!$force && ! $valid)
throw new UserInvalidException();
$this->user = $user;

View File

@ -37,7 +37,7 @@ class ClubsViewUser extends HtmlView
$dataurl = $input->get->get('data', null, 'json');
$data = json_decode($dataurl, true);
$this->user->setUser($data['user']);
$this->user->setUser($data['user'], true);
$this->user->setName($data['name']);
$this->user->setAddress($data['address']);
$this->user->setCity($data['city']);

View File

@ -10,7 +10,8 @@ defined('_JEXEC') or die;
<table width='100%' class='table table-stiped, table-hover'>
<thead>
<tr>
<th width='30%'>Benutzername</th>
<th width='15%'>Benutzername</th>
<th width='20%'>Name</th>
<th width='30%'>Ort</th>
<th width='30%'>E-Mail</th>
<th width='5%'>L&ouml;schen?</th>
@ -20,6 +21,7 @@ defined('_JEXEC') or die;
<?php foreach($this->users as $user): ?>
<?php $link = Route::_('index.php?option=com_clubs&view=user&id=' . $user->getId()); ?>
<tr>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($user->getUser()); ?></a></td>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($user->getName()); ?></a></td>
<td><?php echo htmlentities($user->getCity()); ?></td>
<td><a href='mailto:<?php echo htmlentities($user->getMail()); ?>'><?php echo htmlentities($user->getMail()); ?></a></td>