Fix user edit with alternateEmail

This commit is contained in:
Johannes Zellner
2016-09-28 12:12:37 +02:00
parent 3a30310e2f
commit 11cfa2efaa
3 changed files with 8 additions and 3 deletions

View File

@@ -127,7 +127,7 @@
<td class="text-muted" style="vertical-align: top;">Email</td>
<td class="text-right" style="vertical-align: top; white-space: nowrap;">{{ user.email }} <a href="" ng-click="emailchange.show()" ng-show="!user.alternateEmail"><i class="fa fa-pencil text-small"></i></a></td>
</tr>
<tr ng-show="user.alternateEmail" uib-tooltip="Email used for password reset" tooltip-placement="left">
<tr ng-show="user.alternateEmail" uib-tooltip="Email used for password recovery" tooltip-placement="left">
<td class="text-muted" style="vertical-align: top;">Alternate Email</td>
<td class="text-right" style="vertical-align: top; white-space: nowrap;">{{ user.alternateEmail }} <a href="" ng-click="emailchange.show()"><i class="fa fa-pencil text-small"></i></a></td>
</tr>

View File

@@ -99,8 +99,13 @@
<div class="modal-body">
<form name="useredit_form" role="form" ng-submit="doUserEdit()" autocomplete="off">
<input type="password" style="display: none;">
<div class="form-group" ng-class="{ 'has-error': (useredit_form.email.$dirty && useredit_form.email.$invalid) || (!useredit_form.email.$dirty && useredit.error.email) }">
<div class="form-group" ng-show="useredit.userInfo.alternateEmail">
<label class="control-label">Email</label>
<input type="email" class="form-control" ng-model="useredit.userInfo.email" disabled>
</div>
<div class="form-group" ng-class="{ 'has-error': (useredit_form.email.$dirty && useredit_form.email.$invalid) || (!useredit_form.email.$dirty && useredit.error.email) }">
<label class="control-label" ng-show="useredit.userInfo.alternateEmail" uib-tooltip="Email used for password recovery">Alternate Email</label>
<label class="control-label" ng-hide="useredit.userInfo.alternateEmail">Email</label>
<div class="control-label" ng-show="(!useredit_form.email.$dirty && useredit.error.email) || (useredit_form.email.$dirty && useredit_form.email.$invalid) || (!useredit_form.email.$dirty && useredit.error.email)">
<small ng-show="useredit_form.email.$error.required">An email is required</small>
<small ng-show="useredit_form.email.$error.email">This is not a valid email</small>

View File

@@ -236,7 +236,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.showUserEdit = function (userInfo) {
$scope.useredit.error.email = null;
$scope.useredit.email = userInfo.email;
$scope.useredit.email = userInfo.alternateEmail || userInfo.email;
$scope.useredit.userInfo = userInfo;
$scope.useredit.groupIds = angular.copy(userInfo.groupIds);
$scope.useredit.superuser = userInfo.groupIds.indexOf('admin') !== -1;