1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-09 09:51:02 +01:00

stop click directive to prevent CSP errors

This commit is contained in:
Kyle Spearrin 2017-06-07 19:01:27 -04:00
parent 7ebafaf0fc
commit 3359e78047
15 changed files with 76 additions and 64 deletions

View File

@ -0,0 +1,11 @@
angular
.module('bit.directives')
// ref: https://stackoverflow.com/a/14165848/1090359
.directive('stopClick', function () {
return function (scope, element, attrs) {
$(element).click(function (event) {
event.preventDefault();
});
}
});

View File

@ -44,12 +44,12 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="users(collection)">
<a href="#" stop-click ng-click="users(collection)">
<i class="fa fa-fw fa-users"></i> Users
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="delete(collection)" class="text-red">
<a href="#" stop-click ng-click="delete(collection)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -57,7 +57,7 @@
</div>
</td>
<td valign="middle">
<a href="javascript:void(0)" ng-click="edit(collection)">
<a href="#" stop-click ng-click="edit(collection)">
{{collection.name}}
</a>
</td>

View File

@ -23,12 +23,12 @@
</button>
<ul class="dropdown-menu">
<li ng-show="!user.accessAll">
<a href="javascript:void(0)" ng-click="remove(user)" class="text-red">
<a href="#" stop-click ng-click="remove(user)" class="text-red">
<i class="fa fa-fw fa-remove"></i> Remove
</a>
</li>
<li ng-show="user.accessAll">
<a href="javascript:void(0)">
<a href="#" stop-click>
No options...
</a>
</li>

View File

@ -44,12 +44,12 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="users(group)">
<a href="#" stop-click ng-click="users(group)">
<i class="fa fa-fw fa-users"></i> Users
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="delete(group)" class="text-red">
<a href="#" stop-click ng-click="delete(group)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -57,7 +57,7 @@
</div>
</td>
<td valign="middle">
<a href="javascript:void(0)" ng-click="edit(group)">
<a href="#" stop-click ng-click="edit(group)">
{{group.name}}
</a>
</td>

View File

@ -23,7 +23,7 @@
</button>
<ul class="dropdown-menu">
<li ng-show="user.organizationUserId">
<a href="javascript:void(0)" ng-click="remove(user)" class="text-red">
<a href="#" stop-click ng-click="remove(user)" class="text-red">
<i class="fa fa-fw fa-remove"></i> Remove
</a>
</li>

View File

@ -37,27 +37,27 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="edit(user)">
<a href="#" stop-click ng-click="edit(user)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="groups(user)" ng-if="useGroups">
<a href="#" stop-click ng-click="groups(user)" ng-if="useGroups">
<i class="fa fa-fw fa-sitemap"></i> Groups
</a>
</li>
<li ng-show="user.status === 1">
<a href="javascript:void(0)" ng-click="confirm(user)">
<a href="#" stop-click ng-click="confirm(user)">
<i class="fa fa-fw fa-check"></i> Confirm
</a>
</li>
<li ng-show="user.status === 0">
<a href="javascript:void(0)" ng-click="reinvite(user)">
<a href="#" stop-click ng-click="reinvite(user)">
<i class="fa fa-fw fa-envelope-o"></i> Re-send Invitation
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="delete(user)" class="text-red">
<a href="#" stop-click ng-click="delete(user)" class="text-red">
<i class="fa fa-fw fa-remove"></i> Remove
</a>
</li>
@ -68,7 +68,7 @@
<letter-avatar data="{{user.name || user.email}}"></letter-avatar>
</td>
<td>
<a href="javascript:void(0)" ng-click="edit(user)">{{user.email}}</a>
<a href="#" stop-click ng-click="edit(user)">{{user.email}}</a>
<i class="fa fa-unlock text-muted" ng-show="user.accessAll"
title="Can Access All Items"></i>
<div ng-if="user.name"><small class="text-muted">{{user.name}}</small></div>

View File

