mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
login custom fields view/edit
This commit is contained in:
@@ -2,8 +2,9 @@ angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultEditLoginController', function ($scope, $state, $stateParams, loginService, folderService,
|
||||
cryptoService, $q, toastr, SweetAlert, utilsService, $analytics, i18nService) {
|
||||
cryptoService, $q, toastr, SweetAlert, utilsService, $analytics, i18nService, constantsService) {
|
||||
$scope.i18n = i18nService;
|
||||
$scope.constants = constantsService;
|
||||
$scope.showAttachments = !utilsService.isEdge();
|
||||
var loginId = $stateParams.loginId;
|
||||
var fromView = $stateParams.fromView;
|
||||
|
||||
@@ -2,7 +2,9 @@ angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultViewLoginController', function ($scope, $state, $stateParams, loginService, toastr, $q,
|
||||
$analytics, i18nService, utilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert) {
|
||||
$analytics, i18nService, utilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert,
|
||||
constantsService) {
|
||||
$scope.constants = constantsService;
|
||||
$scope.i18n = i18nService;
|
||||
$scope.showAttachments = !utilsService.isEdge();
|
||||
var from = $stateParams.from,
|
||||
@@ -19,12 +21,7 @@ angular
|
||||
$scope.login = model;
|
||||
|
||||
if (model.password) {
|
||||
var maskedPassword = '';
|
||||
for (var i = 0; i < model.password.length; i++) {
|
||||
maskedPassword += '•';
|
||||
}
|
||||
|
||||
$scope.login.maskedPassword = maskedPassword;
|
||||
$scope.login.maskedPassword = $scope.maskValue(model.password);
|
||||
}
|
||||
|
||||
if (model.uri) {
|
||||
@@ -65,6 +62,10 @@ angular
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleFieldValue = function (field) {
|
||||
field.showValue = !field.showValue;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
if (from === 'current') {
|
||||
$state.go('tabs.current', {
|
||||
@@ -94,6 +95,18 @@ angular
|
||||
toastr.info(i18n.browserNotSupportClipboard);
|
||||
};
|
||||
|
||||
$scope.maskValue = function (value) {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
var masked = '';
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
masked += '•';
|
||||
}
|
||||
return masked;
|
||||
};
|
||||
|
||||
$scope.clipboardSuccess = function (e, type) {
|
||||
e.clearSelection();
|
||||
$analytics.eventTrack('Copied ' + (type === i18nService.username ? 'Username' : 'Password'));
|
||||
|
||||
@@ -73,6 +73,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-section" ng-if="login.fields && login.fields.length">
|
||||
<div class="list-section-header">
|
||||
{{i18n.customFields}}
|
||||
</div>
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item" ng-repeat="field in login.fields"
|
||||
ng-class="{'list-section-item-checkbox' : field.type === constants.fieldType.boolean}">
|
||||
<label for="field_value{{$index}}" class="item-label">{{field.name}}</label>
|
||||
<input id="field_value{{$index}}" type="text" name="Field.Value{{$index}}"
|
||||
ng-model="field.value" ng-if="field.type === constants.fieldType.text">
|
||||
<input id="field_value{{$index}}" type="password" name="Field.Value{{$index}}"
|
||||
ng-model="field.value" ng-if="field.type === constants.fieldType.hidden">
|
||||
<input id="field_value{{$index}}" name="Field.Value{{$index}}" type="checkbox"
|
||||
ng-model="field.value" data-ng-true-value="'true'"
|
||||
ng-if="field.type === constants.fieldType.boolean">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-section">
|
||||
<div class="list-section-items">
|
||||
<a href="" ng-click="delete()" class="list-section-item text-danger">
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<span class="totp-sec">{{totpSec}}</span>
|
||||
<svg>
|
||||
<g>
|
||||
<circle class="totp-circle inner" r="12.6" cy="16" cx="16"
|
||||
<circle class="totp-circle inner" r="12.6" cy="16" cx="16"
|
||||
style="stroke-dashoffset: {{totpDash}}px;"></circle>
|
||||
<circle class="totp-circle outer" r="14" cy="16" cx="16"></circle>
|
||||
</g>
|
||||
@@ -76,6 +76,36 @@
|
||||
<div class="list-section-item pre">{{login.notes}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-section" ng-if="login.fields && login.fields.length">
|
||||
<div class="list-section-header">
|
||||
{{i18n.customFields}}
|
||||
</div>
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item" ng-repeat="field in login.fields">
|
||||
<a class="btn-list" href="" title="{{i18n.copyValue}}" ngclipboard ngclipboard-error="clipboardError(e)"
|
||||
ngclipboard-success="clipboardSuccess(e, i18n.value)" data-clipboard-text="{{field.value}}"
|
||||
ng-if="field.type !== constants.fieldType.boolean && field.value">
|
||||
<i class="fa fa-lg fa-clipboard"></i>
|
||||
</a>
|
||||
<a class="btn-list" href="" title="{{i18n.toggleValue}}" ng-click="toggleFieldValue(field)"
|
||||
ng-if="field.type === constants.fieldType.hidden">
|
||||
<i class="fa fa-lg" ng-class="[{'fa-eye': !field.showValue}, {'fa-eye-slash': field.showValue}]"></i>
|
||||
</a>
|
||||
<span class="item-label">{{field.name}}</span>
|
||||
<div ng-if="field.type === constants.fieldType.text">
|
||||
{{field.value || ' '}}
|
||||
</div>
|
||||
<div ng-if="field.type === constants.fieldType.hidden">
|
||||
<span ng-show="!field.showValue">{{maskValue(field.value)}}</span>
|
||||
<span ng-show="field.showValue" class="monospaced">{{field.value}}</span>
|
||||
</div>
|
||||
<div ng-if="field.type === constants.fieldType.boolean">
|
||||
<i class="fa fa-check-square-o" ng-if="field.value === 'true'"></i>
|
||||
<i class="fa fa-square-o" ng-if="field.value !== 'true'"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-section" ng-if="showAttachments && isPremium && login.attachments && login.attachments.length">
|
||||
<div class="list-section-header">
|
||||
{{i18n.attachments}}
|
||||
|
||||
Reference in New Issue
Block a user