mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
enum filters and org accept state
This commit is contained in:
parent
2692bbaa63
commit
11002c2881
@ -3,6 +3,7 @@ angular
|
||||
|
||||
.controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService,
|
||||
$state, appSettings, $analytics) {
|
||||
$scope.state = $state;
|
||||
var returnState = $state.params.returnState;
|
||||
var rememberedEmail = $cookies.get(appSettings.rememberedEmailCookieName);
|
||||
if (rememberedEmail || $state.params.email) {
|
||||
|
@ -35,7 +35,15 @@
|
||||
</div>
|
||||
<hr />
|
||||
<ul>
|
||||
<li><a ui-sref="frontend.register">Create a new account</a></li>
|
||||
<li><a ui-sref="frontend.passwordHint">Get master password hint</a></li>
|
||||
<li>
|
||||
<a ui-sref="frontend.register({returnState: state.params.returnState, email: state.params.email})">
|
||||
Create a new account
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a ui-sref="frontend.passwordHint">
|
||||
Get master password hint
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
@ -9,7 +9,7 @@
|
||||
<h4>Account Created!</h4>
|
||||
<p>You may now log in to your new account.</p>
|
||||
</div>
|
||||
<a ui-sref="frontend.login.info({returnState: returnState})">Ready to log in?</a>
|
||||
<a ui-sref="frontend.login.info({returnState: returnState, email: model.email})">Ready to log in?</a>
|
||||
</div>
|
||||
<form name="registerForm" ng-submit="registerForm.$valid && register(registerForm)" ng-show="!success"
|
||||
api-form="registerPromise">
|
||||
|
@ -10,6 +10,7 @@
|
||||
'angulartics.google.analytics',
|
||||
|
||||
'bit.directives',
|
||||
'bit.filters',
|
||||
'bit.services',
|
||||
|
||||
'bit.global',
|
||||
|
32
src/app/filters/enumLabelClassFilter.js
Normal file
32
src/app/filters/enumLabelClassFilter.js
Normal file
@ -0,0 +1,32 @@
|
||||
angular
|
||||
.module('bit.filters')
|
||||
|
||||
.filter('enumLabelClass', function () {
|
||||
return function (input, name) {
|
||||
if (typeof input !== 'number') {
|
||||
return input.toString();
|
||||
}
|
||||
|
||||
var output;
|
||||
switch (name) {
|
||||
case 'OrgUserStatus':
|
||||
switch (input) {
|
||||
case 0:
|
||||
output = 'label-default';
|
||||
break;
|
||||
case 1:
|
||||
output = 'label-warning';
|
||||
break;
|
||||
case 2:
|
||||
/* falls through */
|
||||
default:
|
||||
output = 'label-success';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
output = 'label-default';
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
});
|
46
src/app/filters/enumNameFilter.js
Normal file
46
src/app/filters/enumNameFilter.js
Normal file
@ -0,0 +1,46 @@
|
||||
angular
|
||||
.module('bit.filters')
|
||||
|
||||
.filter('enumName', function () {
|
||||
return function (input, name) {
|
||||
if (typeof input !== 'number') {
|
||||
return input.toString();
|
||||
}
|
||||
|
||||
var output;
|
||||
switch (name) {
|
||||
case 'OrgUserStatus':
|
||||
switch (input) {
|
||||
case 0:
|
||||
output = 'Invited';
|
||||
break;
|
||||
case 1:
|
||||
output = 'Accepted';
|
||||
break;
|
||||
case 2:
|
||||
/* falls through */
|
||||
default:
|
||||
output = 'Confirmed';
|
||||
}
|
||||
break;
|
||||
case 'OrgUserType':
|
||||
switch (input) {
|
||||
case 0:
|
||||
output = 'Owner';
|
||||
break;
|
||||
case 1:
|
||||
output = 'Admin';
|
||||
break;
|
||||
case 2:
|
||||
/* falls through */
|
||||
default:
|
||||
output = 'User';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
output = input.toString();
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
});
|
2
src/app/filters/filtersModule.js
Normal file
2
src/app/filters/filtersModule.js
Normal file
@ -0,0 +1,2 @@
|
||||
angular
|
||||
.module('bit.filters', []);
|
@ -92,35 +92,6 @@
|
||||
type: list.Data[i].Type
|
||||
};
|
||||
|
||||
switch (user.type) {
|
||||
case 0:
|
||||
user.typeName = 'Owner';
|
||||
break;
|
||||
case 1:
|
||||
user.typeName = 'Admin';
|
||||
break;
|
||||
case 2:
|
||||
/* falls through */
|
||||
default:
|
||||
user.typeName = 'User';
|
||||
}
|
||||
|
||||
switch (user.status) {
|
||||
case 0:
|
||||
user.statusName = 'Invited';
|
||||
user.statusClass = { 'label-default': true };
|
||||
break;
|
||||
case 1:
|
||||
user.statusName = 'Accepted';
|
||||
user.statusClass = { 'label-warning': true };
|
||||
break;
|
||||
case 2:
|
||||
/* falls through */
|
||||
default:
|
||||
user.statusName = 'Confirmed';
|
||||
user.statusClass = { 'label-success': true };
|
||||
}
|
||||
|
||||
users.push(user);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
<table class="table table-striped table-hover table-vmiddle">
|
||||
<tbody>
|
||||
<tr ng-repeat="user in filteredUsers = (users | filter: (filterSearch || '') |
|
||||
orderBy: ['name', 'email'])">
|
||||
orderBy: ['type', 'name', 'email'])">
|
||||
<td style="width: 70px;">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
@ -66,10 +66,12 @@
|
||||
<div ng-if="user.name"><small class="text-muted">{{user.name}}</small></div>
|
||||
</td>
|
||||
<td style="width: 100px;">
|
||||
{{user.typeName}}
|
||||
{{user.type | enumName: 'OrgUserType'}}
|
||||
</td>
|
||||
<td style="width: 120px;">
|
||||
<span class="label" ng-class="{{user.statusClass}}">{{user.statusName}}</span>
|
||||
<span class="label {{user.status | enumLabelClass: 'OrgUserStatus'}}">
|
||||
{{user.status | enumName: 'OrgUserStatus'}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -87,6 +87,10 @@
|
||||
<script src="app/directives/passwordMeterDirective.js"></script>
|
||||
<script src="app/directives/passwordViewerDirective.js"></script>
|
||||
|
||||
<script src="app/filters/filtersModule.js"></script>
|
||||
<script src="app/filters/enumNameFilter.js"></script>
|
||||
<script src="app/filters/enumLabelClassFilter.js"></script>
|
||||
|
||||
<script src="app/services/servicesModule.js"></script>
|
||||
<script src="app/services/tokenService.js"></script>
|
||||
<script src="app/services/apiService.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user