Skip to content

Commit

Permalink
Fixed issue #11507: Edit user dialog not styled
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jul 28, 2016
1 parent 8b84d55 commit 7e5248a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 60 deletions.
26 changes: 12 additions & 14 deletions application/controllers/admin/useraction.php
Expand Up @@ -351,8 +351,13 @@ public function modifyuser()
(Permission::model()->hasGlobalPermission('users','update') && $sresultcount > 0) )
{
$sresult = User::model()->parentAndUser($postuserid);
if(empty($sresult))
{
Yii::app()->setFlashMessage(gT("You do not have permission to access this page."),'error');
$this->getController()->redirect(array("admin/user/sa/index"));
}
$aData = array();
$aData['mur'] = $sresult;
$aData['aUserData'] = $sresult;

$aData['fullpagebar']['savebutton']['form'] = 'moduserform';
$aData['fullpagebar']['closebutton']['url'] = 'admin'; // Close button
Expand Down Expand Up @@ -391,9 +396,8 @@ public function moduser()
{
$users_name = html_entity_decode($postuser, ENT_QUOTES, 'UTF-8');
$email = html_entity_decode($postemail, ENT_QUOTES, 'UTF-8');
$sPassword = html_entity_decode(Yii::app()->request->getPost('pass'), ENT_QUOTES, 'UTF-8');
if ($sPassword == '%%unchanged%%')
$sPassword = '';
$sPassword = Yii::app()->request->getPost('password');

$full_name = html_entity_decode($postfull_name, ENT_QUOTES, 'UTF-8');

if (!validateEmailAddress($email))
Expand All @@ -404,8 +408,8 @@ public function moduser()
else
{
$oRecord = User::model()->findByPk($postuserid);
$oRecord->email= $this->escape($email);
$oRecord->full_name= $this->escape($full_name);
$oRecord->email= $email;
$oRecord->full_name= $full_name;
if (!empty($sPassword))
{
$oRecord->password= hash('sha256', $sPassword);
Expand All @@ -419,19 +423,13 @@ public function moduser()
}
elseif ($uresult && !empty($sPassword)) // When saved successfully
{
if ($sPassword != 'password')
Yii::app()->session['pw_notify'] = FALSE;
if ($sPassword == 'password')
Yii::app()->session['pw_notify'] = TRUE;

Yii::app()->session['pw_notify'] = $sPassword != '';
if ($display_user_password_in_html === true) {
$displayedPwd = htmlentities($sPassword);
}
else
{
else {
$displayedPwd = preg_replace('/./', '*', $sPassword);
}

Yii::app()->setFlashMessage( gT("Success!") .' <br/> '.gT("Password") . ": " . $displayedPwd, 'success');
$this->getController()->redirect(array("/admin/user/sa/modifyuser/uid/".$postuserid));
}
Expand Down
78 changes: 34 additions & 44 deletions application/views/admin/user/modifyuser.php
@@ -1,51 +1,41 @@
<h3 class="pagetitle"><?php eT("Editing user");?></h3>

<div class="row" style="margin-bottom: 100px">
<div class="col-lg-12 content-right">
<?php echo CHtml::form(array("admin/user/sa/moduser"), 'post', array('name'=>'moduserform', 'id'=>'moduserform')); ?>
<div class="col-lg-12 content-right">
<?php echo CHtml::form(array("admin/user/sa/moduser"), 'post', array('name'=>'moduserform', 'id'=>'moduserform','class'=>'form-horizontal')); ?>

<div class="form-group">
<label for="user" class="col-sm-2 control-label"><?php eT("Username");?></label>
<div class="col-sm-3">
<?php echo CHtml::textField('user',$aUserData['users_name'],array('class'=>"form-control",'readonly'=>'readonly'));?>
</div>
<div class="col-sm-3">
<span class='text-info'><?php eT("The user name cannot be changed."); ?></span>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label"><?php eT("Email");?></label>
<div class="col-sm-3">
<?php echo CHtml::emailField('email',$aUserData['email'],array('class'=>"form-control"));?>
</div>
</div>
<div class="form-group">
<label for="full_name" class="col-sm-2 control-label"><?php eT("Full name");?></label>
<div class="col-sm-3">
<?php echo CHtml::textField('full_name',$aUserData['full_name'],array('class'=>"form-control"));?>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label"><?php eT("Password");?></label>
<div class="col-sm-3">
<?php echo CHtml::passwordField('password','',array('class'=>"form-control",'placeholder'=>html_entity_decode(str_repeat("&#9679;",10)))); ?>
<input type='hidden' name='uid' value="<?php echo $aUserData['uid'];?>" />
</div>
</div>

<table class='edituser table'><thead><tr>
<th><?php eT("Username");?></th>
<th><?php eT("Email");?></th>
<th><?php eT("Full name");?></th>
<th><?php eT("Password");?></th>
</tr></thead>
<tbody><tr>
<?php
function rsdsl($mur) {
foreach ($mur as $mds) {
if(is_array($mds)) {
return TRUE;
}else{
return FALSE;
}
}
}
if(rsdsl($mur)) {
foreach ($mur as $mrw) { ?>
<td ><strong><?php echo $mrw['users_name'];?></strong></td>
<td > <input type='email' size='30' name='email' value="<?php echo $mrw['email'];?>" /></td>
<td > <input type='text' size='30' name='full_name' value="<?php echo $mrw['full_name'];?>" />
<input type='hidden' name='user' value="<?php echo $mrw['users_name'];?>" />
<input type='hidden' name='uid' value="<?php echo $mrw['uid'];?>" /></td>
<td > <input type='password' name='pass' value="%%unchanged%%" /></td>
<?php }}else{
$mur = array_map('htmlspecialchars', $mur); ?>
<td ><strong><?php echo $mur['users_name'];?></strong></td>
<td > <input type='email' size='30' name='email' value="<?php echo $mur['email'];?>" /></td>
<td > <input type='text' size='30' name='full_name' value="<?php echo $mur['full_name'];?>" />
<input type='hidden' name='user' value="<?php echo $mur['users_name'];?>" />
<input type='hidden' name='uid' value="<?php echo $mur['uid'];?>" /></td>
<td > <input type='password' name='pass' value="%%unchanged%%" /></td>
<?php } ?>
</tr>
</tbody>
</table>
<p>
<input type='submit' class="hidden" value='<?php eT("Save");?>' />
<input type='hidden' name='action' value='moduser' />
<input type='submit' class="hidden" value='<?php eT("Save");?>' />
<input type='hidden' name='action' value='moduser' />
</p>
</form>

</div>
</div>
4 changes: 2 additions & 2 deletions application/views/admin/user/personalsettings.php
Expand Up @@ -31,13 +31,13 @@
<div class="form-group">
<?php echo CHtml::label(gT("Password:"), 'lang', array('class'=>"col-sm-2 control-label")); ?>
<div class="col-sm-3">
<?php echo CHtml::passwordField('password', '',array('class'=>'form-control','autocomplete'=>"off",'placeholder'=>html_entity_decode("&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;"))); ?>
<?php echo CHtml::passwordField('password', '',array('class'=>'form-control','autocomplete'=>"off",'placeholder'=>html_entity_decode(str_repeat("&#9679;",10)))); ?>
</div>
</div>
<div class="form-group">
<?php echo CHtml::label(gT("Repeat password:"), 'lang', array('class'=>"col-sm-2 control-label")); ?>
<div class="col-sm-3">
<?php echo CHtml::passwordField('repeatpassword', '',array('class'=>'form-control','autocomplete'=>"off",'placeholder'=>html_entity_decode("&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;&#9679;"))); ?>
<?php echo CHtml::passwordField('repeatpassword', '',array('class'=>'form-control','autocomplete'=>"off",'placeholder'=>html_entity_decode(str_repeat("&#9679;",10)))); ?>
</div>
</div>
<!-- form -->
Expand Down

0 comments on commit 7e5248a

Please sign in to comment.