@ -42,23 +42,23 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="editLogin(login)">
<a href="#" stop-click ng-click="editLogin(login)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="editCollections(login)">
<a href="#" stop-click ng-click="editCollections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="removeLogin(login, collection)" class="text-red"
<a href="#" stop-click ng-click="removeLogin(login, collection)" class="text-red"
ng-if="collection.id">
<i class="fa fa-fw fa-remove"></i> Remove
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
<a href="#" stop-click ng-click="deleteLogin(login)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -66,7 +66,7 @@
</div>
</td>
<td>
<a href="javascript:void(0)" ng-click="editLogin(login)">{{login.name}}</a>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<div class="text-sm text-muted">{{login.username}}</div>
</td>
</tr>

View File

@ -25,7 +25,7 @@
required api-field />
</div>
<div class="form-group">
<label for="email">Email - <a href="javascript:void(0)" ng-click="changeEmail()">change</a></label>
<label for="email">Email - <a href="#" stop-click ng-click="changeEmail()">change</a></label>
<input type="text" id="email" ng-model="model.email" class="form-control" readonly />
</div>
<div class="form-group" show-errors>
@ -121,13 +121,13 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="leaveOrganization(org)" class="text-red">
<a href="#" stop-click ng-click="leaveOrganization(org)" class="text-red">
<i class="fa fa-fw fa-sign-out"></i> Leave
</a>
</li>
</ul>
</div>
<a href="javascript:void(0)" ng-click="viewOrganization(org)">
<a href="#" stop-click ng-click="viewOrganization(org)">
<letter-avatar data="{{org.name}}" round="false" avwidth="25" avheight="25"
avclass="img-rounded" fontsize="10"></letter-avatar>
{{org.name}}

View File

@ -28,12 +28,12 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="addEdit($index)">
<a href="#" stop-click ng-click="addEdit($index)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="delete($index)" class="text-red">
<a href="#" stop-click ng-click="delete($index)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -76,19 +76,19 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-if="!globalDomain.excluded"
<a href="#" stop-click ng-if="!globalDomain.excluded"
ng-click="toggleExclude(globalDomain)">
<i class="fa fa-fw fa-remove"></i> Exclude
</a>
</li>
<li>
<a href="javascript:void(0)" ng-if="globalDomain.excluded"
<a href="#" stop-click ng-if="globalDomain.excluded"
ng-click="toggleExclude(globalDomain)">
<i class="fa fa-fw fa-plus"></i> Include
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="customize(globalDomain)">
<a href="#" stop-click ng-click="customize(globalDomain)">
<i class="fa fa-fw fa-cut"></i> Customize
</a>
</li>

View File

@ -28,7 +28,7 @@
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li>
<a href="javascript:void(0)" ng-click="addLogin(null, true)">
<a href="#" stop-click ng-click="addLogin(null, true)">
<i class="fa fa-fw fa-plus-circle"></i> Add Login
</a>
</li>
@ -57,22 +57,22 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="editLogin(login)">
<a href="#" stop-click ng-click="editLogin(login)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li ng-show="!login.organizationId">
<a href="javascript:void(0)" ng-click="share(login)">
<a href="#" stop-click ng-click="share(login)">
<i class="fa fa-fw fa-share-alt"></i> Share
</a>
</li>
<li ng-show="login.organizationId && login.edit">
<a href="javascript:void(0)" ng-click="collections(login)">
<a href="#" stop-click ng-click="collections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
<a href="#" stop-click ng-click="deleteLogin(login)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -80,7 +80,7 @@
</div>
</td>
<td>
<a href="javascript:void(0)" ng-click="editLogin(login)">{{login.name}}</a>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId"></i>
<div class="text-sm text-muted">{{login.username}}</div>
</td>
@ -106,17 +106,17 @@
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li>
<a href="javascript:void(0)" ng-click="addLogin(folder)">
<a href="#" stop-click ng-click="addLogin(folder)">
<i class="fa fa-fw fa-plus-circle"></i> Add Login
</a>
</li>
<li ng-show="folder.id">
<a href="javascript:void(0)" ng-click="editFolder(folder)">
<a href="#" stop-click ng-click="editFolder(folder)">
<i class="fa fa-fw fa-pencil"></i> Edit Folder
</a>
</li>
<li ng-show="canDeleteFolder(folder)">
<a href="javascript:void(0)" ng-click="deleteFolder(folder)" class="text-red">
<a href="#" stop-click ng-click="deleteFolder(folder)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete Folder
</a>
</li>
@ -145,22 +145,22 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="editLogin(login)">
<a href="#" stop-click ng-click="editLogin(login)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li ng-show="!login.organizationId">
<a href="javascript:void(0)" ng-click="share(login)">
<a href="#" stop-click ng-click="share(login)">
<i class="fa fa-fw fa-share-alt"></i> Share
</a>
</li>
<li ng-show="login.organizationId && login.edit">
<a href="javascript:void(0)" ng-click="collections(login)">
<a href="#" stop-click ng-click="collections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
<a href="#" stop-click ng-click="deleteLogin(login)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete
</a>
</li>
@ -168,7 +168,7 @@
</div>
</td>
<td>
<a href="javascript:void(0)" ng-click="editLogin(login)">{{login.name}}</a>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<i class="fa fa-star text-muted" title="Favorite" ng-show="login.favorite"></i>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId"></i>
<div class="text-sm text-muted">{{login.username}}</div>
@ -184,7 +184,7 @@
<div class="tab-content">
<ul class="control-sidebar-menu">
<li>
<a href="javascript:void(0)" ng-click="clearFilters()">
<a href="#" stop-click ng-click="clearFilters()">
Clear All Filters
</a>
</li>
@ -194,7 +194,7 @@
</h3>
<ul class="control-sidebar-menu">
<li ng-repeat="folder in vaultFolders track by folder.id">
<a href="javascript:void(0)" ng-click="filterFolder(folder)">
<a href="#" stop-click ng-click="filterFolder(folder)">
<i class="fa fa-check" ng-if="folder.id === folderIdFilter"></i>
{{folder.name}}
</a>

