mirror of
https://github.com/bitwarden/desktop.git
synced 2024-09-06 00:28:04 +02:00
password generator from vault add/edit
This commit is contained in:
parent
6ef3ff9f4d
commit
e5c58c12fe
@ -89,14 +89,14 @@
|
|||||||
templateUrl: 'app/vault/views/vaultAddSite.html',
|
templateUrl: 'app/vault/views/vaultAddSite.html',
|
||||||
controller: 'vaultAddSiteController',
|
controller: 'vaultAddSiteController',
|
||||||
data: { authorize: true },
|
data: { authorize: true },
|
||||||
params: { animation: null, returnScrollY: 0, returnSearchText: null, name: null, uri: null, site: null }
|
params: { animation: null, returnScrollY: 0, returnSearchText: null, name: null, uri: null, site: null, fromCurrent: false }
|
||||||
})
|
})
|
||||||
.state('editSite', {
|
.state('editSite', {
|
||||||
url: '/edit-site?siteId',
|
url: '/edit-site?siteId',
|
||||||
templateUrl: 'app/vault/views/vaultEditSite.html',
|
templateUrl: 'app/vault/views/vaultEditSite.html',
|
||||||
controller: 'vaultEditSiteController',
|
controller: 'vaultEditSiteController',
|
||||||
data: { authorize: true },
|
data: { authorize: true },
|
||||||
params: { animation: null, fromView: true, returnScrollY: 0, returnSearchText: null }
|
params: { animation: null, fromView: true, returnScrollY: 0, returnSearchText: null, site: null }
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('passwordGenerator', {
|
.state('passwordGenerator', {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
var addState = $stateParams.addState,
|
var addState = $stateParams.addState,
|
||||||
editState = $stateParams.editState;
|
editState = $stateParams.editState;
|
||||||
|
|
||||||
|
$scope.showSelect = $stateParams.addState || $stateParams.editState;
|
||||||
|
|
||||||
popupUtils.initListSectionItemListeners();
|
popupUtils.initListSectionItemListeners();
|
||||||
$scope.password = '-';
|
$scope.password = '-';
|
||||||
|
|
||||||
@ -61,16 +63,38 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.close = function () {
|
$scope.close = function () {
|
||||||
|
dismiss();
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.select = function () {
|
||||||
|
if (addState) {
|
||||||
|
addState.site.password = $scope.password;
|
||||||
|
}
|
||||||
|
else if (editState) {
|
||||||
|
editState.site.password = $scope.password;
|
||||||
|
}
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
};
|
||||||
|
|
||||||
|
function dismiss() {
|
||||||
if (addState) {
|
if (addState) {
|
||||||
$state.go('addSite', {
|
$state.go('addSite', {
|
||||||
animation: 'out-slide-down',
|
animation: 'out-slide-down',
|
||||||
site: addState
|
fromCurrent: addState.fromCurrent,
|
||||||
|
site: addState.site,
|
||||||
|
returnScrollY: addState.returnScrollY,
|
||||||
|
returnSearchText: addState.returnSearchText
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (editState) {
|
else if (editState) {
|
||||||
$state.go('editSite', {
|
$state.go('editSite', {
|
||||||
animation: 'out-slide-down',
|
animation: 'out-slide-down',
|
||||||
siteId: editState
|
site: editState.site,
|
||||||
|
fromView: editState.fromView,
|
||||||
|
siteId: editState.siteId,
|
||||||
|
returnScrollY: editState.returnScrollY,
|
||||||
|
returnSearchText: editState.returnSearchText
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -78,5 +102,5 @@
|
|||||||
animation: 'out-slide-down'
|
animation: 'out-slide-down'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<a ng-click="close()" href="">Close</a>
|
<a ng-click="close()" href="">Close</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<a ng-click="select()" href="">Select</a>
|
<a ng-click="select()" ng-show="showSelect" href="">Select</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="title">Generate Password</div>
|
<div class="title">Generate Password</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
.controller('vaultAddSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr) {
|
.controller('vaultAddSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr) {
|
||||||
var returnScrollY = $stateParams.returnScrollY;
|
var returnScrollY = $stateParams.returnScrollY;
|
||||||
var returnSearchText = $stateParams.returnSearchText;
|
var returnSearchText = $stateParams.returnSearchText;
|
||||||
var fromCurrent = $stateParams.uri !== null;
|
var fromCurrent = $stateParams.fromCurrent || $stateParams.uri !== null;
|
||||||
|
|
||||||
$scope.site = {
|
$scope.site = {
|
||||||
folderId: null,
|
folderId: null,
|
||||||
@ -12,7 +12,11 @@
|
|||||||
uri: $stateParams.uri
|
uri: $stateParams.uri
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($scope.site.name && $scope.site.uri) {
|
if ($stateParams.site) {
|
||||||
|
angular.extend($scope.site, $stateParams.site);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$stateParams.site && $scope.site.name && $scope.site.uri) {
|
||||||
$('#username').focus();
|
$('#username').focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -52,4 +56,16 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.generatePassword = function () {
|
||||||
|
$state.go('passwordGenerator', {
|
||||||
|
animation: 'in-slide-up',
|
||||||
|
addState: {
|
||||||
|
fromCurrent: fromCurrent,
|
||||||
|
site: $scope.site,
|
||||||
|
returnScrollY: returnScrollY,
|
||||||
|
returnSearchText: returnSearchText
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -4,16 +4,23 @@ angular
|
|||||||
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr) {
|
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr) {
|
||||||
var returnScrollY = $stateParams.returnScrollY;
|
var returnScrollY = $stateParams.returnScrollY;
|
||||||
var returnSearchText = $stateParams.returnSearchText;
|
var returnSearchText = $stateParams.returnSearchText;
|
||||||
|
var siteId = $stateParams.siteId;
|
||||||
|
var fromView = $stateParams.fromView;
|
||||||
|
|
||||||
$scope.site = {
|
$scope.site = {
|
||||||
folderId: null
|
folderId: null
|
||||||
};
|
};
|
||||||
|
|
||||||
siteService.get($stateParams.siteId, function (site) {
|
if ($stateParams.site) {
|
||||||
$q.when(site.decrypt()).then(function (model) {
|
angular.extend($scope.site, $stateParams.site);
|
||||||
$scope.site = model;
|
}
|
||||||
|
else {
|
||||||
|
siteService.get(siteId, function (site) {
|
||||||
|
$q.when(site.decrypt()).then(function (model) {
|
||||||
|
$scope.site = model;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
$q.when(folderService.getAllDecrypted()).then(function (folders) {
|
$q.when(folderService.getAllDecrypted()).then(function (folders) {
|
||||||
$scope.folders = folders.concat([{
|
$scope.folders = folders.concat([{
|
||||||
@ -36,9 +43,9 @@ angular
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.close = function () {
|
$scope.close = function () {
|
||||||
if ($stateParams.fromView) {
|
if (fromView) {
|
||||||
$state.go('viewSite', {
|
$state.go('viewSite', {
|
||||||
siteId: $stateParams.siteId,
|
siteId: siteId,
|
||||||
animation: 'out-slide-down',
|
animation: 'out-slide-down',
|
||||||
returnScrollY: returnScrollY || 0,
|
returnScrollY: returnScrollY || 0,
|
||||||
returnSearchText: returnSearchText
|
returnSearchText: returnSearchText
|
||||||
@ -52,4 +59,21 @@ angular
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.generatePassword = function () {
|
||||||
|
if ($scope.site.password) {
|
||||||
|
// TODO: confirmation
|
||||||
|
}
|
||||||
|
|
||||||
|
$state.go('passwordGenerator', {
|
||||||
|
animation: 'in-slide-up',
|
||||||
|
editState: {
|
||||||
|
fromView: fromView,
|
||||||
|
siteId: siteId,
|
||||||
|
site: $scope.site,
|
||||||
|
returnScrollY: returnScrollY,
|
||||||
|
returnSearchText: returnSearchText
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
<label for="password" class="item-label">Password</label>
|
<label for="password" class="item-label">Password</label>
|
||||||
<input id="password" type="password" name="Password" ng-model="site.password" bit-field>
|
<input id="password" type="password" name="Password" ng-model="site.password" bit-field>
|
||||||
</div>
|
</div>
|
||||||
<a class="list-section-item" href="#">
|
<a class="list-section-item" href="" ng-click="generatePassword()">
|
||||||
Generate Password
|
Generate Password
|
||||||
<i class="fa fa-chevron-right pull-right"></i>
|
<i class="fa fa-chevron-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
<label for="password" class="item-label">Password</label>
|
<label for="password" class="item-label">Password</label>
|
||||||
<input id="password" type="password" name="Password" ng-model="site.password" bit-field>
|
<input id="password" type="password" name="Password" ng-model="site.password" bit-field>
|
||||||
</div>
|
</div>
|
||||||
<a class="list-section-item" href="#">
|
<a class="list-section-item" href="" ng-click="generatePassword()">
|
||||||
Generate Password
|
Generate Password
|
||||||
<i class="fa fa-chevron-right pull-right"></i>
|
<i class="fa fa-chevron-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -284,6 +284,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fa-chevron-right {
|
||||||
|
float: right;
|
||||||
|
margin-top: 3px;
|
||||||
|
color: @gray-light;
|
||||||
|
}
|
||||||
|
|
||||||
&.condensed {
|
&.condensed {
|
||||||
padding: 3px 10px;
|
padding: 3px 10px;
|
||||||
|
|
||||||
@ -359,4 +365,5 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
font-family: @font-family-monospace;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user