View File

@ -58,17 +58,17 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0)" ng-click="editLogin(login)">
<a href="#" stop-click ng-click="editLogin(login)">
<i class="fa fa-fw fa-pencil"></i> Edit
</a>
</li>
<li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="editCollections(login)">
<a href="#" stop-click ng-click="editCollections(login)">
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li ng-show="login.edit">
<a href="javascript:void(0)" ng-click="removeLogin(login, collection)"
<a href="#" stop-click ng-click="removeLogin(login, collection)"
ng-if="collection.id" class="text-red">
<i class="fa fa-fw fa-remove"></i> Remove
</a>
@ -77,7 +77,7 @@
</div>
</td>
<td>
<a href="javascript:void(0)" ng-click="editLogin(login)">{{login.name}}</a>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<i class="fa fa-star text-muted" title="Favorite" ng-show="login.favorite"></i>
<div class="text-sm text-muted">{{login.username}}</div>
</td>

View File

@ -29,7 +29,7 @@
</a>
</li>
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-edge fa-lg fa-fw fa-li"></i> Edge
<small class="text-muted">(coming soon)</small>
</a>
@ -87,7 +87,7 @@
</a>
</li>
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-windows fa-lg fa-fw fa-li"></i> Windows
<small class="text-muted">(coming soon)</small>
</a>
@ -106,13 +106,13 @@
<div class="col-sm-6">
<ul class="fa-ul">
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-windows fa-lg fa-fw fa-li"></i> Desktop Windows
<small class="text-muted">(coming soon)</small>
</a>
</li>
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-apple fa-lg fa-fw fa-li"></i> Desktop macOS
<small class="text-muted">(coming soon)</small>
</a>
@ -122,13 +122,13 @@
<div class="col-sm-6">
<ul class="fa-ul">
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-linux fa-lg fa-fw fa-li"></i> Desktop Linux
<small class="text-muted">(coming soon)</small>
</a>
</li>
<li>
<a href="javascript:void(0)">
<a href="#" stop-click>
<i class="fa fa-terminal fa-lg fa-fw fa-li"></i> CLI
<small class="text-muted">(coming soon)</small>
</a>

View File

@ -14,7 +14,7 @@
<ul class="nav navbar-nav">
<li><a ui-sref="frontend.logout">Log Out</a></li>
<li class="control-sidebar-show">
<a href="#" ng-click="toggleControlSidebar()"><i class="fa fa-bars"></i></a>
<a href="#" stop-click ng-click="toggleControlSidebar()"><i class="fa fa-bars"></i></a>
</li>
</ul>
</div>
@ -53,7 +53,7 @@
</a>
<ul class="treeview-menu" ng-class="{'menu-open': $state.includes('backend.org.vault')}">
<li>
<a href="javascript:void(0)" ng-click="addOrganizationLogin()">
<a href="#" stop-click ng-click="addOrganizationLogin()">
<i class="fa fa-plus-circle fa-fw"></i> New Login
</a>
</li>
@ -65,7 +65,7 @@
</a>
<ul class="treeview-menu" ng-class="{'menu-open': $state.includes('backend.org.collections')}">
<li>
<a href="javascript:void(0)" ng-click="addOrganizationCollection()">
<a href="#" stop-click ng-click="addOrganizationCollection()">
<i class="fa fa-plus-circle fa-fw"></i> New Collection
</a>
</li>
@ -77,7 +77,7 @@
</a>
<ul class="treeview-menu" ng-class="{'menu-open': $state.includes('backend.org.people')}">
<li>
<a href="javascript:void(0)" ng-click="inviteOrganizationUser()">
<a href="#" stop-click ng-click="inviteOrganizationUser()">
<i class="fa fa-plus-circle fa-fw"></i> Invite a User
</a>
</li>
@ -89,7 +89,7 @@
</a>
<ul class="treeview-menu" ng-class="{'menu-open': $state.includes('backend.org.groups')}">
<li>
<a href="javascript:void(0)" ng-click="addOrganizationGroup()">
<a href="#" stop-click ng-click="addOrganizationGroup()">
<i class="fa fa-plus-circle fa-fw"></i> New Group
</a>
</li>

View File

@ -14,7 +14,7 @@
<ul class="nav navbar-nav">
<li><a ui-sref="frontend.logout">Log Out</a></li>
<li class="control-sidebar-show">
<a href="#" ng-click="toggleControlSidebar()"><i class="fa fa-bars"></i></a>
<a href="#" stop-click ng-click="toggleControlSidebar()"><i class="fa fa-bars"></i></a>
</li>
</ul>
</div>
@ -46,12 +46,12 @@
<a ui-sref="backend.user.vault"><i class="fa fa-lock fa-fw"></i> <span>My Vault</span></a>
<ul class="treeview-menu" ng-class="{'menu-open': $state.includes('backend.user.vault')}">
<li>
<a href="javascript:void(0)" ng-click="addLogin()">
<a href="#" stop-click ng-click="addLogin()">
<i class="fa fa-plus-circle fa-fw"></i> New Login
</a>
</li>
<li>
<a href="javascript:void(0)" ng-click="addFolder()">
<a href="#" stop-click ng-click="addFolder()">
<i class="fa fa-folder fa-fw"></i> New Folder
</a>
</li>
@ -119,7 +119,7 @@
</div>
<ul class="list-inline" ng-if="orgs.length">
<li ng-repeat="org in orgs | orderBy: ['name'] track by org.id">
<a href="javascript:void(0)" ng-click="viewOrganization(org)">
<a href="#" stop-click ng-click="viewOrganization(org)">
<letter-avatar data="{{org.name}}" avclass="img-responsive img-rounded" round="false"
avheight="40" avwidth="40" bgcolor="#2c3b41" avborder="true"
borderstyle="3px solid #1a2226"></letter-avatar>

View File

@ -72,7 +72,7 @@
<script>(window.angular||document.write('<script src="lib\/angular\/angular.min.js?v=<!-- @echo cacheTag !>"><\/script>'));</script>
<script src="js/lib.min.js?v=<!-- @echo cacheTag !>"></script>
<script src="js/bw.min.js?v=<!-- @echo cacheTag"></script>
<script src="js/bw.min.js?v=<!-- @echo cacheTag !>"></script>
<script src="js/app.min.js?v=<!-- @echo cacheTag !>"></script>
<!-- @endif -->
<!-- @exclude -->
@ -116,6 +116,7 @@
<script src="app/directives/passwordMeterDirective.js"></script>
<script src="app/directives/passwordViewerDirective.js"></script>
<script src="app/directives/letterAvatarDirective.js"></script>
<script src="app/directives/stopClickDirective.js"></script>
<script src="app/filters/filtersModule.js"></script>
<script src="app/filters/enumNameFilter.js"></script>