mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
Compare commits
613 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9b5426f6f | ||
|
|
bf885c184f | ||
|
|
0d2bf4f7a1 | ||
|
|
01ffc68fc2 | ||
|
|
16892239fb | ||
|
|
d5765d8814 | ||
|
|
8d6a96074d | ||
|
|
f54884eb79 | ||
|
|
828149b2d6 | ||
|
|
501c4fc263 | ||
|
|
1d0b45e17d | ||
|
|
a0f7ed68fb | ||
|
|
7bd0c17188 | ||
|
|
1ea9d28523 | ||
|
|
8a3fb92bbe | ||
|
|
de3a9b9903 | ||
|
|
9834f3d2aa | ||
|
|
ac079b9d88 | ||
|
|
9e96906f32 | ||
|
|
90c079e743 | ||
|
|
4ecf307285 | ||
|
|
6cf4c453d9 | ||
|
|
d2899d14c7 | ||
|
|
f3b438d514 | ||
|
|
2997f694f8 | ||
|
|
b78ab4db27 | ||
|
|
37dddea515 | ||
|
|
e307d1e87d | ||
|
|
62e1dbb642 | ||
|
|
b8a425f530 | ||
|
|
cafb6fa694 | ||
|
|
0482ddea2c | ||
|
|
b411176c8d | ||
|
|
2f13449cb6 | ||
|
|
b0c1b7b683 | ||
|
|
7e8978c7fc | ||
|
|
d58b422bd0 | ||
|
|
3563601382 | ||
|
|
d42e6ca3fd | ||
|
|
7f0d8c99e3 | ||
|
|
48a67dc2b3 | ||
|
|
8d0b42492d | ||
|
|
e4076e95dd | ||
|
|
30a2b878f6 | ||
|
|
e17f94a67d | ||
|
|
4dd60c3844 | ||
|
|
9d76990f24 | ||
|
|
ed3d15f075 | ||
|
|
2c36a2aa96 | ||
|
|
16930aa422 | ||
|
|
263f5ba147 | ||
|
|
6a60c00e22 | ||
|
|
f3eaf644b0 | ||
|
|
a57110b935 | ||
|
|
cae8beaa8f | ||
|
|
df94d81d07 | ||
|
|
f03c22cc07 | ||
|
|
5b31fe37f2 | ||
|
|
c60a596995 | ||
|
|
b52ecd8085 | ||
|
|
4323341d19 | ||
|
|
e13992ba27 | ||
|
|
52a4317d09 | ||
|
|
d53187935b | ||
|
|
0d6c96e38b | ||
|
|
b0832578a4 | ||
|
|
805393b4db | ||
|
|
c3653577c6 | ||
|
|
1eb5a99ba3 | ||
|
|
a035d73545 | ||
|
|
79fc3056a6 | ||
|
|
e44cf6e7ee | ||
|
|
641c76ae62 | ||
|
|
1efcd69148 | ||
|
|
49ee41f7d3 | ||
|
|
598c7ea068 | ||
|
|
001a116c8b | ||
|
|
106e71fe54 | ||
|
|
cd93d6cc32 | ||
|
|
d63c89bae7 | ||
|
|
fb3a7733a3 | ||
|
|
852363cb77 | ||
|
|
7f6ee21a8e | ||
|
|
2963516d5c | ||
|
|
1f26ff5c80 | ||
|
|
de3f310082 | ||
|
|
4af2edafd3 | ||
|
|
4de08f2e71 | ||
|
|
d978e1dfa3 | ||
|
|
f828288b84 | ||
|
|
7a36f13034 | ||
|
|
422b48fa36 | ||
|
|
fe9e29a057 | ||
|
|
88c302ca2e | ||
|
|
52f3032483 | ||
|
|
b13edfeeae | ||
|
|
4046339569 | ||
|
|
52f4a9d961 | ||
|
|
ca0fb6d66a | ||
|
|
7c93c82d24 | ||
|
|
3b71760f9e | ||
|
|
c4d2045884 | ||
|
|
d28c59544f | ||
|
|
acff0b19d6 | ||
|
|
94bfcb2865 | ||
|
|
1bb6244337 | ||
|
|
a132ec4fd7 | ||
|
|
8291fa0ce1 | ||
|
|
37364ecd7e | ||
|
|
48d9e626f5 | ||
|
|
f0fbf664d4 | ||
|
|
7b8b4dc164 | ||
|
|
21635dd728 | ||
|
|
c7802940b1 | ||
|
|
f7b60febe9 | ||
|
|
6c93a63c06 | ||
|
|
c44a638644 | ||
|
|
0d3fead0f3 | ||
|
|
5ba4b37610 | ||
|
|
44a2d071ae | ||
|
|
3b22764368 | ||
|
|
11336da6df | ||
|
|
a0e5591f8e | ||
|
|
e952073c3c | ||
|
|
9bdd0d116a | ||
|
|
05c8a39e6d | ||
|
|
8fa6ff48cf | ||
|
|
7a31783ea4 | ||
|
|
96585b183d | ||
|
|
f81e7b02dc | ||
|
|
f7fbdf2081 | ||
|
|
06a877c755 | ||
|
|
30abd52189 | ||
|
|
6af0e62976 | ||
|
|
84a36a18d6 | ||
|
|
595cf6c375 | ||
|
|
4262e2cc1d | ||
|
|
c134986bbf | ||
|
|
d9981e1d71 | ||
|
|
2b6d7ec361 | ||
|
|
aaa91e50b7 | ||
|
|
ff9030e7af | ||
|
|
cc39e6402e | ||
|
|
c89b641b88 | ||
|
|
465304b004 | ||
|
|
63033ca12d | ||
|
|
f019dc6575 | ||
|
|
d15e3a64e7 | ||
|
|
7099b0579a | ||
|
|
2c2d08c7cc | ||
|
|
671e9ccb1c | ||
|
|
f93c5cb9a1 | ||
|
|
8c7f1c4359 | ||
|
|
d7c1c6efa1 | ||
|
|
30a2301697 | ||
|
|
c639186c60 | ||
|
|
5618cfb031 | ||
|
|
7e97c04d1e | ||
|
|
4d25077108 | ||
|
|
635caa9ad0 | ||
|
|
2772bffd09 | ||
|
|
995fc96a5d | ||
|
|
4660ad824d | ||
|
|
801049cbd0 | ||
|
|
09a7b4ea90 | ||
|
|
226c201925 | ||
|
|
4749a3da89 | ||
|
|
ae567ab462 | ||
|
|
bf382889d3 | ||
|
|
2272bcac71 | ||
|
|
a209c9450a | ||
|
|
2539a9c23f | ||
|
|
e95ede73ba | ||
|
|
ad970b1cb7 | ||
|
|
161e7d1763 | ||
|
|
3a823d32b5 | ||
|
|
4c46317f24 | ||
|
|
0271c223a6 | ||
|
|
9a4669067d | ||
|
|
53f3124345 | ||
|
|
b49a40b077 | ||
|
|
fb10da8ce3 | ||
|
|
b286c1a29b | ||
|
|
e5e7712716 | ||
|
|
2beb22e8cf | ||
|
|
747b5608e8 | ||
|
|
dad3cd9414 | ||
|
|
0c1fb3e118 | ||
|
|
afe223f410 | ||
|
|
e1ec50bcad | ||
|
|
04da844b22 | ||
|
|
f944910975 | ||
|
|
96b8467859 | ||
|
|
84554174ac | ||
|
|
65e03e707c | ||
|
|
fd9fcbea38 | ||
|
|
a1dfd7493a | ||
|
|
d4759d4056 | ||
|
|
d879518233 | ||
|
|
ef6cb3779b | ||
|
|
fc22114855 | ||
|
|
6b1eb5a479 | ||
|
|
bbd8a1265b | ||
|
|
444f63db42 | ||
|
|
f46a6aefea | ||
|
|
10792f714e | ||
|
|
d6d535ed9e | ||
|
|
55a50fac83 | ||
|
|
a7beed334f | ||
|
|
83274ad7a4 | ||
|
|
24056163dd | ||
|
|
79383ed693 | ||
|
|
d2da3f6e00 | ||
|
|
c40193c861 | ||
|
|
715835c12f | ||
|
|
0242de9145 | ||
|
|
b075f25d7c | ||
|
|
0b34b7a980 | ||
|
|
f291b24a7a | ||
|
|
9707fa34e4 | ||
|
|
cd19e0c9e4 | ||
|
|
38883b9550 | ||
|
|
f761733d0b | ||
|
|
842b157955 | ||
|
|
87f0e2be0e | ||
|
|
c3bea80ec7 | ||
|
|
a1529bc4e9 | ||
|
|
ccb7ede4fa | ||
|
|
1dbf831bda | ||
|
|
ea4d772dda | ||
|
|
25536e10ef | ||
|
|
51e30b2f7a | ||
|
|
47cb20f01e | ||
|
|
204ee72926 | ||
|
|
b9cbc1546c | ||
|
|
bc8892a237 | ||
|
|
b62950fa2b | ||
|
|
ab12c990bc | ||
|
|
abed4df973 | ||
|
|
76da9b1f18 | ||
|
|
11cbe3b7bb | ||
|
|
08b432775e | ||
|
|
49dbf4945f | ||
|
|
ff729608e1 | ||
|
|
b380d723b7 | ||
|
|
ed13644a02 | ||
|
|
8a90f562ef | ||
|
|
dfd791ecf9 | ||
|
|
8df16f28e7 | ||
|
|
1fb220c25e | ||
|
|
b24f892f60 | ||
|
|
5d81ed6a96 | ||
|
|
7ff79a0fdd | ||
|
|
7b4cf53ec4 | ||
|
|
9c7b47c277 | ||
|
|
547c7b8b70 | ||
|
|
1d70434ed1 | ||
|
|
06d53d350d | ||
|
|
742d7240f7 | ||
|
|
9b3ca76934 | ||
|
|
9f1c445214 | ||
|
|
075ba931ea | ||
|
|
29cbe48eb5 | ||
|
|
be1cc945a2 | ||
|
|
3e61d938bc | ||
|
|
0ee928cdce | ||
|
|
5d87fae906 | ||
|
|
afcc5ceb5b | ||
|
|
74d8e595f2 | ||
|
|
bc988181f9 | ||
|
|
1030654ce2 | ||
|
|
1c25143a75 | ||
|
|
39281811f5 | ||
|
|
2f07d22a9e | ||
|
|
1d1b9706ce | ||
|
|
7a19d444f1 | ||
|
|
73eb743f54 | ||
|
|
181ee74ba3 | ||
|
|
b8e9567501 | ||
|
|
dda64b301e | ||
|
|
af56551fd2 | ||
|
|
c55d0449cb | ||
|
|
0135476b68 | ||
|
|
e366b7c7a7 | ||
|
|
ca9a0b072e | ||
|
|
2f3035a08f | ||
|
|
cf5b0635e4 | ||
|
|
4db5c96781 | ||
|
|
e49948b512 | ||
|
|
1298d42b09 | ||
|
|
00e74dd2c8 | ||
|
|
10fe79c558 | ||
|
|
cddabebe86 | ||
|
|
9a7dac706c | ||
|
|
2e2998bb8b | ||
|
|
ce1352cb9f | ||
|
|
00007c20a7 | ||
|
|
cdaf3cb428 | ||
|
|
d640bb5a04 | ||
|
|
b1ebcb76f0 | ||
|
|
488dbb6715 | ||
|
|
f170157817 | ||
|
|
c094a26cbf | ||
|
|
366506555a | ||
|
|
9eb4043595 | ||
|
|
3359e78047 | ||
|
|
7ebafaf0fc | ||
|
|
fadd070663 | ||
|
|
27d291b0e9 | ||
|
|
f07f58733c | ||
|
|
b5521425ae | ||
|
|
b191ecd29e | ||
|
|
5989918300 | ||
|
|
f5720cf20e | ||
|
|
2106e48e0e | ||
|
|
1dd9e459c6 | ||
|
|
138b57b33d | ||
|
|
3845c55155 | ||
|
|
9aa2014e85 | ||
|
|
9239588757 | ||
|
|
5904b269e7 | ||
|
|
9bf3e31d6f | ||
|
|
618cb07ead | ||
|
|
1e3a39defc | ||
|
|
0aab548b87 | ||
|
|
489b93d5df | ||
|
|
cfb2a4d404 | ||
|
|
3b8ad132bc | ||
|
|
8510711e5d | ||
|
|
9918e903b2 | ||
|
|
6a292d6905 | ||
|
|
62926d6e28 | ||
|
|
51edf80e48 | ||
|
|
804f1f5610 | ||
|
|
3f0b14e48a | ||
|
|
3e0ce5544c | ||
|
|
933cbb72aa | ||
|
|
6bda5d5983 | ||
|
|
bfae8e7def | ||
|
|
96a91b97e9 | ||
|
|
12096a8fb3 | ||
|
|
e03d4d52c4 | ||
|
|
ea24d72f01 | ||
|
|
a4473ad739 | ||
|
|
08c28950f4 | ||
|
|
5cc8439f5b | ||
|
|
eb7fd4a015 | ||
|
|
dce609d141 | ||
|
|
f31360ecbf | ||
|
|
93e88d8b23 | ||
|
|
816cc0b17b | ||
|
|
1f73269480 | ||
|
|
f7d1b8821c | ||
|
|
cd5ad9f85b | ||
|
|
9c706f07f0 | ||
|
|
ea82925e14 | ||
|
|
1c5f208ef1 | ||
|
|
aeae0ba535 | ||
|
|
f59b227c44 | ||
|
|
4518e7056c | ||
|
|
565c6bafae | ||
|
|
584e8131cd | ||
|
|
20e958b1ee | ||
|
|
21ca3abc7e | ||
|
|
612ad32722 | ||
|
|
8ec07266b9 | ||
|
|
a9a7b0b317 | ||
|
|
e634e3e28f | ||
|
|
86de4b721f | ||
|
|
1d95a78e75 | ||
|
|
f5e44163be | ||
|
|
1ffc005479 | ||
|
|
31f67d412b | ||
|
|
cc62237ab5 | ||
|
|
f11d4a92df | ||
|
|
0be6249c2b | ||
|
|
a083fc9084 | ||
|
|
54172c441f | ||
|
|
b5f8b1014e | ||
|
|
df42c6176d | ||
|
|
7d0a34fceb | ||
|
|
b3e94b13f7 | ||
|
|
4eee908f2f | ||
|
|
1ebae5c284 | ||
|
|
361f03eb5f | ||
|
|
d8f54fc15a | ||
|
|
90b0f3201e | ||
|
|
b0d2374960 | ||
|
|
5c471e43dd | ||
|
|
c69169cbf9 | ||
|
|
f2c670dfd0 | ||
|
|
cfdd6dc0d9 | ||
|
|
d61b6c2faa | ||
|
|
e010995b19 | ||
|
|
053a1c1394 | ||
|
|
581184e2ae | ||
|
|
84e617b201 | ||
|
|
4ba21638b1 | ||
|
|
f92c5a214f | ||
|
|
180101400f | ||
|
|
ede10677f9 | ||
|
|
7627601ff8 | ||
|
|
cb120d2e75 | ||
|
|
ec86ccd956 | ||
|
|
63a657cac5 | ||
|
|
c3eb6bb972 | ||
|
|
eab5c0db12 | ||
|
|
0b9083915a | ||
|
|
051703234c | ||
|
|
6d555bcf84 | ||
|
|
d99fcd8e59 | ||
|
|
04eee919e8 | ||
|
|
0926c82878 | ||
|
|
79744d89ce | ||
|
|
214274f495 | ||
|
|
2425eb0ff8 | ||
|
|
c8931cde6e | ||
|
|
af698c7628 | ||
|
|
52745993cb | ||
|
|
7a8d23ba84 | ||
|
|
34559f0dbd | ||
|
|
b34a205ace | ||
|
|
799fbeba72 | ||
|
|
0e36abe1ad | ||
|
|
69ce07ef01 | ||
|
|
9f32e76a99 | ||
|
|
e89e48014c | ||
|
|
9863a95a71 | ||
|
|
dc0bf54401 | ||
|
|
3728f012d7 | ||
|
|
f904558315 | ||
|
|
a79556dfce | ||
|
|
901332dbee | ||
|
|
1ab75115f0 | ||
|
|
bc431b896b | ||
|
|
aa7a3c442c | ||
|
|
6825967cb9 | ||
|
|
cdc06a2b49 | ||
|
|
309c73a972 | ||
|
|
c4a3e5c4fd | ||
|
|
8d6cbe8e1e | ||
|
|
ff4e76b723 | ||
|
|
acdbc6b9a3 | ||
|
|
6714390890 | ||
|
|
249d00b285 | ||
|
|
e4ffdf6815 | ||
|
|
2228263b9f | ||
|
|
ee1c884ef1 | ||
|
|
0d29c75e7f | ||
|
|
7042f4bca8 | ||
|
|
ea42ed5381 | ||
|
|
ba6ca4a6bb | ||
|
|
ce68c1599f | ||
|
|
ce64601e38 | ||
|
|
b9f6351720 | ||
|
|
da8b31533a | ||
|
|
0591f106d3 | ||
|
|
40f9961541 | ||
|
|
5c8117539c | ||
|
|
af7400642b | ||
|
|
f8c5f31f97 | ||
|
|
5f2c2a8064 | ||
|
|
08aa53748e | ||
|
|
673485b5c4 | ||
|
|
18bea7edb2 | ||
|
|
cdf029bc84 | ||
|
|
31ce92fa9d | ||
|
|
f6b1666cd7 | ||
|
|
5f130bdda7 | ||
|
|
d619167c02 | ||
|
|
400932c6de | ||
|
|
8984ec3127 | ||
|
|
02076fadf4 | ||
|
|
1d93d5c687 | ||
|
|
5f028ea65f | ||
|
|
cf22ea2b78 | ||
|
|
58df3e692b | ||
|
|
80ca89b3f6 | ||
|
|
4209d91c43 | ||
|
|
79b878209d | ||
|
|
24cbe13ca7 | ||
|
|
f8fcbbea85 | ||
|
|
40d38ec0db | ||
|
|
f63f4e0aa3 | ||
|
|
d4b4c7bd71 | ||
|
|
bdef522da7 | ||
|
|
bb1ba1dbc4 | ||
|
|
2b880d322a | ||
|
|
60f62b2b50 | ||
|
|
b11d7be990 | ||
|
|
05d153e1d2 | ||
|
|
eaba45369b | ||
|
|
71adf31f7b | ||
|
|
d39d49fb8f | ||
|
|
7c91066618 | ||
|
|
57116c4f54 | ||
|
|
80e4d2329a | ||
|
|
7591843220 | ||
|
|
653afe9f8b | ||
|
|
8f007a70db | ||
|
|
0feea6091b | ||
|
|
b27b4bef44 | ||
|
|
2798a05e8e | ||
|
|
fe039f7b35 | ||
|
|
ea5dc4b7fc | ||
|
|
acc214d7c1 | ||
|
|
83c232ecb5 | ||
|
|
157875f7d5 | ||
|
|
ef00e57f72 | ||
|
|
8098ab50e8 | ||
|
|
ebb1044c43 | ||
|
|
751935e90b | ||
|
|
a81572914a | ||
|
|
e00f033ffd | ||
|
|
bf9414199c | ||
|
|
3011e9a804 | ||
|
|
a678f03284 | ||
|
|
11002c2881 | ||
|
|
2692bbaa63 | ||
|
|
1db6d7f32b | ||
|
|
61cce7e8e7 | ||
|
|
616a442fcb | ||
|
|
916519a43a | ||
|
|
af2f7a7a5a | ||
|
|
9ab9fcd577 | ||
|
|
853d1f4cfa | ||
|
|
cbcfdafef6 | ||
|
|
b156a27d1f | ||
|
|
f6ce6426f1 | ||
|
|
e12582c2c2 | ||
|
|
4d2cae0b0f | ||
|
|
35e0f27f52 | ||
|
|
77ddc83a04 | ||
|
|
3c83741b13 | ||
|
|
636c709671 | ||
|
|
f3f1b413b7 | ||
|
|
8eaad64dd6 | ||
|
|
f80ba6b87c | ||
|
|
5e5e3b5359 | ||
|
|
19203e976b | ||
|
|
2154607d11 | ||
|
|
072de1ea44 | ||
|
|
1818dad0d1 | ||
|
|
d51eab779c | ||
|
|
9f1ab6f961 | ||
|
|
0b875fc6f7 | ||
|
|
fd62938db0 | ||
|
|
4499ec6a22 | ||
|
|
dde20f4451 | ||
|
|
715b91ab96 | ||
|
|
7d26361680 | ||
|
|
b85a45d8f9 | ||
|
|
22ab5d334e | ||
|
|
acf124c81e | ||
|
|
51d81dea9f | ||
|
|
4a6066bb88 | ||
|
|
6ece16ccc9 | ||
|
|
0acab61f2e | ||
|
|
1cbd322105 | ||
|
|
ed9d26fd1b | ||
|
|
14e290c489 | ||
|
|
429b2b8a21 | ||
|
|
e7707c4826 | ||
|
|
290cbe6b55 | ||
|
|
d5708f24e6 | ||
|
|
3d273f041e | ||
|
|
22299c03cd | ||
|
|
0ea4b4400f | ||
|
|
b3c8337f83 | ||
|
|
a9e85f8765 | ||
|
|
b36799bf0c | ||
|
|
4d71a05d2a | ||
|
|
4fdf2a98bf | ||
|
|
880be03211 | ||
|
|
27495d5055 | ||
|
|
492e2e693c | ||
|
|
05a92ebd26 | ||
|
|
0d2e296eda | ||
|
|
ad25267ed7 | ||
|
|
1ed86899bb | ||
|
|
63c136a1ff | ||
|
|
3905b2b945 | ||
|
|
afaaf7d73a | ||
|
|
642b35582f | ||
|
|
117188769c | ||
|
|
bd7aad37e6 | ||
|
|
08b4e08820 | ||
|
|
aa4f360f59 | ||
|
|
2420375d56 | ||
|
|
bc5c738c25 | ||
|
|
ccc527f329 | ||
|
|
cf144aa2c1 | ||
|
|
086d924f06 | ||
|
|
24862f31b3 | ||
|
|
877eb4d423 | ||
|
|
a37a5fa1b5 | ||
|
|
2478a8f3cc | ||
|
|
3ed69d887f | ||
|
|
f0d440d204 | ||
|
|
3e18f812db | ||
|
|
8cf02fd59a | ||
|
|
06bfab3afa | ||
|
|
71e4697562 | ||
|
|
cf1bffe2f1 | ||
|
|
55a5fd49dc | ||
|
|
3f6637eb8f | ||
|
|
7373e281ac | ||
|
|
52b89455d7 | ||
|
|
bca7592c77 | ||
|
|
f6ab0bfe82 | ||
|
|
012a5c491d | ||
|
|
7666d6136d | ||
|
|
7bdda34f14 |
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
*
|
||||
!dist/*
|
||||
!entrypoint.sh
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -199,4 +199,5 @@ FakesAssemblies/
|
||||
*.opt
|
||||
|
||||
# Other
|
||||
project.lock.json
|
||||
package-lock.json
|
||||
src/js/*.min.js
|
||||
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM bitwarden/server
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./dist .
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
11
README.md
11
README.md
@@ -1,9 +1,11 @@
|
||||
[] (https://ci.appveyor.com/project/bitwarden/web) [](https://gitter.im/bitwarden/Lobby)
|
||||
[](https://ci.appveyor.com/project/bitwarden/web) [](https://hub.docker.com/u/bitwarden/) [](https://gitter.im/bitwarden/Lobby)
|
||||
|
||||
# bitwarden Web
|
||||
|
||||
The bitwarden Web project is an AngularJS application that powers the web vault (https://vault.bitwarden.com/).
|
||||
|
||||
<img src="https://i.imgur.com/rxrykeX.png" alt="" width="791" height="739" />
|
||||
|
||||
# Build/Run
|
||||
|
||||
**Requirements**
|
||||
@@ -11,8 +13,9 @@ The bitwarden Web project is an AngularJS application that powers the web vault
|
||||
- Node.js
|
||||
- Gulp
|
||||
|
||||
Unless you are running the [Core](https://github.com/bitwarden/core) API locally, you'll probably need to switch the
|
||||
application to target the production API. Open `package.json` and set `production` to `true`.
|
||||
By default the application points to the production API. If you want to change that to point to a local instance of
|
||||
the [Core](https://github.com/bitwarden/core) API, you can modify the `package.json` `env` property to `Development`
|
||||
and then set your local endpoints in `settings.json`.
|
||||
|
||||
Then run the following commands:
|
||||
|
||||
@@ -26,4 +29,4 @@ You can now access the web vault at `http://localhost:4001`.
|
||||
|
||||
Code contributions are welcome! Please commit any pull requests against the `master` branch.
|
||||
|
||||
Security audits and feedback are welcome. Please open an issue or email us privately if the report is sensitive in nature.
|
||||
Security audits and feedback are welcome. Please open an issue or email us privately if the report is sensitive in nature. You can read our security policy in the [`SECURITY.md`](SECURITY.md) file.
|
||||
|
||||
45
SECURITY.md
Normal file
45
SECURITY.md
Normal file
@@ -0,0 +1,45 @@
|
||||
bitwarden believes that working with security researchers across the globe is crucial to keeping our
|
||||
users safe. If you believe you've found a security issue in our product or service, we encourage you to
|
||||
notify us. We welcome working with you to resolve the issue promptly. Thanks in advance!
|
||||
|
||||
# Disclosure Policy
|
||||
|
||||
- Let us know as soon as possible upon discovery of a potential security issue, and we'll make every
|
||||
effort to quickly resolve the issue.
|
||||
- Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or a
|
||||
third-party. We may publicly disclose the issue before resolving it, if appropriate.
|
||||
- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or
|
||||
degradation of our service. Only interact with accounts you own or with explicit permission of the
|
||||
account holder.
|
||||
- If you would like to encrypt your report, please use the PGP key with long ID
|
||||
`0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool).
|
||||
|
||||
# In-scope
|
||||
|
||||
- Security issues in any current release of bitwarden. This includes the web vault, browser extension,
|
||||
and mobile apps (iOS and Android). Product downloads are available at https://bitwarden.com. Source
|
||||
code is available at https://github.com/bitwarden.
|
||||
|
||||
# Exclusions
|
||||
|
||||
The following bug classes are out-of scope:
|
||||
|
||||
- Bugs that are already reported on any of bitwarden's issue trackers (https://github.com/bitwarden),
|
||||
or that we already know of. Note that some of our issue tracking is private.
|
||||
- Issues in an upstream software dependency (ex: Xamarin, ASP.NET) which are already reported to the
|
||||
upstream maintainer.
|
||||
- Attacks requiring physical access to a user's device.
|
||||
- Self-XSS
|
||||
- Issues related to software or protocols not under bitwarden's control
|
||||
- Vulnerabilities in outdated versions of bitwarden
|
||||
- Missing security best practices that do not directly lead to a vulnerability
|
||||
- Issues that do not have any impact on the general public
|
||||
|
||||
While researching, we'd like to ask you to refrain from:
|
||||
|
||||
- Denial of service
|
||||
- Spamming
|
||||
- Social engineering (including phishing) of bitwarden staff or contractors
|
||||
- Any physical attempts against bitwarden property or data centers
|
||||
|
||||
Thank you for helping keep bitwarden and our users safe!
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.9
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "bitwarden-web", ".", "{25BEDEF4-2CAF-445A-807D-63C17FF85694}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
|
||||
13
build.ps1
Normal file
13
build.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
echo "`n# Building Web"
|
||||
|
||||
echo "`nBuilding app"
|
||||
echo "npm version $(npm --version)"
|
||||
echo "gulp version $(gulp --version)"
|
||||
npm install
|
||||
gulp dist:selfHosted
|
||||
|
||||
echo "`nBuilding docker image"
|
||||
docker --version
|
||||
docker build -t bitwarden/web $dir\.
|
||||
33
build.sh
Normal file
33
build.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
echo ""
|
||||
|
||||
if [ $# -gt 1 -a "$1" == "push" ]
|
||||
then
|
||||
TAG=$2
|
||||
echo "# Pushing Web ($TAG)"
|
||||
echo ""
|
||||
docker push bitwarden/web:$TAG
|
||||
elif [ $# -gt 1 -a "$1" == "tag" ]
|
||||
then
|
||||
TAG=$2
|
||||
echo "Tagging Web as '$TAG'"
|
||||
docker tag bitwarden/web bitwarden/web:$TAG
|
||||
else
|
||||
echo "# Building Web"
|
||||
|
||||
echo ""
|
||||
echo "Building app"
|
||||
echo "npm version $(npm --version)"
|
||||
echo "gulp version $(gulp --version)"
|
||||
npm install
|
||||
gulp dist:selfHosted
|
||||
|
||||
echo ""
|
||||
echo "Building docker image"
|
||||
docker --version
|
||||
docker build -t bitwarden/web $DIR/.
|
||||
fi
|
||||
1
dist/.publish
vendored
Submodule
1
dist/.publish
vendored
Submodule
Submodule dist/.publish added at 1990d717ea
5
entrypoint.sh
Normal file
5
entrypoint.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp /etc/bitwarden/web/settings.js /app/js/settings.js
|
||||
cp /etc/bitwarden/web/app-id.json /app/app-id.json
|
||||
dotnet /bitwarden_server/Server.dll /contentRoot=/app /webRoot=. /serveUnknown=false
|
||||
204
gulpfile.js
204
gulpfile.js
@@ -17,11 +17,15 @@ var gulp = require('gulp'),
|
||||
settings = require('./settings.json'),
|
||||
project = require('./package.json'),
|
||||
jshint = require('gulp-jshint'),
|
||||
_ = require('lodash');
|
||||
_ = require('lodash'),
|
||||
webpack = require('webpack-stream'),
|
||||
browserify = require('browserify'),
|
||||
derequire = require('gulp-derequire'),
|
||||
source = require('vinyl-source-stream');
|
||||
|
||||
var paths = {};
|
||||
paths.dist = './dist/';
|
||||
paths.webroot = './src/'
|
||||
paths.webroot = './src/';
|
||||
paths.js = paths.webroot + 'js/**/*.js';
|
||||
paths.minJs = paths.webroot + 'js/**/*.min.js';
|
||||
paths.concatJsDest = paths.webroot + 'js/bw.min.js';
|
||||
@@ -42,7 +46,7 @@ gulp.task('lint', function () {
|
||||
gulp.task('build', function (cb) {
|
||||
return runSequence(
|
||||
'clean',
|
||||
['lib', 'less', 'settings', 'lint'],
|
||||
['browserify', 'lib', 'webpack', 'less', 'settings', 'lint', 'min:js'],
|
||||
cb);
|
||||
});
|
||||
|
||||
@@ -61,7 +65,16 @@ gulp.task('clean:lib', function (cb) {
|
||||
gulp.task('clean', ['clean:js', 'clean:css', 'clean:lib', 'dist:clean']);
|
||||
|
||||
gulp.task('min:js', ['clean:js'], function () {
|
||||
return gulp.src([paths.js, '!' + paths.minJs], { base: '.' })
|
||||
return gulp.src(
|
||||
[
|
||||
paths.js,
|
||||
'!' + paths.minJs,
|
||||
'!' + paths.jsDir + 'fallback*.js',
|
||||
'!' + paths.jsDir + 'u2f-connector.js',
|
||||
'!' + paths.jsDir + 'duo.js',
|
||||
'!' + paths.jsDir + 'settings.js'
|
||||
], { base: '.' })
|
||||
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||
.pipe(concat(paths.concatJsDest))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('.'));
|
||||
@@ -107,8 +120,8 @@ gulp.task('lib', ['clean:lib'], function () {
|
||||
dest: paths.libDir + 'angular'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-bootstrap-npm/dist/*tpls*.js',
|
||||
dest: paths.libDir + 'angular-bootstrap'
|
||||
src: paths.npmDir + 'angular-ui-bootstrap/dist/*tpls*.js',
|
||||
dest: paths.libDir + 'angular-ui-bootstrap'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-bootstrap-show-errors/src/*.js',
|
||||
@@ -122,14 +135,14 @@ gulp.task('lib', ['clean:lib'], function () {
|
||||
src: paths.npmDir + 'angular-jwt/dist/*.js',
|
||||
dest: paths.libDir + 'angular-jwt'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-md5/angular-md5*.js',
|
||||
dest: paths.libDir + 'angular-md5'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-resource/*resource*.js',
|
||||
dest: paths.libDir + 'angular-resource'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-sanitize/*sanitize*.js',
|
||||
dest: paths.libDir + 'angular-sanitize'
|
||||
},
|
||||
{
|
||||
src: [paths.npmDir + 'angular-toastr/dist/**/*.css', paths.npmDir + 'angular-toastr/dist/**/*.js'],
|
||||
dest: paths.libDir + 'angular-toastr'
|
||||
@@ -142,10 +155,6 @@ gulp.task('lib', ['clean:lib'], function () {
|
||||
src: paths.npmDir + 'angular-messages/*messages*.js',
|
||||
dest: paths.libDir + 'angular-messages'
|
||||
},
|
||||
{
|
||||
src: [paths.npmDir + 'sjcl/core/cbc.js', paths.npmDir + 'sjcl/core/bitArray.js', paths.npmDir + 'sjcl/sjcl.js'],
|
||||
dest: paths.libDir + 'sjcl'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'ngstorage/*.js',
|
||||
dest: paths.libDir + 'ngstorage'
|
||||
@@ -162,12 +171,28 @@ gulp.task('lib', ['clean:lib'], function () {
|
||||
src: paths.npmDir + 'clipboard/dist/clipboard*.js',
|
||||
dest: paths.libDir + 'clipboard'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'node-forge/dist/prime.worker.*',
|
||||
dest: paths.libDir + 'forge'
|
||||
},
|
||||
{
|
||||
src: [
|
||||
paths.npmDir + 'angulartics-google-analytics/lib/angulartics*.js',
|
||||
paths.npmDir + 'angulartics/src/angulartics.js'
|
||||
],
|
||||
dest: paths.libDir + 'angulartics'
|
||||
},
|
||||
//{
|
||||
// src: paths.npmDir + 'duo_web_sdk/index.js',
|
||||
// dest: paths.libDir + 'duo'
|
||||
//},
|
||||
{
|
||||
src: paths.jsDir + 'duo.js',
|
||||
dest: paths.libDir + 'duo'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'angular-promise-polyfill/index.js',
|
||||
dest: paths.libDir + 'angular-promise-polyfill'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -178,6 +203,34 @@ gulp.task('lib', ['clean:lib'], function () {
|
||||
return merge(tasks);
|
||||
});
|
||||
|
||||
gulp.task('webpack', ['webpack:forge']);
|
||||
|
||||
gulp.task('webpack:forge', function () {
|
||||
var forgeDir = paths.npmDir + '/node-forge/lib/';
|
||||
|
||||
return gulp.src([
|
||||
forgeDir + 'pbkdf2.js',
|
||||
forgeDir + 'aes.js',
|
||||
forgeDir + 'rsa.js',
|
||||
forgeDir + 'hmac.js',
|
||||
forgeDir + 'sha256.js',
|
||||
forgeDir + 'random.js',
|
||||
forgeDir + 'forge.js'
|
||||
]).pipe(webpack({
|
||||
output: {
|
||||
filename: 'forge.js',
|
||||
library: 'forge',
|
||||
libraryTarget: 'umd'
|
||||
},
|
||||
node: {
|
||||
Buffer: false,
|
||||
process: false,
|
||||
crypto: false,
|
||||
setImmediate: false
|
||||
}
|
||||
})).pipe(gulp.dest(paths.libDir + 'forge'));
|
||||
});
|
||||
|
||||
gulp.task('settings', function () {
|
||||
return config()
|
||||
.pipe(gulp.dest(paths.webroot + 'app'));
|
||||
@@ -189,10 +242,11 @@ function config() {
|
||||
createModule: false,
|
||||
constants: _.merge({}, {
|
||||
appSettings: {
|
||||
selfHosted: false,
|
||||
version: project.version,
|
||||
environment: project.production ? 'Production' : 'Development'
|
||||
environment: project.env
|
||||
}
|
||||
}, require('./settings' + (project.production ? '.Production' : '') + '.json') || {})
|
||||
}, require('./settings' + (project.env !== 'Development' ? ('.' + project.env) : '') + '.json') || {})
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -207,8 +261,37 @@ gulp.task('watch', function () {
|
||||
gulp.watch('./settings*.json', ['settings']);
|
||||
});
|
||||
|
||||
gulp.task('browserify', ['browserify:stripe', 'browserify:cc']);
|
||||
|
||||
gulp.task('browserify:stripe', function () {
|
||||
return browserify(paths.npmDir + 'angular-stripe/src/index.js',
|
||||
{
|
||||
entry: '.',
|
||||
standalone: 'angularStripe',
|
||||
global: true
|
||||
})
|
||||
.transform('exposify', { expose: { angular: 'angular' } })
|
||||
.bundle()
|
||||
.pipe(source('angular-stripe.js'))
|
||||
.pipe(derequire())
|
||||
.pipe(gulp.dest(paths.libDir + 'angular-stripe'));
|
||||
});
|
||||
|
||||
gulp.task('browserify:cc', function () {
|
||||
return browserify(paths.npmDir + 'angular-credit-cards/src/index.js',
|
||||
{
|
||||
entry: '.',
|
||||
standalone: 'angularCreditCards'
|
||||
})
|
||||
.transform('exposify', { expose: { angular: 'angular' } })
|
||||
.bundle()
|
||||
.pipe(source('angular-credit-cards.js'))
|
||||
.pipe(derequire())
|
||||
.pipe(gulp.dest(paths.libDir + 'angular-credit-cards'));
|
||||
});
|
||||
|
||||
gulp.task('dist:clean', function (cb) {
|
||||
return rimraf(paths.dist, cb);
|
||||
return rimraf(paths.dist + '**/*', cb);
|
||||
});
|
||||
|
||||
gulp.task('dist:move', function () {
|
||||
@@ -221,7 +304,7 @@ gulp.task('dist:move', function () {
|
||||
src: [
|
||||
paths.npmDir + 'bootstrap/dist/**/bootstrap.min.js',
|
||||
paths.npmDir + 'bootstrap/dist/**/bootstrap.min.css',
|
||||
paths.npmDir + 'bootstrap/dist/**/fonts/**/*',
|
||||
paths.npmDir + 'bootstrap/dist/**/fonts/**/*'
|
||||
],
|
||||
dest: paths.dist + 'lib/bootstrap'
|
||||
},
|
||||
@@ -240,12 +323,35 @@ gulp.task('dist:move', function () {
|
||||
src: paths.npmDir + 'angular/angular.min.js',
|
||||
dest: paths.dist + 'lib/angular'
|
||||
},
|
||||
{
|
||||
src: paths.npmDir + 'node-forge/dist/prime.worker.*',
|
||||
dest: paths.dist + 'lib/forge'
|
||||
},
|
||||
//{
|
||||
// src: paths.npmDir + 'duo_web_sdk/index.js',
|
||||
// dest: paths.dist + 'lib/duo'
|
||||
//},
|
||||
{
|
||||
src: paths.jsDir + 'duo.js',
|
||||
dest: paths.dist + 'js'
|
||||
},
|
||||
{
|
||||
src: paths.jsDir + 'settings.js',
|
||||
dest: paths.dist + 'js'
|
||||
},
|
||||
{
|
||||
src: paths.jsDir + 'bw.min.js',
|
||||
dest: paths.dist + 'js'
|
||||
},
|
||||
{
|
||||
src: [
|
||||
paths.webroot + '**/app/**/*.html',
|
||||
paths.webroot + '**/images/**/*',
|
||||
paths.webroot + 'index.html',
|
||||
paths.webroot + 'favicon.ico'
|
||||
paths.webroot + 'u2f-connector.html',
|
||||
paths.webroot + 'duo-connector.html',
|
||||
paths.webroot + 'favicon.ico',
|
||||
paths.webroot + 'app-id.json'
|
||||
],
|
||||
dest: paths.dist
|
||||
}
|
||||
@@ -264,7 +370,7 @@ gulp.task('dist:css', function () {
|
||||
paths.cssDir + '**/*.css',
|
||||
'!' + paths.cssDir + '**/*.min.css'
|
||||
])
|
||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
||||
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||
.pipe(cssmin())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest(paths.dist + 'css'));
|
||||
@@ -280,18 +386,41 @@ gulp.task('dist:js:app', function () {
|
||||
]);
|
||||
|
||||
merge(mainStream, config())
|
||||
.pipe(preprocess({ context: { cacheTag: randomString } }))
|
||||
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||
.pipe(concat(paths.dist + '/js/app.min.js'))
|
||||
.pipe(ngAnnotate())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('dist:js:fallback', function () {
|
||||
var mainStream = gulp
|
||||
.src([
|
||||
paths.jsDir + 'fallback*.js'
|
||||
]);
|
||||
|
||||
merge(mainStream)
|
||||
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||
.pipe(uglify())
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(gulp.dest(paths.dist + 'js'));
|
||||
});
|
||||
|
||||
gulp.task('dist:js:u2f', function () {
|
||||
var mainStream = gulp
|
||||
.src([
|
||||
paths.jsDir + 'u2f*.js'
|
||||
]);
|
||||
|
||||
merge(mainStream)
|
||||
.pipe(concat(paths.dist + '/js/u2f.min.js'))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('dist:js:lib', function () {
|
||||
return gulp
|
||||
.src([
|
||||
paths.libDir + 'sjcl/sjcl.js',
|
||||
paths.libDir + 'sjcl/*.js',
|
||||
paths.libDir + 'angulartics/angulartics.js',
|
||||
paths.libDir + '**/*.js',
|
||||
'!' + paths.libDir + '**/*.min.js',
|
||||
@@ -309,26 +438,49 @@ gulp.task('dist:preprocess', function () {
|
||||
.src([
|
||||
paths.dist + '/**/*.html'
|
||||
], { base: '.' })
|
||||
.pipe(preprocess({ context: { cacheTag: randomString }}))
|
||||
.pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } }))
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('dist', ['build'], function (cb) {
|
||||
return runSequence(
|
||||
'dist:clean',
|
||||
['dist:move', 'dist:css', 'dist:js:app', 'dist:js:lib'],
|
||||
['dist:move', 'dist:css', 'dist:js:app', 'dist:js:lib', 'dist:js:fallback', 'dist:js:u2f'],
|
||||
'dist:preprocess',
|
||||
cb);
|
||||
});
|
||||
|
||||
var selfHosted = false;
|
||||
gulp.task('dist:selfHosted', function (cb) {
|
||||
selfHosted = true;
|
||||
return runSequence('dist', cb);
|
||||
});
|
||||
|
||||
gulp.task('deploy', ['dist'], function () {
|
||||
return gulp.src(paths.dist + '**/*')
|
||||
.pipe(ghPages({ cacheDir: paths.dist + '.publish' }));
|
||||
});
|
||||
|
||||
gulp.task('deploy-preview', ['dist'], function () {
|
||||
return gulp.src(paths.dist + '**/*')
|
||||
.pipe(ghPages({
|
||||
cacheDir: paths.dist + '.publish',
|
||||
remoteUrl: 'git@github.com:bitwarden/web-preview.git'
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('serve', function () {
|
||||
connect.server({
|
||||
port: 4001,
|
||||
root: ['src']
|
||||
root: ['src'],
|
||||
//https: true,
|
||||
middleware: function (connect, opt) {
|
||||
return [function (req, res, next) {
|
||||
if (req.originalUrl.indexOf('app-id.json') > -1) {
|
||||
res.setHeader('Content-Type', 'application/fido.trusted-apps+json');
|
||||
}
|
||||
next();
|
||||
}];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
80
package.json
80
package.json
@@ -1,47 +1,55 @@
|
||||
{
|
||||
"name": "bitwarden",
|
||||
"version": "1.8.0",
|
||||
"production": false,
|
||||
"version": "1.22.0",
|
||||
"env": "Production",
|
||||
"devDependencies": {
|
||||
"connect": "3.4.1",
|
||||
"lodash": "4.13.1",
|
||||
"connect": "3.6.5",
|
||||
"lodash": "4.17.4",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-concat": "2.6.0",
|
||||
"gulp-cssmin": "0.1.7",
|
||||
"gulp-less": "3.1.0",
|
||||
"gulp-concat": "2.6.1",
|
||||
"gulp-cssmin": "0.2.0",
|
||||
"gulp-less": "3.3.2",
|
||||
"gulp-rename": "1.2.2",
|
||||
"gulp-uglify": "1.5.3",
|
||||
"gulp-gh-pages": "0.5.4",
|
||||
"gulp-uglify": "3.0.0",
|
||||
"gulp-gh-pages": "git@github.com:tekd/gulp-gh-pages.git#update-dependency",
|
||||
"gulp-preprocess": "2.0.0",
|
||||
"gulp-ng-annotate": "2.0.0",
|
||||
"gulp-ng-config": "1.3.1",
|
||||
"gulp-ng-config": "1.5.0",
|
||||
"gulp-connect": "5.0.0",
|
||||
"jshint": "2.9.2",
|
||||
"gulp-jshint": "2.0.1",
|
||||
"rimraf": "2.5.2",
|
||||
"run-sequence": "1.2.1",
|
||||
"merge-stream": "1.0.0",
|
||||
"jquery": "2.2.4",
|
||||
"font-awesome": "4.6.3",
|
||||
"bootstrap": "3.3.6",
|
||||
"sjcl": "1.0.3",
|
||||
"angular": "1.5.6",
|
||||
"angular-resource": "1.5.6",
|
||||
"angular-bootstrap-npm": "0.14.3",
|
||||
"angular-ui-router": "0.3.1",
|
||||
"angular-jwt": "0.0.9",
|
||||
"angular-cookies": "1.5.6",
|
||||
"admin-lte": "2.3.5",
|
||||
"angular-md5": "0.1.10",
|
||||
"angular-toastr": "1.7.0",
|
||||
"jshint": "2.9.5",
|
||||
"gulp-jshint": "2.0.4",
|
||||
"rimraf": "2.6.2",
|
||||
"run-sequence": "2.2.0",
|
||||
"merge-stream": "1.0.1",
|
||||
"jquery": "3.2.1",
|
||||
"font-awesome": "4.7.0",
|
||||
"bootstrap": "3.3.7",
|
||||
"angular": "1.6.7",
|
||||
"angular-resource": "1.6.7",
|
||||
"angular-sanitize": "1.6.7",
|
||||
"angular-ui-bootstrap": "2.5.6",
|
||||
"angular-ui-router": "0.4.2",
|
||||
"angular-jwt": "0.1.9",
|
||||
"angular-cookies": "1.6.7",
|
||||
"admin-lte": "2.3.11",
|
||||
"angular-toastr": "2.1.1",
|
||||
"angular-bootstrap-show-errors": "2.3.0",
|
||||
"angular-messages": "1.5.6",
|
||||
"ngstorage": "0.3.10",
|
||||
"papaparse": "4.1.2",
|
||||
"toastr": "2.1.2",
|
||||
"clipboard": "1.5.12",
|
||||
"ngclipboard": "1.1.1",
|
||||
"angulartics": "1.1.2",
|
||||
"angulartics-google-analytics": "0.2.1"
|
||||
"angular-messages": "1.6.7",
|
||||
"ngstorage": "0.3.11",
|
||||
"papaparse": "4.3.6",
|
||||
"clipboard": "1.7.1",
|
||||
"ngclipboard": "1.1.2",
|
||||
"angulartics": "1.5.0",
|
||||
"angulartics-google-analytics": "0.4.0",
|
||||
"node-forge": "0.7.1",
|
||||
"webpack-stream": "4.0.0",
|
||||
"angular-stripe": "5.0.0",
|
||||
"angular-credit-cards": "3.1.6",
|
||||
"browserify": "14.5.0",
|
||||
"vinyl-source-stream": "1.1.0",
|
||||
"gulp-derequire": "2.1.0",
|
||||
"exposify": "0.5.0",
|
||||
"duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git",
|
||||
"angular-promise-polyfill": "0.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
9
settings.Preview.json
Normal file
9
settings.Preview.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"appSettings": {
|
||||
"apiUri": "/api",
|
||||
"identityUri": "/identity",
|
||||
"iconsUri": "https://icons.bitwarden.com",
|
||||
"stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD",
|
||||
"braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"appSettings": {
|
||||
"apiUri": "https://api.bitwarden.com"
|
||||
}
|
||||
"appSettings": {
|
||||
"apiUri": "/api",
|
||||
"identityUri": "/identity",
|
||||
"iconsUri": "https://icons.bitwarden.com",
|
||||
"stripeKey": "pk_live_bpN0P37nMxrMQkcaHXtAybJk",
|
||||
"braintreeKey": "production_qfbsv8kc_njj2zjtyngtjmbjd"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"appSettings": {
|
||||
"rememberedEmailCookieName": "bit.rememberedEmail",
|
||||
"apiUri": "http://localhost:4000"
|
||||
"apiUri": "http://localhost:4000",
|
||||
"identityUri": "http://localhost:33656",
|
||||
"iconsUri": "https://icons.bitwarden.com",
|
||||
"stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD",
|
||||
"braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2"
|
||||
}
|
||||
}
|
||||
|
||||
15
src/app-id.json
Normal file
15
src/app-id.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"trustedFacets": [
|
||||
{
|
||||
"version": {
|
||||
"major": 1,
|
||||
"minor": 0
|
||||
},
|
||||
"ids": [
|
||||
"https://vault.bitwarden.com",
|
||||
"ios:bundle-id:com.8bit.bitwarden",
|
||||
"android:apk-key-hash:dUGFzUzf3lmHSLBDBIv+WaFyZMI"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,56 +2,277 @@ angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService,
|
||||
$state, appSettings, $analytics) {
|
||||
var rememberedEmail = $cookies.get(appSettings.rememberedEmailCookieName);
|
||||
if (rememberedEmail) {
|
||||
$scope.model = {
|
||||
email: rememberedEmail,
|
||||
rememberEmail: true
|
||||
$state, constants, $analytics, $uibModal, $timeout, $window, $filter, toastr) {
|
||||
$scope.state = $state;
|
||||
$scope.twoFactorProviderConstants = constants.twoFactorProvider;
|
||||
$scope.rememberTwoFactor = { checked: false };
|
||||
var stopU2fCheck = true;
|
||||
|
||||
$scope.returnState = $state.params.returnState;
|
||||
$scope.stateEmail = $state.params.email;
|
||||
if (!$scope.returnState && $state.params.org) {
|
||||
$scope.returnState = {
|
||||
name: 'backend.user.settingsCreateOrg',
|
||||
params: { plan: $state.params.org }
|
||||
};
|
||||
}
|
||||
else if (!$scope.returnState && $state.params.premium) {
|
||||
$scope.returnState = {
|
||||
name: 'backend.user.settingsPremium'
|
||||
};
|
||||
}
|
||||
|
||||
var email,
|
||||
masterPassword;
|
||||
if ($state.current.name.indexOf('twoFactor') > -1 && (!$scope.twoFactorProviders || !$scope.twoFactorProviders.length)) {
|
||||
$state.go('frontend.login.info', { returnState: $scope.returnState });
|
||||
}
|
||||
|
||||
var rememberedEmail = $cookies.get(constants.rememberedEmailCookieName);
|
||||
if (rememberedEmail || $scope.stateEmail) {
|
||||
$scope.model = {
|
||||
email: $scope.stateEmail || rememberedEmail,
|
||||
rememberEmail: rememberedEmail !== null
|
||||
};
|
||||
|
||||
$timeout(function () {
|
||||
$("#masterPassword").focus();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$timeout(function () {
|
||||
$("#email").focus();
|
||||
});
|
||||
}
|
||||
|
||||
var _email,
|
||||
_masterPassword;
|
||||
|
||||
$scope.twoFactorProviders = null;
|
||||
$scope.twoFactorProvider = null;
|
||||
|
||||
$scope.login = function (model) {
|
||||
$scope.loginPromise = authService.logIn(model.email, model.masterPassword);
|
||||
|
||||
$scope.loginPromise.then(function (twoFactorProviders) {
|
||||
$scope.loginPromise = authService.logIn(model.email, model.masterPassword).then(function (twoFactorProviders) {
|
||||
if (model.rememberEmail) {
|
||||
var cookieExpiration = new Date();
|
||||
cookieExpiration.setFullYear(cookieExpiration.getFullYear() + 10);
|
||||
|
||||
$cookies.put(
|
||||
appSettings.rememberedEmailCookieName,
|
||||
constants.rememberedEmailCookieName,
|
||||
model.email,
|
||||
{ expires: cookieExpiration });
|
||||
}
|
||||
else {
|
||||
$cookies.remove(appSettings.rememberedEmailCookieName);
|
||||
$cookies.remove(constants.rememberedEmailCookieName);
|
||||
}
|
||||
|
||||
if (twoFactorProviders && twoFactorProviders.length > 0) {
|
||||
email = model.email;
|
||||
masterPassword = model.masterPassword;
|
||||
if (twoFactorProviders && Object.keys(twoFactorProviders).length > 0) {
|
||||
_email = model.email;
|
||||
_masterPassword = model.masterPassword;
|
||||
|
||||
$scope.twoFactorProviders = cleanProviders(twoFactorProviders);
|
||||
$scope.twoFactorProvider = getDefaultProvider($scope.twoFactorProviders);
|
||||
|
||||
$analytics.eventTrack('Logged In To Two-step');
|
||||
$state.go('frontend.login.twoFactor');
|
||||
$state.go('frontend.login.twoFactor', { returnState: $scope.returnState }).then(function () {
|
||||
$timeout(function () {
|
||||
$("#code").focus();
|
||||
init();
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
$analytics.eventTrack('Logged In');
|
||||
$state.go('backend.vault');
|
||||
loggedInGo();
|
||||
}
|
||||
|
||||
model.masterPassword = '';
|
||||
});
|
||||
};
|
||||
|
||||
function getDefaultProvider(twoFactorProviders) {
|
||||
var keys = Object.keys(twoFactorProviders);
|
||||
var providerType = null;
|
||||
var providerPriority = -1;
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true });
|
||||
if (provider.length && provider[0].priority > providerPriority) {
|
||||
if (provider[0].type === constants.twoFactorProvider.u2f && !u2f.isSupported) {
|
||||
continue;
|
||||
}
|
||||
|
||||
providerType = provider[0].type;
|
||||
providerPriority = provider[0].priority;
|
||||
}
|
||||
}
|
||||
|
||||
if (providerType === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parseInt(providerType);
|
||||
}
|
||||
|
||||
function cleanProviders(twoFactorProviders) {
|
||||
if (canUseSecurityKey()) {
|
||||
return twoFactorProviders;
|
||||
}
|
||||
|
||||
var keys = Object.keys(twoFactorProviders);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var provider = $filter('filter')(constants.twoFactorProviderInfo, {
|
||||
type: keys[i],
|
||||
active: true,
|
||||
requiresUsb: false
|
||||
});
|
||||
if (!provider.length) {
|
||||
delete twoFactorProviders[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
return twoFactorProviders;
|
||||
}
|
||||
|
||||
// ref: https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser
|
||||
function canUseSecurityKey() {
|
||||
var mobile = false;
|
||||
(function (a) {
|
||||
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
|
||||
mobile = true;
|
||||
}
|
||||
})(navigator.userAgent || navigator.vendor || window.opera);
|
||||
|
||||
return !mobile && !navigator.userAgent.match(/iPad/i);
|
||||
}
|
||||
|
||||
$scope.twoFactor = function (token) {
|
||||
if ($scope.twoFactorProvider === constants.twoFactorProvider.email ||
|
||||
$scope.twoFactorProvider === constants.twoFactorProvider.authenticator) {
|
||||
token = token.replace(' ', '');
|
||||
}
|
||||
|
||||
$scope.twoFactorPromise = authService.logIn(_email, _masterPassword, token, $scope.twoFactorProvider,
|
||||
$scope.rememberTwoFactor.checked || false);
|
||||
|
||||
$scope.twoFactorPromise.then(function () {
|
||||
$analytics.eventTrack('Logged In From Two-step');
|
||||
loggedInGo();
|
||||
}, function () {
|
||||
if ($scope.twoFactorProvider === constants.twoFactorProvider.u2f) {
|
||||
init();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.twoFactor = function (model) {
|
||||
// Only supporting Authenticator (0) provider for now
|
||||
$scope.twoFactorPromise = authService.logIn(email, masterPassword, model.code, 0);
|
||||
$scope.anotherMethod = function () {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/accounts/views/accountsTwoFactorMethods.html',
|
||||
controller: 'accountsTwoFactorMethodsController',
|
||||
resolve: {
|
||||
providers: function () { return $scope.twoFactorProviders; }
|
||||
}
|
||||
});
|
||||
|
||||
$scope.twoFactorPromise.then(function () {
|
||||
$analytics.eventTrack('Logged In From Two-step');
|
||||
$state.go('backend.vault');
|
||||
modal.result.then(function (provider) {
|
||||
$scope.twoFactorProvider = provider;
|
||||
$timeout(function () {
|
||||
$("#code").focus();
|
||||
init();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.sendEmail = function (doToast) {
|
||||
if ($scope.twoFactorProvider !== constants.twoFactorProvider.email) {
|
||||
return;
|
||||
}
|
||||
|
||||
return cryptoService.makeKeyAndHash(_email, _masterPassword).then(function (result) {
|
||||
return apiService.twoFactor.sendEmailLogin({
|
||||
email: _email,
|
||||
masterPasswordHash: result.hash
|
||||
}).$promise;
|
||||
}).then(function () {
|
||||
if (doToast) {
|
||||
toastr.success('Verification email sent to ' + $scope.twoFactorEmail + '.');
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Could not send verification email.');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
stopU2fCheck = true;
|
||||
});
|
||||
|
||||
function loggedInGo() {
|
||||
if ($scope.returnState) {
|
||||
$state.go($scope.returnState.name, $scope.returnState.params);
|
||||
}
|
||||
else {
|
||||
$state.go('backend.user.vault');
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
stopU2fCheck = true;
|
||||
var params;
|
||||
if ($scope.twoFactorProvider === constants.twoFactorProvider.duo) {
|
||||
params = $scope.twoFactorProviders[constants.twoFactorProvider.duo];
|
||||
|
||||
$window.Duo.init({
|
||||
host: params.Host,
|
||||
sig_request: params.Signature,
|
||||
submit_callback: function (theForm) {
|
||||
var response = $(theForm).find('input[name="sig_response"]').val();
|
||||
$scope.twoFactor(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if ($scope.twoFactorProvider === constants.twoFactorProvider.u2f) {
|
||||
stopU2fCheck = false;
|
||||
params = $scope.twoFactorProviders[constants.twoFactorProvider.u2f];
|
||||
var challenges = JSON.parse(params.Challenges);
|
||||
|
||||
initU2f(challenges);
|
||||
}
|
||||
else if ($scope.twoFactorProvider === constants.twoFactorProvider.email) {
|
||||
params = $scope.twoFactorProviders[constants.twoFactorProvider.email];
|
||||
$scope.twoFactorEmail = params.Email;
|
||||
if (Object.keys($scope.twoFactorProviders).length > 1) {
|
||||
$scope.sendEmail(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initU2f(challenges) {
|
||||
if (stopU2fCheck) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (challenges.length < 1 || $scope.twoFactorProvider !== constants.twoFactorProvider.u2f) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('listening for u2f key...');
|
||||
|
||||
$window.u2f.sign(challenges[0].appId, challenges[0].challenge, [{
|
||||
version: challenges[0].version,
|
||||
keyHandle: challenges[0].keyHandle
|
||||
}], function (data) {
|
||||
if ($scope.twoFactorProvider !== constants.twoFactorProvider.u2f) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.errorCode) {
|
||||
console.log(data.errorCode);
|
||||
|
||||
$timeout(function () {
|
||||
initU2f(challenges);
|
||||
}, data.errorCode === 5 ? 0 : 1000);
|
||||
|
||||
return;
|
||||
}
|
||||
$scope.twoFactor(JSON.stringify(data));
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
|
||||
45
src/app/accounts/accountsOrganizationAcceptController.js
Normal file
45
src/app/accounts/accountsOrganizationAcceptController.js
Normal file
@@ -0,0 +1,45 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsOrganizationAcceptController', function ($scope, $state, apiService, authService, toastr, $analytics) {
|
||||
$scope.state = {
|
||||
name: $state.current.name,
|
||||
params: $state.params
|
||||
};
|
||||
|
||||
if (!$state.params.organizationId || !$state.params.organizationUserId || !$state.params.token ||
|
||||
!$state.params.email || !$state.params.organizationName) {
|
||||
$state.go('frontend.login.info').then(function () {
|
||||
toastr.error('Invalid parameters.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
if (authService.isAuthenticated()) {
|
||||
$scope.accepting = true;
|
||||
apiService.organizationUsers.accept(
|
||||
{
|
||||
orgId: $state.params.organizationId,
|
||||
id: $state.params.organizationUserId
|
||||
},
|
||||
{
|
||||
token: $state.params.token
|
||||
}, function () {
|
||||
$analytics.eventTrack('Accepted Invitation');
|
||||
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
|
||||
toastr.success('You can access this organization once an administrator confirms your membership.' +
|
||||
' We\'ll send an email when that happens.', 'Invite Accepted', { timeOut: 10000 });
|
||||
});
|
||||
}, function () {
|
||||
$analytics.eventTrack('Failed To Accept Invitation');
|
||||
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
|
||||
toastr.error('Unable to accept invitation.', 'Error');
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
$scope.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsPasswordHintController', function ($scope, $rootScope, apiService) {
|
||||
.controller('accountsPasswordHintController', function ($scope, $rootScope, apiService, $analytics) {
|
||||
$scope.success = false;
|
||||
|
||||
$scope.submit = function (model) {
|
||||
$scope.submitPromise = apiService.accounts.postPasswordHint({ email: model.email }, function () {
|
||||
$analytics.eventTrack('Requested Password Hint');
|
||||
$scope.success = true;
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsRecoverController', function ($scope, apiService, cryptoService) {
|
||||
.controller('accountsRecoverController', function ($scope, apiService, cryptoService, $analytics) {
|
||||
$scope.success = false;
|
||||
|
||||
$scope.submit = function (model) {
|
||||
var email = model.email.toLowerCase();
|
||||
var key = cryptoService.makeKey(model.masterPassword, email);
|
||||
|
||||
var request = {
|
||||
email: email,
|
||||
masterPasswordHash: cryptoService.hashPassword(model.masterPassword, key),
|
||||
recoveryCode: model.code.replace(/\s/g, '').toLowerCase()
|
||||
};
|
||||
|
||||
$scope.submitPromise = apiService.accounts.postTwoFactorRecover(request, function () {
|
||||
$scope.submitPromise = cryptoService.makeKeyAndHash(model.email, model.masterPassword).then(function (result) {
|
||||
return apiService.twoFactor.recover({
|
||||
email: email,
|
||||
masterPasswordHash: result.hash,
|
||||
recoveryCode: model.code.replace(/\s/g, '').toLowerCase()
|
||||
}).$promise;
|
||||
}).then(function () {
|
||||
$analytics.eventTrack('Recovered 2FA');
|
||||
$scope.success = true;
|
||||
}).$promise;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
13
src/app/accounts/accountsRecoverDeleteController.js
Normal file
13
src/app/accounts/accountsRecoverDeleteController.js
Normal file
@@ -0,0 +1,13 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsRecoverDeleteController', function ($scope, $rootScope, apiService, $analytics) {
|
||||
$scope.success = false;
|
||||
|
||||
$scope.submit = function (model) {
|
||||
$scope.submitPromise = apiService.accounts.postDeleteRecover({ email: model.email }, function () {
|
||||
$analytics.eventTrack('Started Delete Recovery');
|
||||
$scope.success = true;
|
||||
}).$promise;
|
||||
};
|
||||
});
|
||||
@@ -1,13 +1,43 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsRegisterController', function ($scope, $location, apiService, cryptoService, validationService, $analytics) {
|
||||
.controller('accountsRegisterController', function ($scope, $location, apiService, cryptoService, validationService,
|
||||
$analytics, $state, $timeout) {
|
||||
var params = $location.search();
|
||||
var stateParams = $state.params;
|
||||
$scope.createOrg = stateParams.org;
|
||||
|
||||
if (!stateParams.returnState && stateParams.org) {
|
||||
$scope.returnState = {
|
||||
name: 'backend.user.settingsCreateOrg',
|
||||
params: { plan: $state.params.org }
|
||||
};
|
||||
}
|
||||
else if (!stateParams.returnState && stateParams.premium) {
|
||||
$scope.returnState = {
|
||||
name: 'backend.user.settingsPremium',
|
||||
params: { plan: $state.params.org }
|
||||
};
|
||||
}
|
||||
else {
|
||||
$scope.returnState = stateParams.returnState;
|
||||
}
|
||||
|
||||
$scope.success = false;
|
||||
$scope.model = {
|
||||
email: params.email
|
||||
email: params.email ? params.email : stateParams.email
|
||||
};
|
||||
$scope.readOnlyEmail = stateParams.email !== null;
|
||||
|
||||
|
||||
$timeout(function () {
|
||||
if ($scope.model.email) {
|
||||
$("#name").focus();
|
||||
}
|
||||
else {
|
||||
$("#email").focus();
|
||||
}
|
||||
});
|
||||
|
||||
$scope.registerPromise = null;
|
||||
$scope.register = function (form) {
|
||||
@@ -27,17 +57,36 @@ angular
|
||||
}
|
||||
|
||||
var email = $scope.model.email.toLowerCase();
|
||||
var key = cryptoService.makeKey($scope.model.masterPassword, email);
|
||||
var request = {
|
||||
name: $scope.model.name,
|
||||
email: email,
|
||||
masterPasswordHash: cryptoService.hashPassword($scope.model.masterPassword, key),
|
||||
masterPasswordHint: $scope.model.masterPasswordHint
|
||||
};
|
||||
var makeResult, encKey;
|
||||
|
||||
$scope.registerPromise = cryptoService.makeKeyAndHash(email, $scope.model.masterPassword).then(function (result) {
|
||||
makeResult = result;
|
||||
encKey = cryptoService.makeEncKey(result.key);
|
||||
return cryptoService.makeKeyPair(encKey.encKey);
|
||||
}).then(function (result) {
|
||||
var request = {
|
||||
name: $scope.model.name,
|
||||
email: email,
|
||||
masterPasswordHash: makeResult.hash,
|
||||
masterPasswordHint: $scope.model.masterPasswordHint,
|
||||
key: encKey.encKeyEnc,
|
||||
keys: {
|
||||
publicKey: result.publicKey,
|
||||
encryptedPrivateKey: result.privateKeyEnc
|
||||
}
|
||||
};
|
||||
|
||||
return apiService.accounts.register(request).$promise;
|
||||
}, function (errors) {
|
||||
validationService.addError(form, null, 'Problem generating keys.', true);
|
||||
return false;
|
||||
}).then(function (result) {
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.registerPromise = apiService.accounts.register(request, function () {
|
||||
$scope.success = true;
|
||||
$analytics.eventTrack('Registered');
|
||||
}).$promise;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
40
src/app/accounts/accountsTwoFactorMethodsController.js
Normal file
40
src/app/accounts/accountsTwoFactorMethodsController.js
Normal file
@@ -0,0 +1,40 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsTwoFactorMethodsController', function ($scope, $uibModalInstance, $analytics, providers, constants) {
|
||||
$analytics.eventTrack('accountsTwoFactorMethodsController', { category: 'Modal' });
|
||||
|
||||
$scope.providers = [];
|
||||
|
||||
if (providers.hasOwnProperty(constants.twoFactorProvider.authenticator)) {
|
||||
add(constants.twoFactorProvider.authenticator);
|
||||
}
|
||||
if (providers.hasOwnProperty(constants.twoFactorProvider.yubikey)) {
|
||||
add(constants.twoFactorProvider.yubikey);
|
||||
}
|
||||
if (providers.hasOwnProperty(constants.twoFactorProvider.email)) {
|
||||
add(constants.twoFactorProvider.email);
|
||||
}
|
||||
if (providers.hasOwnProperty(constants.twoFactorProvider.duo)) {
|
||||
add(constants.twoFactorProvider.duo);
|
||||
}
|
||||
if (providers.hasOwnProperty(constants.twoFactorProvider.u2f) && u2f.isSupported) {
|
||||
add(constants.twoFactorProvider.u2f);
|
||||
}
|
||||
|
||||
$scope.choose = function (provider) {
|
||||
$uibModalInstance.close(provider.type);
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('close');
|
||||
};
|
||||
|
||||
function add(type) {
|
||||
for (var i = 0; i < constants.twoFactorProviderInfo.length; i++) {
|
||||
if (constants.twoFactorProviderInfo[i].type === type) {
|
||||
$scope.providers.push(constants.twoFactorProviderInfo[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
28
src/app/accounts/accountsVerifyEmailController.js
Normal file
28
src/app/accounts/accountsVerifyEmailController.js
Normal file
@@ -0,0 +1,28 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsVerifyEmailController', function ($scope, $state, apiService, toastr, $analytics) {
|
||||
if (!$state.params.userId || !$state.params.token) {
|
||||
$state.go('frontend.login.info').then(function () {
|
||||
toastr.error('Invalid parameters.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
apiService.accounts.verifyEmailToken({},
|
||||
{
|
||||
token: $state.params.token,
|
||||
userId: $state.params.userId
|
||||
}, function () {
|
||||
$analytics.eventTrack('Verified Email');
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.success('Your email has been verified. Thank you.', 'Success');
|
||||
});
|
||||
}, function () {
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.error('Unable to verify email.', 'Error');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
36
src/app/accounts/accountsVerifyRecoverDeleteController.js
Normal file
36
src/app/accounts/accountsVerifyRecoverDeleteController.js
Normal file
@@ -0,0 +1,36 @@
|
||||
angular
|
||||
.module('bit.accounts')
|
||||
|
||||
.controller('accountsVerifyRecoverDeleteController', function ($scope, $state, apiService, toastr, $analytics) {
|
||||
if (!$state.params.userId || !$state.params.token || !$state.params.email) {
|
||||
$state.go('frontend.login.info').then(function () {
|
||||
toastr.error('Invalid parameters.');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.email = $state.params.email;
|
||||
|
||||
$scope.delete = function () {
|
||||
if (!confirm('Are you sure you want to delete this account? This cannot be undone.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.deleting = true;
|
||||
apiService.accounts.postDeleteRecoverToken({},
|
||||
{
|
||||
token: $state.params.token,
|
||||
userId: $state.params.userId
|
||||
}, function () {
|
||||
$analytics.eventTrack('Recovered Delete');
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.success('Your account has been deleted. You can register a new account again if you like.',
|
||||
'Success');
|
||||
});
|
||||
}, function () {
|
||||
$state.go('frontend.login.info', null, { location: 'replace' }).then(function () {
|
||||
toastr.error('Unable to delete account.', 'Error');
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
<p class="login-box-msg">Log in to access your vault.</p>
|
||||
<form name="loginForm" ng-submit="loginForm.$valid && login(model)" api-form="loginPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="loginForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in loginForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
@@ -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: returnState, email: stateEmail})">
|
||||
Create a new account
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a ui-sref="frontend.passwordHint">
|
||||
Get master password hint
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
@@ -1,25 +1,166 @@
|
||||
<p class="login-box-msg">Enter your two-step verification code.</p>
|
||||
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(model)" api-form="twoFactorPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
<div ng-if="twoFactorProvider === twoFactorProviderConstants.authenticator ||
|
||||
twoFactorProvider === twoFactorProviderConstants.email">
|
||||
<p class="login-box-msg" ng-if="twoFactorProvider === twoFactorProviderConstants.authenticator">
|
||||
Enter the 6 digit verification code from your authenticator app.
|
||||
</p>
|
||||
<div ng-if="twoFactorProvider === twoFactorProviderConstants.email" class="text-center">
|
||||
<p class="login-box-msg">
|
||||
Enter the 6 digit verification code that was emailed to <b>{{twoFactorEmail}}</b>.
|
||||
</p>
|
||||
<p>
|
||||
Didn't get the email?
|
||||
<a href="#" stop-click ng-click="sendEmail(true)" ng-if="twoFactorProvider === twoFactorProviderConstants.email">
|
||||
Send it again
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="code" class="sr-only">Code</label>
|
||||
<input type="text" id="code" name="Code" class="form-control" placeholder="Verification code" ng-model="model.code"
|
||||
required api-field />
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a ui-sref="frontend.recover">Lost authenticator app?</a>
|
||||
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(token)" api-form="twoFactorPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="twoFactorForm.$loading"></i>Log In
|
||||
</button>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="code" class="sr-only">Code</label>
|
||||
<input type="text" id="code" name="Code" class="form-control" placeholder="Verification code"
|
||||
ng-model="token" required api-field autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
spellcheck="false" />
|
||||
<span class="fa fa-lock form-control-feedback"></span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="rememberMe" ng-model="rememberTwoFactor.checked" /> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="twoFactorForm.$loading"></i>Log In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div ng-if="twoFactorProvider === twoFactorProviderConstants.yubikey">
|
||||
<p class="login-box-msg">
|
||||
Complete logging in with YubiKey.
|
||||
</p>
|
||||
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(token)" api-form="twoFactorPromise"
|
||||
autocomplete="off">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>Insert your YubiKey into your computer's USB port, then touch its button.</p>
|
||||
<p>
|
||||
<img src="images/two-factor/yubikey.jpg" alt="" class="img-rounded img-responsive" />
|
||||
</p>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="code" class="sr-only">Token</label>
|
||||
<input type="password" id="code" name="Token" class="form-control" ng-model="token" required api-field />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="rememberMe" ng-model="rememberTwoFactor.checked" /> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="twoFactorForm.$loading"></i>Log In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div ng-if="twoFactorProvider === twoFactorProviderConstants.duo">
|
||||
<p class="login-box-msg">
|
||||
Complete logging in with Duo.
|
||||
</p>
|
||||
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(token)" api-form="twoFactorPromise"
|
||||
autocomplete="off">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="duoFrameWrapper">
|
||||
<iframe id="duo_iframe"></iframe>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="rememberMe" ng-model="rememberTwoFactor.checked" /> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<span ng-show="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon"></i> Logging in...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div ng-if="twoFactorProvider === twoFactorProviderConstants.u2f">
|
||||
<p class="login-box-msg">
|
||||
Complete logging in with FIDO U2F.
|
||||
</p>
|
||||
<form name="twoFactorForm" api-form="twoFactorPromise" autocomplete="off">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>Insert your Security Key into your computer's USB port. If it has a button, touch it.</p>
|
||||
<p>
|
||||
<img src="images/two-factor/u2fkey.jpg" alt="" class="img-rounded img-responsive" />
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="rememberMe" ng-model="rememberTwoFactor.checked" /> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<span ng-show="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon"></i> Logging in...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div ng-if="twoFactorProvider === null">
|
||||
<p>
|
||||
This account has two-step login enabled, however, none of the configured two-step providers are supported by this
|
||||
web browser.
|
||||
</p>
|
||||
Please use a supported web browser (such as Chrome) and/or add additional providers that are better supported
|
||||
across web browsers (such as an authenticator app).
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<ul>
|
||||
<li>
|
||||
<a stop-click href="#" ng-click="anotherMethod()">Use another two-step login method</a>
|
||||
</li>
|
||||
<li>
|
||||
<a ui-sref="frontend.login.info({returnState: returnState})">Back to log in</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
32
src/app/accounts/views/accountsOrganizationAccept.html
Normal file
32
src/app/accounts/views/accountsOrganizationAccept.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
<div ng-show="loading">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="accepting">
|
||||
Accepting invitation...
|
||||
</div>
|
||||
<div ng-show="!loading && !accepting">
|
||||
<p class="login-box-msg">Join {{state.params.organizationName}}</p>
|
||||
<p class="text-center"><strong>{{state.params.email}}</strong></p>
|
||||
<p>
|
||||
You've been invited to join the organization listed above.
|
||||
To accept the invitation, you need to log in or create a new bitwarden account.
|
||||
</p>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<a ui-sref="frontend.login.info({returnState: state, email: state.params.email})"
|
||||
class="btn btn-primary btn-block btn-flat">Log In</a>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<a ui-sref="frontend.register({returnState: state, email: state.params.email})"
|
||||
class="btn btn-primary btn-block btn-flat">Create Account</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13,7 +13,7 @@
|
||||
<form name="passwordHintForm" ng-submit="passwordHintForm.$valid && submit(model)" ng-show="!success"
|
||||
api-form="submitPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="passwordHintForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in passwordHintForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">Lost your authenticator app?</p>
|
||||
<p class="login-box-msg">
|
||||
In the event that you cannot access your account through your normal two-step login methods, you can use your
|
||||
two-step login recovery code to disable all two-step providers on your account.
|
||||
<a href="https://help.bitwarden.com/article/lost-two-step-device/" target="_blank">Learn more</a>
|
||||
</p>
|
||||
<div class="text-center" ng-show="success">
|
||||
<div class="callout callout-success">
|
||||
Two-step login has been successfully disabled on your account.
|
||||
@@ -13,7 +17,7 @@
|
||||
<form name="recoverForm" ng-submit="recoverForm.$valid && submit(model)" ng-show="!success"
|
||||
api-form="submitPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="recoverForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in recoverForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
|
||||
39
src/app/accounts/views/accountsRecoverDelete.html
Normal file
39
src/app/accounts/views/accountsRecoverDelete.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">Enter your email address below to recover & delete your bitwarden account.</p>
|
||||
<div ng-show="success" class="text-center">
|
||||
<div class="callout callout-success">
|
||||
If your account exists ({{model.email}}) we've sent you an email with further instructions.
|
||||
</div>
|
||||
<a ui-sref="frontend.login.info">Return to log in</a>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit(model)" ng-show="!success"
|
||||
api-form="submitPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="email" class="sr-only">Your account email address</label>
|
||||
<input type="email" id="email" name="Email" class="form-control" placeholder="Your account email address"
|
||||
ng-model="model.email" required api-field />
|
||||
<span class="fa fa-envelope form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a ui-sref="frontend.login.info">Return to log in</a>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -9,12 +9,16 @@
|
||||
<h4>Account Created!</h4>
|
||||
<p>You may now log in to your new account.</p>
|
||||
</div>
|
||||
<a ui-sref="frontend.login.info">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">
|
||||
<div class="callout callout-default" ng-show="createOrg">
|
||||
<h4>Create Organization, Step 1</h4>
|
||||
<p>Before creating your organization, you first need to create a free personal account.</p>
|
||||
</div>
|
||||
<div class="callout callout-danger validation-errors" ng-show="registerForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in registerForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
@@ -22,7 +26,7 @@
|
||||
<div class="form-group has-feedback" show-errors>
|
||||
<label for="email" class="sr-only">Email</label>
|
||||
<input type="email" id="email" name="Email" class="form-control" placeholder="Email" ng-model="model.email"
|
||||
required api-field />
|
||||
ng-readonly="readOnlyEmail" required api-field />
|
||||
<span class="fa fa-envelope form-control-feedback"></span>
|
||||
<p class="help-block">You'll use your email address to log in.</p>
|
||||
</div>
|
||||
@@ -60,7 +64,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a ui-sref="frontend.login.info">Already have an account?</a>
|
||||
<a ui-sref="frontend.login.info({returnState: returnState})">Already have an account?</a>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="registerForm.$loading">
|
||||
@@ -68,6 +72,11 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
By clicking the above "Submit" button, you are agreeing to the
|
||||
<a href="https://bitwarden.com/terms/" target="_blank">Terms of Service</a>
|
||||
and the
|
||||
<a href="https://bitwarden.com/privacy/" target="_blank">Privacy Policy</a>.
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
25
src/app/accounts/views/accountsTwoFactorMethods.html
Normal file
25
src/app/accounts/views/accountsTwoFactorMethods.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-key"></i> Two-step Providers</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="list-group" ng-repeat="provider in providers | orderBy: 'displayOrder'">
|
||||
<a href="#" stop-click class="list-group-item" ng-click="choose(provider)">
|
||||
<img alt="{{::provider.name}}" ng-src="{{'images/two-factor/' + provider.image}}" class="pull-right hidden-xs" />
|
||||
<h4 class="list-group-item-heading">{{::provider.name}}</h4>
|
||||
<p class="list-group-item-text">{{::provider.description}}</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="list-group" style="margin-bottom: 0;">
|
||||
<a href="https://help.bitwarden.com/article/lost-two-step-device/" target="_blank" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Recovery Code</h4>
|
||||
<p class="list-group-item-text">
|
||||
Lost access to all of your two-factor providers? Use your recovery code to disable
|
||||
all two-factor providers from your account.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
8
src/app/accounts/views/accountsVerifyEmail.html
Normal file
8
src/app/accounts/views/accountsVerifyEmail.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
Verifying email...
|
||||
</div>
|
||||
</div>
|
||||
21
src/app/accounts/views/accountsVerifyRecoverDelete.html
Normal file
21
src/app/accounts/views/accountsVerifyRecoverDelete.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<i class="fa fa-shield"></i> <b>bit</b>warden
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
<div ng-if="deleting">
|
||||
Deleting account...
|
||||
</div>
|
||||
<div ng-if="!deleting">
|
||||
<div class="callout callout-warning">
|
||||
<h4><i class="fa fa-warning fa-fw"></i> Warning</h4>
|
||||
This will permanently delete your account. This cannot be undone.
|
||||
</div>
|
||||
<p>
|
||||
You have requested to delete your bitwarden account (<b>{{email}}</b>).
|
||||
Click the button below to confirm and proceed.
|
||||
</p>
|
||||
<button ng-click="delete()" class="btn btn-danger btn-block btn-flat">Delete Account</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +1,13 @@
|
||||
angular
|
||||
.module('bit')
|
||||
|
||||
.factory('apiInterceptor', function ($injector, $q, toastr) {
|
||||
.factory('apiInterceptor', function ($injector, $q, toastr, appSettings, utilsService) {
|
||||
return {
|
||||
request: function (config) {
|
||||
if (config.url.indexOf(appSettings.apiUri + '/') > -1) {
|
||||
config.headers['Device-Type'] = utilsService.getDeviceType();
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
response: function (response) {
|
||||
|
||||
@@ -3,18 +3,25 @@
|
||||
'ui.router',
|
||||
'ngMessages',
|
||||
'angular-jwt',
|
||||
'angular-md5',
|
||||
'ui.bootstrap.showErrors',
|
||||
'toastr',
|
||||
'angulartics',
|
||||
// @if !selfHosted
|
||||
'angulartics.google.analytics',
|
||||
'angular-stripe',
|
||||
'credit-cards',
|
||||
// @endif
|
||||
'angular-promise-polyfill',
|
||||
|
||||
'bit.directives',
|
||||
'bit.filters',
|
||||
'bit.services',
|
||||
|
||||
'bit.global',
|
||||
'bit.accounts',
|
||||
'bit.vault',
|
||||
'bit.settings',
|
||||
'bit.tools'
|
||||
'bit.tools',
|
||||
'bit.organization',
|
||||
'bit.reports'
|
||||
]);
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
angular
|
||||
.module('bit')
|
||||
|
||||
.config(function ($stateProvider, $urlRouterProvider, $httpProvider, jwtInterceptorProvider, $uibTooltipProvider, toastrConfig) {
|
||||
jwtInterceptorProvider.urlParam = 'access_token2';
|
||||
.config(function ($stateProvider, $urlRouterProvider, $httpProvider, jwtInterceptorProvider, jwtOptionsProvider,
|
||||
$uibTooltipProvider, toastrConfig, $locationProvider, $qProvider, appSettings
|
||||
// @if !selfHosted
|
||||
/* jshint ignore:start */
|
||||
, stripeProvider
|
||||
/* jshint ignore:end */
|
||||
// @endif
|
||||
) {
|
||||
angular.extend(appSettings, window.bitwardenAppSettings);
|
||||
|
||||
$qProvider.errorOnUnhandledRejections(false);
|
||||
$locationProvider.hashPrefix('');
|
||||
|
||||
// @if false
|
||||
jwtOptionsProvider.config({
|
||||
whiteListedDomains: ['localhost', 'api.bitwarden.com', 'vault.bitwarden.com']
|
||||
});
|
||||
// @endif
|
||||
|
||||
var refreshPromise;
|
||||
jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (config, appSettings, tokenService, apiService, jwtHelper, $q) {
|
||||
if (config.url.indexOf(appSettings.apiUri) !== 0) {
|
||||
jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (options, tokenService, authService) {
|
||||
if (options.url.indexOf(appSettings.apiUri + '/') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,26 +39,22 @@ angular
|
||||
return token;
|
||||
}
|
||||
|
||||
var refreshToken = tokenService.getRefreshToken();
|
||||
if (!refreshToken) {
|
||||
var p = authService.refreshAccessToken();
|
||||
if (!p) {
|
||||
return;
|
||||
}
|
||||
|
||||
var deferred = $q.defer();
|
||||
apiService.identity.token({
|
||||
grant_type: 'refresh_token',
|
||||
client_id: 'web',
|
||||
refresh_token: refreshToken
|
||||
}, function (response) {
|
||||
tokenService.setToken(response.access_token);
|
||||
tokenService.setRefreshToken(response.refresh_token);
|
||||
refreshPromise = p.then(function (newToken) {
|
||||
refreshPromise = null;
|
||||
deferred.resolve(response.access_token);
|
||||
return newToken || token;
|
||||
});
|
||||
refreshPromise = deferred.promise;
|
||||
return refreshPromise;
|
||||
};
|
||||
|
||||
// @if !selfHosted
|
||||
stripeProvider.setPublishableKey(appSettings.stripeKey);
|
||||
// @endif
|
||||
|
||||
angular.extend(toastrConfig, {
|
||||
closeButton: true,
|
||||
progressBar: true,
|
||||
@@ -52,22 +65,24 @@ angular
|
||||
$uibTooltipProvider.options({
|
||||
popupDelay: 600,
|
||||
appendToBody: true
|
||||
|
||||
});
|
||||
|
||||
if ($httpProvider.defaults.headers.post) {
|
||||
$httpProvider.defaults.headers.post = {};
|
||||
// stop IE from caching get requests
|
||||
if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
|
||||
if (!$httpProvider.defaults.headers.get) {
|
||||
$httpProvider.defaults.headers.get = {};
|
||||
}
|
||||
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
|
||||
$httpProvider.defaults.headers.get.Pragma = 'no-cache';
|
||||
}
|
||||
|
||||
$httpProvider.defaults.headers.post['Content-Type'] = 'text/plain; charset=utf-8';
|
||||
|
||||
$httpProvider.interceptors.push('apiInterceptor');
|
||||
$httpProvider.interceptors.push('jwtInterceptor');
|
||||
|
||||
$urlRouterProvider.otherwise('/');
|
||||
|
||||
$stateProvider
|
||||
// Backend
|
||||
// Backend
|
||||
.state('backend', {
|
||||
templateUrl: 'app/views/backendLayout.html',
|
||||
abstract: true,
|
||||
@@ -75,26 +90,130 @@ angular
|
||||
authorize: true
|
||||
}
|
||||
})
|
||||
.state('backend.vault', {
|
||||
url: '^/',
|
||||
.state('backend.user', {
|
||||
templateUrl: 'app/views/userLayout.html',
|
||||
abstract: true
|
||||
})
|
||||
.state('backend.user.vault', {
|
||||
url: '^/vault',
|
||||
templateUrl: 'app/vault/views/vault.html',
|
||||
controller: 'vaultController',
|
||||
data: { pageTitle: 'My Vault' }
|
||||
data: {
|
||||
pageTitle: 'My Vault',
|
||||
controlSidebar: true
|
||||
},
|
||||
params: {
|
||||
refreshFromServer: false
|
||||
}
|
||||
})
|
||||
.state('backend.settings', {
|
||||
.state('backend.user.settings', {
|
||||
url: '^/settings',
|
||||
templateUrl: 'app/settings/views/settings.html',
|
||||
controller: 'settingsController',
|
||||
data: { pageTitle: 'Settings' }
|
||||
})
|
||||
.state('backend.tools', {
|
||||
.state('backend.user.settingsDomains', {
|
||||
url: '^/settings/domains',
|
||||
templateUrl: 'app/settings/views/settingsDomains.html',
|
||||
controller: 'settingsDomainsController',
|
||||
data: { pageTitle: 'Domain Settings' }
|
||||
})
|
||||
.state('backend.user.settingsTwoStep', {
|
||||
url: '^/settings/two-step',
|
||||
templateUrl: 'app/settings/views/settingsTwoStep.html',
|
||||
controller: 'settingsTwoStepController',
|
||||
data: { pageTitle: 'Two-step Login' }
|
||||
})
|
||||
.state('backend.user.settingsCreateOrg', {
|
||||
url: '^/settings/create-organization',
|
||||
templateUrl: 'app/settings/views/settingsCreateOrganization.html',
|
||||
controller: 'settingsCreateOrganizationController',
|
||||
data: { pageTitle: 'Create Organization' }
|
||||
})
|
||||
.state('backend.user.settingsBilling', {
|
||||
url: '^/settings/billing',
|
||||
templateUrl: 'app/settings/views/settingsBilling.html',
|
||||
controller: 'settingsBillingController',
|
||||
data: { pageTitle: 'Billing' }
|
||||
})
|
||||
.state('backend.user.settingsPremium', {
|
||||
url: '^/settings/premium',
|
||||
templateUrl: 'app/settings/views/settingsPremium.html',
|
||||
controller: 'settingsPremiumController',
|
||||
data: { pageTitle: 'Go Premium' }
|
||||
})
|
||||
.state('backend.user.tools', {
|
||||
url: '^/tools',
|
||||
templateUrl: 'app/tools/views/tools.html',
|
||||
controller: 'toolsController',
|
||||
data: { pageTitle: 'Tools' }
|
||||
})
|
||||
.state('backend.user.reportsBreach', {
|
||||
url: '^/reports/breach',
|
||||
templateUrl: 'app/reports/views/reportsBreach.html',
|
||||
controller: 'reportsBreachController',
|
||||
data: { pageTitle: 'Data Breach Report' }
|
||||
})
|
||||
.state('backend.user.apps', {
|
||||
url: '^/apps',
|
||||
templateUrl: 'app/views/apps.html',
|
||||
controller: 'appsController',
|
||||
data: { pageTitle: 'Get the Apps' }
|
||||
})
|
||||
.state('backend.org', {
|
||||
templateUrl: 'app/views/organizationLayout.html',
|
||||
abstract: true
|
||||
})
|
||||
.state('backend.org.dashboard', {
|
||||
url: '^/organization/:orgId',
|
||||
templateUrl: 'app/organization/views/organizationDashboard.html',
|
||||
controller: 'organizationDashboardController',
|
||||
data: { pageTitle: 'Organization Dashboard' }
|
||||
})
|
||||
.state('backend.org.people', {
|
||||
url: '/organization/:orgId/people?viewEvents&search',
|
||||
templateUrl: 'app/organization/views/organizationPeople.html',
|
||||
controller: 'organizationPeopleController',
|
||||
data: { pageTitle: 'Organization People' }
|
||||
})
|
||||
.state('backend.org.collections', {
|
||||
url: '/organization/:orgId/collections?search',
|
||||
templateUrl: 'app/organization/views/organizationCollections.html',
|
||||
controller: 'organizationCollectionsController',
|
||||
data: { pageTitle: 'Organization Collections' }
|
||||
})
|
||||
.state('backend.org.settings', {
|
||||
url: '/organization/:orgId/settings',
|
||||
templateUrl: 'app/organization/views/organizationSettings.html',
|
||||
controller: 'organizationSettingsController',
|
||||
data: { pageTitle: 'Organization Settings' }
|
||||
})
|
||||
.state('backend.org.billing', {
|
||||
url: '/organization/:orgId/billing',
|
||||
templateUrl: 'app/organization/views/organizationBilling.html',
|
||||
controller: 'organizationBillingController',
|
||||
data: { pageTitle: 'Organization Billing' }
|
||||
})
|
||||
.state('backend.org.vault', {
|
||||
url: '/organization/:orgId/vault?viewEvents&search',
|
||||
templateUrl: 'app/organization/views/organizationVault.html',
|
||||
controller: 'organizationVaultController',
|
||||
data: { pageTitle: 'Organization Vault' }
|
||||
})
|
||||
.state('backend.org.groups', {
|
||||
url: '/organization/:orgId/groups?search',
|
||||
templateUrl: 'app/organization/views/organizationGroups.html',
|
||||
controller: 'organizationGroupsController',
|
||||
data: { pageTitle: 'Organization Groups' }
|
||||
})
|
||||
.state('backend.org.events', {
|
||||
url: '/organization/:orgId/events',
|
||||
templateUrl: 'app/organization/views/organizationEvents.html',
|
||||
controller: 'organizationEventsController',
|
||||
data: { pageTitle: 'Organization Events' }
|
||||
})
|
||||
|
||||
// Frontend
|
||||
// Frontend
|
||||
.state('frontend', {
|
||||
templateUrl: 'app/views/frontendLayout.html',
|
||||
abstract: true,
|
||||
@@ -105,23 +224,28 @@ angular
|
||||
.state('frontend.login', {
|
||||
templateUrl: 'app/accounts/views/accountsLogin.html',
|
||||
controller: 'accountsLoginController',
|
||||
params: {
|
||||
returnState: null,
|
||||
email: null,
|
||||
premium: null,
|
||||
org: null
|
||||
},
|
||||
data: {
|
||||
bodyClass: 'login-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.login.info', {
|
||||
url: '^/login',
|
||||
url: '^/?org&premium&email',
|
||||
templateUrl: 'app/accounts/views/accountsLoginInfo.html',
|
||||
data: {
|
||||
pageTitle: 'Log In'
|
||||
}
|
||||
})
|
||||
.state('frontend.login.twoFactor', {
|
||||
url: '^/login/two-factor',
|
||||
url: '^/two-step?org&premium&email',
|
||||
templateUrl: 'app/accounts/views/accountsLoginTwoFactor.html',
|
||||
data: {
|
||||
pageTitle: 'Log In (Two Factor)',
|
||||
authorizeTwoFactor: true
|
||||
pageTitle: 'Log In (Two-step)'
|
||||
}
|
||||
})
|
||||
.state('frontend.logout', {
|
||||
@@ -149,24 +273,77 @@ angular
|
||||
bodyClass: 'login-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.recover-delete', {
|
||||
url: '^/recover-delete',
|
||||
templateUrl: 'app/accounts/views/accountsRecoverDelete.html',
|
||||
controller: 'accountsRecoverDeleteController',
|
||||
data: {
|
||||
pageTitle: 'Delete Account',
|
||||
bodyClass: 'login-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.verify-recover-delete', {
|
||||
url: '^/verify-recover-delete?userId&token&email',
|
||||
templateUrl: 'app/accounts/views/accountsVerifyRecoverDelete.html',
|
||||
controller: 'accountsVerifyRecoverDeleteController',
|
||||
data: {
|
||||
pageTitle: 'Confirm Delete Account',
|
||||
bodyClass: 'login-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.register', {
|
||||
url: '^/register',
|
||||
url: '^/register?org&premium',
|
||||
templateUrl: 'app/accounts/views/accountsRegister.html',
|
||||
controller: 'accountsRegisterController',
|
||||
params: {
|
||||
returnState: null,
|
||||
email: null,
|
||||
org: null,
|
||||
premium: null
|
||||
},
|
||||
data: {
|
||||
pageTitle: 'Register',
|
||||
bodyClass: 'register-page'
|
||||
}
|
||||
})
|
||||
.state('frontend.organizationAccept', {
|
||||
url: '^/accept-organization?organizationId&organizationUserId&token&email&organizationName',
|
||||
templateUrl: 'app/accounts/views/accountsOrganizationAccept.html',
|
||||
controller: 'accountsOrganizationAcceptController',
|
||||
data: {
|
||||
pageTitle: 'Accept Organization Invite',
|
||||
bodyClass: 'login-page',
|
||||
skipAuthorize: true
|
||||
}
|
||||
})
|
||||
.state('frontend.verifyEmail', {
|
||||
url: '^/verify-email?userId&token',
|
||||
templateUrl: 'app/accounts/views/accountsVerifyEmail.html',
|
||||
controller: 'accountsVerifyEmailController',
|
||||
data: {
|
||||
pageTitle: 'Verifying Email',
|
||||
bodyClass: 'login-page',
|
||||
skipAuthorize: true
|
||||
}
|
||||
});
|
||||
})
|
||||
.run(function ($rootScope, authService, jwtHelper, tokenService, $state) {
|
||||
.run(function ($rootScope, authService, $state) {
|
||||
$rootScope.$on('$stateChangeSuccess', function () {
|
||||
$('html, body').animate({ scrollTop: 0 }, 200);
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
|
||||
if (!toState.data || !toState.data.authorize) {
|
||||
if (authService.isAuthenticated()) {
|
||||
event.preventDefault();
|
||||
$state.go('backend.vault');
|
||||
if (toState.data && toState.data.skipAuthorize) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!authService.isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
$state.go('backend.user.vault');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,6 +351,22 @@ angular
|
||||
event.preventDefault();
|
||||
authService.logOut();
|
||||
$state.go('frontend.login.info');
|
||||
return;
|
||||
}
|
||||
|
||||
// user is guaranteed to be authenticated becuase of previous check
|
||||
if (toState.name.indexOf('backend.org.') > -1 && toParams.orgId) {
|
||||
// clear vault rootScope when visiting org admin section
|
||||
$rootScope.vaultCiphers = $rootScope.vaultGroupings = null;
|
||||
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
var orgs = profile.organizations;
|
||||
if (!orgs || !(toParams.orgId in orgs) || orgs[toParams.orgId].status !== 2 ||
|
||||
orgs[toParams.orgId].type === 2) {
|
||||
event.preventDefault();
|
||||
$state.go('backend.user.vault');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
201
src/app/constants.js
Normal file
201
src/app/constants.js
Normal file
@@ -0,0 +1,201 @@
|
||||
angular.module('bit')
|
||||
.constant('constants', {
|
||||
rememberedEmailCookieName: 'bit.rememberedEmail',
|
||||
encType: {
|
||||
AesCbc256_B64: 0,
|
||||
AesCbc128_HmacSha256_B64: 1,
|
||||
AesCbc256_HmacSha256_B64: 2,
|
||||
Rsa2048_OaepSha256_B64: 3,
|
||||
Rsa2048_OaepSha1_B64: 4,
|
||||
Rsa2048_OaepSha256_HmacSha256_B64: 5,
|
||||
Rsa2048_OaepSha1_HmacSha256_B64: 6
|
||||
},
|
||||
orgUserType: {
|
||||
owner: 0,
|
||||
admin: 1,
|
||||
user: 2
|
||||
},
|
||||
orgUserStatus: {
|
||||
invited: 0,
|
||||
accepted: 1,
|
||||
confirmed: 2
|
||||
},
|
||||
twoFactorProvider: {
|
||||
u2f: 4,
|
||||
yubikey: 3,
|
||||
duo: 2,
|
||||
authenticator: 0,
|
||||
email: 1,
|
||||
remember: 5
|
||||
},
|
||||
cipherType: {
|
||||
login: 1,
|
||||
secureNote: 2,
|
||||
card: 3,
|
||||
identity: 4
|
||||
},
|
||||
fieldType: {
|
||||
text: 0,
|
||||
hidden: 1,
|
||||
boolean: 2
|
||||
},
|
||||
deviceType: {
|
||||
android: 0,
|
||||
ios: 1,
|
||||
chromeExt: 2,
|
||||
firefoxExt: 3,
|
||||
operaExt: 4,
|
||||
edgeExt: 5,
|
||||
windowsDesktop: 6,
|
||||
macOsDesktop: 7,
|
||||
linuxDesktop: 8,
|
||||
chrome: 9,
|
||||
firefox: 10,
|
||||
opera: 11,
|
||||
edge: 12,
|
||||
ie: 13,
|
||||
unknown: 14,
|
||||
uwp: 16,
|
||||
safari: 17,
|
||||
vivaldi: 18,
|
||||
vivaldiExt: 19
|
||||
},
|
||||
eventType: {
|
||||
User_LoggedIn: 1000,
|
||||
User_ChangedPassword: 1001,
|
||||
User_Enabled2fa: 1002,
|
||||
User_Disabled2fa: 1003,
|
||||
User_Recovered2fa: 1004,
|
||||
User_FailedLogIn: 1005,
|
||||
User_FailedLogIn2fa: 1006,
|
||||
|
||||
Cipher_Created: 1100,
|
||||
Cipher_Updated: 1101,
|
||||
Cipher_Deleted: 1102,
|
||||
Cipher_AttachmentCreated: 1103,
|
||||
Cipher_AttachmentDeleted: 1104,
|
||||
Cipher_Shared: 1105,
|
||||
Cipher_UpdatedCollections: 1106,
|
||||
|
||||
Collection_Created: 1300,
|
||||
Collection_Updated: 1301,
|
||||
Collection_Deleted: 1302,
|
||||
|
||||
Group_Created: 1400,
|
||||
Group_Updated: 1401,
|
||||
Group_Deleted: 1402,
|
||||
|
||||
OrganizationUser_Invited: 1500,
|
||||
OrganizationUser_Confirmed: 1501,
|
||||
OrganizationUser_Updated: 1502,
|
||||
OrganizationUser_Removed: 1503,
|
||||
OrganizationUser_UpdatedGroups: 1504,
|
||||
|
||||
Organization_Updated: 1600
|
||||
},
|
||||
twoFactorProviderInfo: [
|
||||
{
|
||||
type: 0,
|
||||
name: 'Authenticator App',
|
||||
description: 'Use an authenticator app (such as Authy or Google Authenticator) to generate time-based ' +
|
||||
'verification codes.',
|
||||
enabled: false,
|
||||
active: true,
|
||||
free: true,
|
||||
image: 'authapp.png',
|
||||
displayOrder: 0,
|
||||
priority: 1,
|
||||
requiresUsb: false
|
||||
},
|
||||
{
|
||||
type: 3,
|
||||
name: 'YubiKey OTP Security Key',
|
||||
description: 'Use a YubiKey to access your account. Works with YubiKey 4, 4 Nano, 4C, and NEO devices.',
|
||||
enabled: false,
|
||||
active: true,
|
||||
image: 'yubico.png',
|
||||
displayOrder: 1,
|
||||
priority: 3,
|
||||
requiresUsb: true
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
name: 'Duo',
|
||||
description: 'Verify with Duo Security using the Duo Mobile app, SMS, phone call, or U2F security key.',
|
||||
enabled: false,
|
||||
active: true,
|
||||
image: 'duo.png',
|
||||
displayOrder: 2,
|
||||
priority: 2,
|
||||
requiresUsb: false
|
||||
},
|
||||
{
|
||||
type: 4,
|
||||
name: 'FIDO U2F Security Key',
|
||||
description: 'Use any FIDO U2F enabled security key to access your account.',
|
||||
enabled: false,
|
||||
active: true,
|
||||
image: 'fido.png',
|
||||
displayOrder: 3,
|
||||
priority: 4,
|
||||
requiresUsb: true
|
||||
},
|
||||
{
|
||||
type: 1,
|
||||
name: 'Email',
|
||||
description: 'Verification codes will be emailed to you.',
|
||||
enabled: false,
|
||||
active: true,
|
||||
free: true,
|
||||
image: 'gmail.png',
|
||||
displayOrder: 4,
|
||||
priority: 0,
|
||||
requiresUsb: false
|
||||
}
|
||||
],
|
||||
plans: {
|
||||
free: {
|
||||
basePrice: 0,
|
||||
noAdditionalSeats: true,
|
||||
noPayment: true,
|
||||
upgradeSortOrder: -1
|
||||
},
|
||||
families: {
|
||||
basePrice: 1,
|
||||
annualBasePrice: 12,
|
||||
baseSeats: 5,
|
||||
noAdditionalSeats: true,
|
||||
annualPlanType: 'familiesAnnually',
|
||||
upgradeSortOrder: 1
|
||||
},
|
||||
teams: {
|
||||
basePrice: 5,
|
||||
annualBasePrice: 60,
|
||||
monthlyBasePrice: 8,
|
||||
baseSeats: 5,
|
||||
seatPrice: 2,
|
||||
annualSeatPrice: 24,
|
||||
monthlySeatPrice: 2.5,
|
||||
monthPlanType: 'teamsMonthly',
|
||||
annualPlanType: 'teamsAnnually',
|
||||
upgradeSortOrder: 2
|
||||
},
|
||||
enterprise: {
|
||||
seatPrice: 3,
|
||||
annualSeatPrice: 36,
|
||||
monthlySeatPrice: 4,
|
||||
monthPlanType: 'enterpriseMonthly',
|
||||
annualPlanType: 'enterpriseAnnually',
|
||||
upgradeSortOrder: 3
|
||||
}
|
||||
},
|
||||
storageGb: {
|
||||
price: 0.33,
|
||||
monthlyPrice: 0.50,
|
||||
yearlyPrice: 4
|
||||
},
|
||||
premium: {
|
||||
price: 10,
|
||||
yearlyPrice: 10
|
||||
}
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
.directive('apiForm', function ($rootScope, validationService) {
|
||||
.directive('apiForm', function ($rootScope, validationService, $timeout) {
|
||||
return {
|
||||
require: 'form',
|
||||
restrict: 'A',
|
||||
@@ -25,11 +25,21 @@ angular
|
||||
form.$loading = true;
|
||||
|
||||
promise.then(function success(response) {
|
||||
form.$loading = false;
|
||||
$timeout(function () {
|
||||
form.$loading = false;
|
||||
});
|
||||
}, function failure(reason) {
|
||||
form.$loading = false;
|
||||
validationService.addErrors(form, reason);
|
||||
scope.$broadcast('show-errors-check-validity');
|
||||
$timeout(function () {
|
||||
form.$loading = false;
|
||||
if (typeof reason === 'string') {
|
||||
validationService.addError(form, null, reason, true);
|
||||
}
|
||||
else {
|
||||
validationService.addErrors(form, reason);
|
||||
}
|
||||
scope.$broadcast('show-errors-check-validity');
|
||||
$('html, body').animate({ scrollTop: 0 }, 200);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
11
src/app/directives/fallbackSrcDirective.js
Normal file
11
src/app/directives/fallbackSrcDirective.js
Normal file
@@ -0,0 +1,11 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
.directive('fallbackSrc', function () {
|
||||
return function (scope, element, attrs) {
|
||||
var el = $(element);
|
||||
el.bind('error', function (event) {
|
||||
el.attr('src', attrs.fallbackSrc);
|
||||
});
|
||||
};
|
||||
});
|
||||
151
src/app/directives/letterAvatarDirective.js
Normal file
151
src/app/directives/letterAvatarDirective.js
Normal file
@@ -0,0 +1,151 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
// adaptation of https://github.com/uttesh/ngletteravatar
|
||||
.directive('letterAvatar', function () {
|
||||
// ref: http://stackoverflow.com/a/16348977/1090359
|
||||
function stringToColor(str) {
|
||||
var hash = 0,
|
||||
i = 0;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||
}
|
||||
|
||||
var color = '#';
|
||||
for (i = 0; i < 3; i++) {
|
||||
var value = (hash >> (i * 8)) & 0xFF;
|
||||
color += ('00' + value.toString(16)).substr(-2);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
function getFirstLetters(data, count) {
|
||||
var parts = data.split(' ');
|
||||
if (parts && parts.length > 1) {
|
||||
var text = '';
|
||||
for (var i = 0; i < count; i++) {
|
||||
text += parts[i].substr(0, 1);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getSvg(width, height, color) {
|
||||
var svgTag = angular.element('<svg></svg>')
|
||||
.attr({
|
||||
'xmlns': 'http://www.w3.org/2000/svg',
|
||||
'pointer-events': 'none',
|
||||
'width': width,
|
||||
'height': height
|
||||
})
|
||||
.css({
|
||||
'background-color': color,
|
||||
'width': width + 'px',
|
||||
'height': height + 'px'
|
||||
});
|
||||
|
||||
return svgTag;
|
||||
}
|
||||
|
||||
function getCharText(character, textColor, fontFamily, fontWeight, fontsize) {
|
||||
var textTag = angular.element('<text text-anchor="middle"></text>')
|
||||
.attr({
|
||||
'y': '50%',
|
||||
'x': '50%',
|
||||
'dy': '0.35em',
|
||||
'pointer-events': 'auto',
|
||||
'fill': textColor,
|
||||
'font-family': fontFamily
|
||||
})
|
||||
.text(character)
|
||||
.css({
|
||||
'font-weight': fontWeight,
|
||||
'font-size': fontsize + 'px',
|
||||
});
|
||||
|
||||
return textTag;
|
||||
}
|
||||
|
||||
return {
|
||||
restrict: 'AE',
|
||||
replace: true,
|
||||
scope: {
|
||||
data: '@'
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
var params = {
|
||||
charCount: attrs.charcount || 2,
|
||||
data: attrs.data,
|
||||
textColor: attrs.textcolor || '#ffffff',
|
||||
bgColor: attrs.bgcolor,
|
||||
height: attrs.avheight || 45,
|
||||
width: attrs.avwidth || 45,
|
||||
fontSize: attrs.fontsize || 20,
|
||||
fontWeight: attrs.fontweight || 300,
|
||||
fontFamily: attrs.fontfamily || 'Open Sans, HelveticaNeue-Light, Helvetica Neue Light, ' +
|
||||
'Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif',
|
||||
round: attrs.round || 'true',
|
||||
dynamic: attrs.dynamic || 'true',
|
||||
class: attrs.avclass || '',
|
||||
border: attrs.avborder || 'false',
|
||||
borderStyle: attrs.borderstyle || '3px solid white'
|
||||
};
|
||||
|
||||
if (params.dynamic === 'true') {
|
||||
scope.$watch('data', function () {
|
||||
generateLetterAvatar();
|
||||
});
|
||||
}
|
||||
else {
|
||||
generateLetterAvatar();
|
||||
}
|
||||
|
||||
function generateLetterAvatar() {
|
||||
var c = null,
|
||||
upperData = scope.data.toUpperCase();
|
||||
|
||||
if (params.charCount > 1) {
|
||||
c = getFirstLetters(upperData, params.charCount);
|
||||
}
|
||||
|
||||
if (!c) {
|
||||
c = upperData.substr(0, params.charCount);
|
||||
}
|
||||
|
||||
var cobj = getCharText(c, params.textColor, params.fontFamily, params.fontWeight, params.fontSize);
|
||||
var color = params.bgColor ? params.bgColor : stringToColor(upperData);
|
||||
var svg = getSvg(params.width, params.height, color);
|
||||
svg.append(cobj);
|
||||
var lvcomponent = angular.element('<div>').append(svg).html();
|
||||
|
||||
var svgHtml = window.btoa(unescape(encodeURIComponent(lvcomponent)));
|
||||
var src = 'data:image/svg+xml;base64,' + svgHtml;
|
||||
|
||||
var img = angular.element('<img>').attr({ src: src, title: scope.data });
|
||||
|
||||
if (params.round === 'true') {
|
||||
img.css('border-radius', '50%');
|
||||
}
|
||||
|
||||
if (params.border === 'true') {
|
||||
img.css('border', params.borderStyle);
|
||||
}
|
||||
|
||||
if (params.class) {
|
||||
img.addClass(params.class);
|
||||
}
|
||||
|
||||
if (params.dynamic === 'true') {
|
||||
element.empty();
|
||||
element.append(img);
|
||||
}
|
||||
else {
|
||||
element.replaceWith(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -6,34 +6,32 @@ angular
|
||||
require: 'ngModel',
|
||||
restrict: 'A',
|
||||
link: function (scope, elem, attr, ngModel) {
|
||||
var profile = authService.getUserProfile();
|
||||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
// For DOM -> model validation
|
||||
ngModel.$parsers.unshift(function (value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// For DOM -> model validation
|
||||
ngModel.$parsers.unshift(function (value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
return cryptoService.makeKey(value, profile.email).then(function (result) {
|
||||
var valid = result.keyB64 === cryptoService.getKey().keyB64;
|
||||
ngModel.$setValidity('masterPassword', valid);
|
||||
return valid ? value : undefined;
|
||||
});
|
||||
});
|
||||
|
||||
var key = cryptoService.makeKey(value, profile.email, true);
|
||||
var valid = key === cryptoService.getKey(true);
|
||||
ngModel.$setValidity('masterPassword', valid);
|
||||
return valid ? value : undefined;
|
||||
});
|
||||
// For model -> DOM validation
|
||||
ngModel.$formatters.unshift(function (value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// For model -> DOM validation
|
||||
ngModel.$formatters.unshift(function (value) {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var key = cryptoService.makeKey(value, profile.email, true);
|
||||
var valid = key === cryptoService.getKey(true);
|
||||
|
||||
ngModel.$setValidity('masterPassword', valid);
|
||||
return value;
|
||||
return cryptoService.makeKey(value, profile.email).then(function (result) {
|
||||
var valid = result.keyB64 === cryptoService.getKey().keyB64;
|
||||
ngModel.$setValidity('masterPassword', valid);
|
||||
return value;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,9 +6,9 @@ angular
|
||||
link: function (scope, element) {
|
||||
var listener = function (event, toState, toParams, fromState, fromParams) {
|
||||
// Default title
|
||||
var title = 'bitwarden Password Manager';
|
||||
var title = 'bitwarden Web Vault';
|
||||
if (toState.data && toState.data.pageTitle) {
|
||||
title = toState.data.pageTitle + ' - bitwarden Password Manager';
|
||||
title = toState.data.pageTitle + ' - ' + title;
|
||||
}
|
||||
|
||||
$timeout(function () {
|
||||
|
||||
11
src/app/directives/stopClickDirective.js
Normal file
11
src/app/directives/stopClickDirective.js
Normal 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();
|
||||
});
|
||||
};
|
||||
});
|
||||
10
src/app/directives/stopPropDirective.js
Normal file
10
src/app/directives/stopPropDirective.js
Normal file
@@ -0,0 +1,10 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
.directive('stopProp', function () {
|
||||
return function (scope, element, attrs) {
|
||||
$(element).click(function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
};
|
||||
});
|
||||
193
src/app/directives/totpDirective.js
Normal file
193
src/app/directives/totpDirective.js
Normal file
@@ -0,0 +1,193 @@
|
||||
angular
|
||||
.module('bit.directives')
|
||||
|
||||
.directive('totp', function ($timeout, $q) {
|
||||
return {
|
||||
template: '<div class="totp{{(low ? \' low\' : \'\')}}" ng-if="code">' +
|
||||
'<span class="totp-countdown"><span class="totp-sec">{{sec}}</span>' +
|
||||
'<svg><g><circle class="totp-circle inner" r="12.6" cy="16" cx="16" style="stroke-dashoffset: {{dash}}px;"></circle>' +
|
||||
'<circle class="totp-circle outer" r="14" cy="16" cx="16"></circle></g></svg></span>' +
|
||||
'<span class="totp-code" id="totp-code">{{codeFormatted}}</span>' +
|
||||
'<a href="#" stop-click class="btn btn-link" ngclipboard ngclipboard-error="clipboardError(e)" ' +
|
||||
'data-clipboard-text="{{code}}" uib-tooltip="Copy Code" tooltip-placement="right">' +
|
||||
'<i class="fa fa-clipboard"></i></a>' +
|
||||
'</div>',
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
key: '=totp'
|
||||
},
|
||||
link: function (scope) {
|
||||
var interval = null;
|
||||
|
||||
var Totp = function () {
|
||||
var b32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
var leftpad = function (s, l, p) {
|
||||
if (l + 1 >= s.length) {
|
||||
s = Array(l + 1 - s.length).join(p) + s;
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
var dec2hex = function (d) {
|
||||
return (d < 15.5 ? '0' : '') + Math.round(d).toString(16);
|
||||
};
|
||||
|
||||
var hex2dec = function (s) {
|
||||
return parseInt(s, 16);
|
||||
};
|
||||
|
||||
var hex2bytes = function (s) {
|
||||
var bytes = new Uint8Array(s.length / 2);
|
||||
for (var i = 0; i < s.length; i += 2) {
|
||||
bytes[i / 2] = parseInt(s.substr(i, 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
};
|
||||
|
||||
var buff2hex = function (buff) {
|
||||
var bytes = new Uint8Array(buff);
|
||||
var hex = [];
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
hex.push((bytes[i] >>> 4).toString(16));
|
||||
hex.push((bytes[i] & 0xF).toString(16));
|
||||
}
|
||||
return hex.join('');
|
||||
};
|
||||
|
||||
var b32tohex = function (s) {
|
||||
s = s.toUpperCase();
|
||||
var cleanedInput = '';
|
||||
var i;
|
||||
for (i = 0; i < s.length; i++) {
|
||||
if (b32Chars.indexOf(s[i]) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cleanedInput += s[i];
|
||||
}
|
||||
s = cleanedInput;
|
||||
|
||||
var bits = '';
|
||||
var hex = '';
|
||||
for (i = 0; i < s.length; i++) {
|
||||
var byteIndex = b32Chars.indexOf(s.charAt(i));
|
||||
if (byteIndex < 0) {
|
||||
continue;
|
||||
}
|
||||
bits += leftpad(byteIndex.toString(2), 5, '0');
|
||||
}
|
||||
for (i = 0; i + 4 <= bits.length; i += 4) {
|
||||
var chunk = bits.substr(i, 4);
|
||||
hex = hex + parseInt(chunk, 2).toString(16);
|
||||
}
|
||||
return hex;
|
||||
};
|
||||
|
||||
var b32tobytes = function (s) {
|
||||
return hex2bytes(b32tohex(s));
|
||||
};
|
||||
|
||||
var sign = function (keyBytes, timeBytes) {
|
||||
return window.crypto.subtle.importKey('raw', keyBytes,
|
||||
{ name: 'HMAC', hash: { name: 'SHA-1' } }, false, ['sign']).then(function (key) {
|
||||
return window.crypto.subtle.sign({ name: 'HMAC', hash: { name: 'SHA-1' } }, key, timeBytes);
|
||||
}).then(function (signature) {
|
||||
return buff2hex(signature);
|
||||
}).catch(function (err) {
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
this.getCode = function (keyb32) {
|
||||
var epoch = Math.round(new Date().getTime() / 1000.0);
|
||||
var timeHex = leftpad(dec2hex(Math.floor(epoch / 30)), 16, '0');
|
||||
var timeBytes = hex2bytes(timeHex);
|
||||
var keyBytes = b32tobytes(keyb32);
|
||||
|
||||
if (!keyBytes.length || !timeBytes.length) {
|
||||
return $q(function (resolve, reject) {
|
||||
resolve(null);
|
||||
});
|
||||
}
|
||||
|
||||
return sign(keyBytes, timeBytes).then(function (hashHex) {
|
||||
if (!hashHex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var offset = hex2dec(hashHex.substring(hashHex.length - 1));
|
||||
var otp = (hex2dec(hashHex.substr(offset * 2, 8)) & hex2dec('7fffffff')) + '';
|
||||
otp = (otp).substr(otp.length - 6, 6);
|
||||
return otp;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var totp = new Totp();
|
||||
|
||||
var updateCode = function (scope) {
|
||||
totp.getCode(scope.key).then(function (code) {
|
||||
$timeout(function () {
|
||||
if (code) {
|
||||
scope.codeFormatted = code.substring(0, 3) + ' ' + code.substring(3);
|
||||
scope.code = code;
|
||||
}
|
||||
else {
|
||||
scope.code = null;
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var tick = function (scope) {
|
||||
$timeout(function () {
|
||||
var epoch = Math.round(new Date().getTime() / 1000.0);
|
||||
var mod = epoch % 30;
|
||||
var sec = 30 - mod;
|
||||
|
||||
scope.sec = sec;
|
||||
scope.dash = (2.62 * mod).toFixed(2);
|
||||
scope.low = sec <= 7;
|
||||
if (mod === 0) {
|
||||
updateCode(scope);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
scope.$watch('key', function () {
|
||||
if (!scope.key) {
|
||||
scope.code = null;
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
updateCode(scope);
|
||||
tick(scope);
|
||||
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
interval = setInterval(function () {
|
||||
tick(scope);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
});
|
||||
|
||||
scope.clipboardError = function (e) {
|
||||
alert('Your web browser does not support easy clipboard copying.');
|
||||
};
|
||||
},
|
||||
};
|
||||
});
|
||||
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', []);
|
||||
6
src/app/global/appsController.js
Normal file
6
src/app/global/appsController.js
Normal file
@@ -0,0 +1,6 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('appsController', function ($scope, $state) {
|
||||
|
||||
});
|
||||
@@ -1,16 +1,24 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('mainController', function ($scope, $state, authService, appSettings, toastr) {
|
||||
.controller('mainController', function ($scope, $state, authService, appSettings, toastr, $window, $document,
|
||||
cryptoService, $uibModal, apiService) {
|
||||
var vm = this;
|
||||
vm.skinClass = appSettings.selfHosted ? 'skin-blue-light' : 'skin-blue';
|
||||
vm.bodyClass = '';
|
||||
vm.userProfile = null;
|
||||
vm.usingControlSidebar = vm.openControlSidebar = false;
|
||||
vm.searchVaultText = null;
|
||||
vm.version = appSettings.version;
|
||||
vm.outdatedBrowser = $window.navigator.userAgent.indexOf('MSIE') !== -1 ||
|
||||
$window.navigator.userAgent.indexOf('SamsungBrowser') !== -1;
|
||||
|
||||
$scope.currentYear = new Date().getFullYear();
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
vm.userProfile = profile;
|
||||
});
|
||||
|
||||
if ($.AdminLTE) {
|
||||
if ($.AdminLTE.layout) {
|
||||
$.AdminLTE.layout.fix();
|
||||
@@ -20,12 +28,14 @@ angular
|
||||
if ($.AdminLTE.pushMenu) {
|
||||
$.AdminLTE.pushMenu.expandOnHover();
|
||||
}
|
||||
|
||||
$document.off('click', '.sidebar li a');
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
||||
vm.usingEncKey = !!cryptoService.getEncKey();
|
||||
vm.searchVaultText = null;
|
||||
vm.userProfile = authService.getUserProfile();
|
||||
|
||||
if (toState.data.bodyClass) {
|
||||
vm.bodyClass = toState.data.bodyClass;
|
||||
@@ -34,53 +44,148 @@ angular
|
||||
else {
|
||||
vm.bodyClass = '';
|
||||
}
|
||||
|
||||
vm.usingControlSidebar = !!toState.data.controlSidebar;
|
||||
vm.openControlSidebar = vm.usingControlSidebar && $document.width() > 768;
|
||||
});
|
||||
|
||||
$scope.searchVault = function () {
|
||||
$state.go('backend.vault');
|
||||
};
|
||||
$scope.$on('setSearchVaultText', function (event, val) {
|
||||
vm.searchVaultText = val;
|
||||
});
|
||||
|
||||
$scope.addLogin = function () {
|
||||
$scope.$broadcast('vaultAddLogin');
|
||||
$scope.addCipher = function () {
|
||||
$scope.$broadcast('vaultAddCipher');
|
||||
};
|
||||
|
||||
$scope.addFolder = function () {
|
||||
$scope.$broadcast('vaultAddFolder');
|
||||
};
|
||||
|
||||
$scope.changeEmail = function () {
|
||||
$scope.$broadcast('settingsChangeEmail');
|
||||
$scope.addOrganizationCipher = function () {
|
||||
$scope.$broadcast('organizationVaultAddCipher');
|
||||
};
|
||||
|
||||
$scope.changePassword = function () {
|
||||
$scope.$broadcast('settingsChangePassword');
|
||||
$scope.addOrganizationCollection = function () {
|
||||
$scope.$broadcast('organizationCollectionsAdd');
|
||||
};
|
||||
|
||||
$scope.sessions = function () {
|
||||
$scope.$broadcast('settingsSessions');
|
||||
$scope.inviteOrganizationUser = function () {
|
||||
$scope.$broadcast('organizationPeopleInvite');
|
||||
};
|
||||
|
||||
$scope.domains = function () {
|
||||
$scope.$broadcast('settingsDomains');
|
||||
$scope.addOrganizationGroup = function () {
|
||||
$scope.$broadcast('organizationGroupsAdd');
|
||||
};
|
||||
|
||||
$scope.delete = function () {
|
||||
$scope.$broadcast('settingsDelete');
|
||||
$scope.updateKey = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/settings/views/settingsUpdateKey.html',
|
||||
controller: 'settingsUpdateKeyController'
|
||||
});
|
||||
};
|
||||
|
||||
$scope.twoFactor = function () {
|
||||
$scope.$broadcast('settingsTwoFactor');
|
||||
$scope.verifyEmail = function () {
|
||||
if ($scope.sendingVerify) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.sendingVerify = true;
|
||||
apiService.accounts.verifyEmail({}, null).$promise.then(function () {
|
||||
toastr.success('Verification email sent.');
|
||||
$scope.sendingVerify = false;
|
||||
$scope.verifyEmailSent = true;
|
||||
}).catch(function () {
|
||||
toastr.success('Verification email failed.');
|
||||
$scope.sendingVerify = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.import = function () {
|
||||
$scope.$broadcast('toolsImport');
|
||||
$scope.updateBrowser = function () {
|
||||
$window.open('https://browser-update.org/update.html', '_blank');
|
||||
};
|
||||
|
||||
$scope.export = function () {
|
||||
$scope.$broadcast('toolsExport');
|
||||
// Append dropdown menu somewhere else
|
||||
var bodyScrollbarWidth,
|
||||
appendedDropdownMenu,
|
||||
appendedDropdownMenuParent;
|
||||
|
||||
var dropdownHelpers = {
|
||||
scrollbarWidth: function () {
|
||||
if (!bodyScrollbarWidth) {
|
||||
var bodyElem = $('body');
|
||||
bodyElem.addClass('bit-position-body-scrollbar-measure');
|
||||
bodyScrollbarWidth = $window.innerWidth - bodyElem[0].clientWidth;
|
||||
bodyScrollbarWidth = isFinite(bodyScrollbarWidth) ? bodyScrollbarWidth : 0;
|
||||
bodyElem.removeClass('bit-position-body-scrollbar-measure');
|
||||
}
|
||||
|
||||
return bodyScrollbarWidth;
|
||||
},
|
||||
scrollbarInfo: function () {
|
||||
return {
|
||||
width: dropdownHelpers.scrollbarWidth(),
|
||||
visible: $document.height() > $($window).height()
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.audits = function () {
|
||||
$scope.$broadcast('toolsAudits');
|
||||
};
|
||||
$(window).on('show.bs.dropdown', function (e) {
|
||||
/*jshint -W120 */
|
||||
var target = appendedDropdownMenuParent = $(e.target);
|
||||
|
||||
var appendTo = target.data('appendTo');
|
||||
if (!appendTo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
appendedDropdownMenu = target.find('.dropdown-menu');
|
||||
var appendToEl = $(appendTo);
|
||||
appendToEl.append(appendedDropdownMenu.detach());
|
||||
|
||||
var offset = target.offset();
|
||||
var css = {
|
||||
display: 'block',
|
||||
top: offset.top + target.outerHeight() - (appendTo !== 'body' ? $(window).scrollTop() : 0)
|
||||
};
|
||||
|
||||
if (appendedDropdownMenu.hasClass('dropdown-menu-right')) {
|
||||
var scrollbarInfo = dropdownHelpers.scrollbarInfo();
|
||||
var scrollbarWidth = 0;
|
||||
if (scrollbarInfo.visible && scrollbarInfo.width) {
|
||||
scrollbarWidth = scrollbarInfo.width;
|
||||
}
|
||||
|
||||
css.right = $window.innerWidth - scrollbarWidth - (offset.left + target.prop('offsetWidth')) + 'px';
|
||||
css.left = 'auto';
|
||||
}
|
||||
else {
|
||||
css.left = offset.left + 'px';
|
||||
css.right = 'auto';
|
||||
}
|
||||
|
||||
appendedDropdownMenu.css(css);
|
||||
});
|
||||
|
||||
$(window).on('hide.bs.dropdown', function (e) {
|
||||
if (!appendedDropdownMenu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$(e.target).append(appendedDropdownMenu.detach());
|
||||
appendedDropdownMenu.hide();
|
||||
appendedDropdownMenu = null;
|
||||
appendedDropdownMenuParent = null;
|
||||
});
|
||||
|
||||
$scope.$on('removeAppendedDropdownMenu', function (event, args) {
|
||||
if (!appendedDropdownMenu && !appendedDropdownMenuParent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
appendedDropdownMenuParent.append(appendedDropdownMenu.detach());
|
||||
appendedDropdownMenu.hide();
|
||||
appendedDropdownMenu = null;
|
||||
appendedDropdownMenuParent = null;
|
||||
});
|
||||
});
|
||||
|
||||
26
src/app/global/paidOrgRequiredController.js
Normal file
26
src/app/global/paidOrgRequiredController.js
Normal file
@@ -0,0 +1,26 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('paidOrgRequiredController', function ($scope, $state, $uibModalInstance, $analytics, $uibModalStack, orgId,
|
||||
constants, authService) {
|
||||
$analytics.eventTrack('paidOrgRequiredController', { category: 'Modal' });
|
||||
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
$scope.admin = profile.organizations[orgId].type !== constants.orgUserType.user;
|
||||
});
|
||||
|
||||
$scope.go = function () {
|
||||
if (!$scope.admin) {
|
||||
return;
|
||||
}
|
||||
|
||||
$analytics.eventTrack('Get Paid Org');
|
||||
$state.go('backend.org.billing', { orgId: orgId }).then(function () {
|
||||
$uibModalStack.dismissAll();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('close');
|
||||
};
|
||||
});
|
||||
17
src/app/global/premiumRequiredController.js
Normal file
17
src/app/global/premiumRequiredController.js
Normal file
@@ -0,0 +1,17 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('premiumRequiredController', function ($scope, $state, $uibModalInstance, $analytics, $uibModalStack) {
|
||||
$analytics.eventTrack('premiumRequiredController', { category: 'Modal' });
|
||||
|
||||
$scope.go = function () {
|
||||
$analytics.eventTrack('Get Premium');
|
||||
$state.go('backend.user.settingsPremium').then(function () {
|
||||
$uibModalStack.dismissAll();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('close');
|
||||
};
|
||||
});
|
||||
@@ -1,6 +1,65 @@
|
||||
angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('sideNavController', function ($scope, $state) {
|
||||
.controller('sideNavController', function ($scope, $state, authService, toastr, $analytics, constants, appSettings) {
|
||||
$scope.$state = $state;
|
||||
$scope.params = $state.params;
|
||||
$scope.orgs = [];
|
||||
$scope.name = '';
|
||||
|
||||
if(appSettings.selfHosted) {
|
||||
$scope.orgIconBgColor = '#ffffff';
|
||||
$scope.orgIconBorder = '3px solid #a0a0a0';
|
||||
$scope.orgIconTextColor = '#333333';
|
||||
}
|
||||
else {
|
||||
$scope.orgIconBgColor = '#2c3b41';
|
||||
$scope.orgIconBorder = '3px solid #1a2226';
|
||||
$scope.orgIconTextColor = '#ffffff';
|
||||
}
|
||||
|
||||
authService.getUserProfile().then(function (userProfile) {
|
||||
$scope.name = userProfile.extended && userProfile.extended.name ?
|
||||
userProfile.extended.name : userProfile.email;
|
||||
|
||||
if (!userProfile.organizations) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($state.includes('backend.org') && ($state.params.orgId in userProfile.organizations)) {
|
||||
$scope.orgProfile = userProfile.organizations[$state.params.orgId];
|
||||
}
|
||||
else {
|
||||
var orgs = [];
|
||||
for (var orgId in userProfile.organizations) {
|
||||
if (userProfile.organizations.hasOwnProperty(orgId) &&
|
||||
(userProfile.organizations[orgId].enabled || userProfile.organizations[orgId].type < 2)) { // 2 = User
|
||||
orgs.push(userProfile.organizations[orgId]);
|
||||
}
|
||||
}
|
||||
$scope.orgs = orgs;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.viewOrganization = function (org) {
|
||||
if (org.type === constants.orgUserType.user) {
|
||||
toastr.error('You cannot manage this organization.');
|
||||
return;
|
||||
}
|
||||
|
||||
$analytics.eventTrack('View Organization From Side Nav');
|
||||
$state.go('backend.org.dashboard', { orgId: org.id });
|
||||
};
|
||||
|
||||
$scope.searchVault = function () {
|
||||
$state.go('backend.user.vault');
|
||||
};
|
||||
|
||||
$scope.searchOrganizationVault = function () {
|
||||
$state.go('backend.org.vault', { orgId: $state.params.orgId });
|
||||
};
|
||||
|
||||
$scope.isOrgOwner = function (org) {
|
||||
return org && org.type === constants.orgUserType.owner;
|
||||
};
|
||||
});
|
||||
|
||||
@@ -2,5 +2,13 @@ angular
|
||||
.module('bit.global')
|
||||
|
||||
.controller('topNavController', function ($scope) {
|
||||
|
||||
$scope.toggleControlSidebar = function () {
|
||||
var bod = $('body');
|
||||
if (!bod.hasClass('control-sidebar-open')) {
|
||||
bod.addClass('control-sidebar-open');
|
||||
}
|
||||
else {
|
||||
bod.removeClass('control-sidebar-open');
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingAdjustSeatsController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, toastr, add) {
|
||||
$analytics.eventTrack('organizationBillingAdjustSeatsController', { category: 'Modal' });
|
||||
$scope.add = add;
|
||||
$scope.seatAdjustment = 0;
|
||||
|
||||
$scope.submit = function () {
|
||||
var request = {
|
||||
seatAdjustment: $scope.seatAdjustment
|
||||
};
|
||||
|
||||
if (!add) {
|
||||
request.seatAdjustment *= -1;
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.organizations.putSeat({ id: $state.params.orgId }, request)
|
||||
.$promise.then(function (response) {
|
||||
if (add) {
|
||||
$analytics.eventTrack('Added Seats');
|
||||
toastr.success('You have added ' + $scope.seatAdjustment + ' seats.');
|
||||
}
|
||||
else {
|
||||
$analytics.eventTrack('Removed Seats');
|
||||
toastr.success('You have removed ' + $scope.seatAdjustment + ' seats.');
|
||||
}
|
||||
|
||||
$uibModalInstance.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingAdjustStorageController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, toastr, add) {
|
||||
$analytics.eventTrack('organizationBillingAdjustStorageController', { category: 'Modal' });
|
||||
$scope.add = add;
|
||||
$scope.storageAdjustment = 0;
|
||||
|
||||
$scope.submit = function () {
|
||||
var request = {
|
||||
storageGbAdjustment: $scope.storageAdjustment
|
||||
};
|
||||
|
||||
if (!add) {
|
||||
request.storageGbAdjustment *= -1;
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.organizations.putStorage({ id: $state.params.orgId }, request)
|
||||
.$promise.then(function (response) {
|
||||
if (add) {
|
||||
$analytics.eventTrack('Added Organization Storage');
|
||||
toastr.success('You have added ' + $scope.storageAdjustment + ' GB.');
|
||||
}
|
||||
else {
|
||||
$analytics.eventTrack('Removed Organization Storage');
|
||||
toastr.success('You have removed ' + $scope.storageAdjustment + ' GB.');
|
||||
}
|
||||
|
||||
$uibModalInstance.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, toastr, existingPaymentMethod
|
||||
// @if !selfHosted
|
||||
/* jshint ignore:start */
|
||||
, stripe
|
||||
/* jshint ignore:end */
|
||||
// @endif
|
||||
) {
|
||||
$analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' });
|
||||
$scope.existingPaymentMethod = existingPaymentMethod;
|
||||
$scope.paymentMethod = 'card';
|
||||
$scope.showPaymentOptions = true;
|
||||
$scope.hidePaypal = true;
|
||||
$scope.card = {};
|
||||
$scope.bank = {};
|
||||
|
||||
$scope.changePaymentMethod = function (val) {
|
||||
$scope.paymentMethod = val;
|
||||
};
|
||||
|
||||
$scope.submit = function () {
|
||||
var stripeReq = null;
|
||||
if ($scope.paymentMethod === 'card') {
|
||||
stripeReq = stripe.card.createToken($scope.card);
|
||||
}
|
||||
else if ($scope.paymentMethod === 'bank') {
|
||||
$scope.bank.currency = 'USD';
|
||||
$scope.bank.country = 'US';
|
||||
stripeReq = stripe.bankAccount.createToken($scope.bank);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.submitPromise = stripeReq.then(function (response) {
|
||||
var request = {
|
||||
paymentToken: response.id
|
||||
};
|
||||
|
||||
return apiService.organizations.putPayment({ id: $state.params.orgId }, request).$promise;
|
||||
}, function (err) {
|
||||
throw err.message;
|
||||
}).then(function (response) {
|
||||
$scope.card = null;
|
||||
if (existingPaymentMethod) {
|
||||
$analytics.eventTrack('Changed Organization Payment Method');
|
||||
toastr.success('You have changed your payment method.');
|
||||
}
|
||||
else {
|
||||
$analytics.eventTrack('Added Organization Payment Method');
|
||||
toastr.success('You have added a payment method.');
|
||||
}
|
||||
|
||||
$uibModalInstance.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingChangePlanController', function ($scope, $state, apiService, $uibModalInstance,
|
||||
toastr, $analytics) {
|
||||
$analytics.eventTrack('organizationBillingChangePlanController', { category: 'Modal' });
|
||||
$scope.submit = function () {
|
||||
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
305
src/app/organization/organizationBillingController.js
Normal file
305
src/app/organization/organizationBillingController.js
Normal file
@@ -0,0 +1,305 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingController', function ($scope, apiService, $state, $uibModal, toastr, $analytics,
|
||||
appSettings, tokenService, $window) {
|
||||
$scope.selfHosted = appSettings.selfHosted;
|
||||
$scope.charges = [];
|
||||
$scope.paymentSource = null;
|
||||
$scope.plan = null;
|
||||
$scope.subscription = null;
|
||||
$scope.loading = true;
|
||||
var license = null;
|
||||
$scope.expiration = null;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
load();
|
||||
});
|
||||
|
||||
$scope.changePayment = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/settings/views/settingsBillingChangePayment.html',
|
||||
controller: 'organizationBillingChangePaymentController',
|
||||
resolve: {
|
||||
existingPaymentMethod: function () {
|
||||
return $scope.paymentSource ? $scope.paymentSource.description : null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.changePlan = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationBillingChangePlan.html',
|
||||
controller: 'organizationBillingChangePlanController',
|
||||
resolve: {
|
||||
plan: function () {
|
||||
return $scope.plan;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.adjustSeats = function (add) {
|
||||
if ($scope.selfHosted || !$scope.canAdjustSeats) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationBillingAdjustSeats.html',
|
||||
controller: 'organizationBillingAdjustSeatsController',
|
||||
resolve: {
|
||||
add: function () {
|
||||
return add;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.adjustStorage = function (add) {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/settings/views/settingsBillingAdjustStorage.html',
|
||||
controller: 'organizationBillingAdjustStorageController',
|
||||
resolve: {
|
||||
add: function () {
|
||||
return add;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.verifyBank = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationBillingVerifyBank.html',
|
||||
controller: 'organizationBillingVerifyBankController'
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm('Are you sure you want to cancel? All users will lose access to the organization ' +
|
||||
'at the end of this billing cycle.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.organizations.putCancel({ id: $state.params.orgId }, {})
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Canceled Plan');
|
||||
toastr.success('Organization subscription has been canceled.');
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reinstate = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm('Are you sure you want to remove the cancellation request and reinstate this organization?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.organizations.putReinstate({ id: $state.params.orgId }, {})
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Reinstated Plan');
|
||||
toastr.success('Organization cancellation request has been removed.');
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateLicense = function () {
|
||||
if (!$scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/settings/views/settingsBillingUpdateLicense.html',
|
||||
controller: 'organizationBillingUpdateLicenseController'
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
load();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.license = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var installationId = prompt("Enter your installation id");
|
||||
if (!installationId || installationId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.organizations.getLicense({
|
||||
id: $state.params.orgId,
|
||||
installationId: installationId
|
||||
}, function (license) {
|
||||
var licenseString = JSON.stringify(license, null, 2);
|
||||
var licenseBlob = new Blob([licenseString]);
|
||||
|
||||
// IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
window.navigator.msSaveBlob(licenseBlob, 'bitwarden_organization_license.json');
|
||||
}
|
||||
else {
|
||||
var a = window.document.createElement('a');
|
||||
a.href = window.URL.createObjectURL(licenseBlob, { type: 'text/plain' });
|
||||
a.download = 'bitwarden_organization_license.json';
|
||||
document.body.appendChild(a);
|
||||
// IE: "Access is denied".
|
||||
// ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
}, function (err) {
|
||||
if (err.status === 400) {
|
||||
toastr.error("Invalid installation id.");
|
||||
}
|
||||
else {
|
||||
toastr.error("Unable to generate license.");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.viewInvoice = function (charge) {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
var url = appSettings.apiUri + '/organizations/' + $state.params.orgId +
|
||||
'/billing-invoice/' + charge.invoiceId + '?access_token=' + tokenService.getToken();
|
||||
$window.open(url);
|
||||
};
|
||||
|
||||
function load() {
|
||||
apiService.organizations.getBilling({ id: $state.params.orgId }, function (org) {
|
||||
$scope.loading = false;
|
||||
$scope.noSubscription = org.PlanType === 0;
|
||||
$scope.canAdjustSeats = org.PlanType > 1;
|
||||
|
||||
var i = 0;
|
||||
$scope.expiration = org.Expiration;
|
||||
license = org.License;
|
||||
|
||||
$scope.plan = {
|
||||
name: org.Plan,
|
||||
type: org.PlanType,
|
||||
seats: org.Seats
|
||||
};
|
||||
|
||||
$scope.storage = null;
|
||||
if ($scope && org.MaxStorageGb) {
|
||||
$scope.storage = {
|
||||
currentGb: org.StorageGb || 0,
|
||||
maxGb: org.MaxStorageGb,
|
||||
currentName: org.StorageName || '0 GB'
|
||||
};
|
||||
|
||||
$scope.storage.percentage = +(100 * ($scope.storage.currentGb / $scope.storage.maxGb)).toFixed(2);
|
||||
}
|
||||
|
||||
$scope.subscription = null;
|
||||
if (org.Subscription) {
|
||||
$scope.subscription = {
|
||||
trialEndDate: org.Subscription.TrialEndDate,
|
||||
cancelledDate: org.Subscription.CancelledDate,
|
||||
status: org.Subscription.Status,
|
||||
cancelled: org.Subscription.Cancelled,
|
||||
markedForCancel: !org.Subscription.Cancelled && org.Subscription.CancelAtEndDate
|
||||
};
|
||||
}
|
||||
|
||||
$scope.nextInvoice = null;
|
||||
if (org.UpcomingInvoice) {
|
||||
$scope.nextInvoice = {
|
||||
date: org.UpcomingInvoice.Date,
|
||||
amount: org.UpcomingInvoice.Amount
|
||||
};
|
||||
}
|
||||
|
||||
if (org.Subscription && org.Subscription.Items) {
|
||||
$scope.subscription.items = [];
|
||||
for (i = 0; i < org.Subscription.Items.length; i++) {
|
||||
$scope.subscription.items.push({
|
||||
amount: org.Subscription.Items[i].Amount,
|
||||
name: org.Subscription.Items[i].Name,
|
||||
interval: org.Subscription.Items[i].Interval,
|
||||
qty: org.Subscription.Items[i].Quantity
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.paymentSource = null;
|
||||
if (org.PaymentSource) {
|
||||
$scope.paymentSource = {
|
||||
type: org.PaymentSource.Type,
|
||||
description: org.PaymentSource.Description,
|
||||
cardBrand: org.PaymentSource.CardBrand,
|
||||
needsVerification: org.PaymentSource.NeedsVerification
|
||||
};
|
||||
}
|
||||
|
||||
var charges = [];
|
||||
for (i = 0; i < org.Charges.length; i++) {
|
||||
charges.push({
|
||||
date: org.Charges[i].CreatedDate,
|
||||
paymentSource: org.Charges[i].PaymentSource ? org.Charges[i].PaymentSource.Description : '-',
|
||||
amount: org.Charges[i].Amount,
|
||||
status: org.Charges[i].Status,
|
||||
failureMessage: org.Charges[i].FailureMessage,
|
||||
refunded: org.Charges[i].Refunded,
|
||||
partiallyRefunded: org.Charges[i].PartiallyRefunded,
|
||||
refundedAmount: org.Charges[i].RefundedAmount,
|
||||
invoiceId: org.Charges[i].InvoiceId
|
||||
});
|
||||
}
|
||||
$scope.charges = charges;
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingUpdateLicenseController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, toastr, validationService) {
|
||||
$analytics.eventTrack('organizationBillingUpdateLicenseController', { category: 'Modal' });
|
||||
|
||||
$scope.submit = function (form) {
|
||||
var fileEl = document.getElementById('file');
|
||||
var files = fileEl.files;
|
||||
if (!files || !files.length) {
|
||||
validationService.addError(form, 'file', 'Select a license file.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
var fd = new FormData();
|
||||
fd.append('license', files[0]);
|
||||
|
||||
$scope.submitPromise = apiService.organizations.putLicense({ id: $state.params.orgId }, fd)
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Updated License');
|
||||
toastr.success('You have updated your license.');
|
||||
$uibModalInstance.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationBillingVerifyBankController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, toastr) {
|
||||
$analytics.eventTrack('organizationBillingVerifyBankController', { category: 'Modal' });
|
||||
|
||||
$scope.submit = function () {
|
||||
var request = {
|
||||
amount1: $scope.amount1,
|
||||
amount2: $scope.amount2
|
||||
};
|
||||
|
||||
$scope.submitPromise = apiService.organizations.postVerifyBank({ id: $state.params.orgId }, request)
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Verified Bank Account');
|
||||
toastr.success('You have successfully verified your bank account.');
|
||||
$uibModalInstance.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
120
src/app/organization/organizationCollectionsAddController.js
Normal file
120
src/app/organization/organizationCollectionsAddController.js
Normal file
@@ -0,0 +1,120 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationCollectionsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics, authService) {
|
||||
$analytics.eventTrack('organizationCollectionsAddController', { category: 'Modal' });
|
||||
var groupsLength = 0;
|
||||
$scope.groups = [];
|
||||
$scope.selectedGroups = {};
|
||||
$scope.loading = true;
|
||||
$scope.useGroups = false;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return authService.getUserProfile();
|
||||
}).then(function (profile) {
|
||||
if (profile.organizations) {
|
||||
var org = profile.organizations[$state.params.orgId];
|
||||
$scope.useGroups = !!org.useGroups;
|
||||
}
|
||||
|
||||
if ($scope.useGroups) {
|
||||
return apiService.groups.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}
|
||||
|
||||
return null;
|
||||
}).then(function (groups) {
|
||||
if (!groups) {
|
||||
$scope.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var groupsArr = [];
|
||||
for (var i = 0; i < groups.Data.length; i++) {
|
||||
groupsArr.push({
|
||||
id: groups.Data[i].Id,
|
||||
name: groups.Data[i].Name,
|
||||
accessAll: groups.Data[i].AccessAll
|
||||
});
|
||||
|
||||
if (!groups.Data[i].AccessAll) {
|
||||
groupsLength++;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.groups = groupsArr;
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.toggleGroupSelectionAll = function ($event) {
|
||||
var groups = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.groups.length; i++) {
|
||||
groups[$scope.groups[i].id] = {
|
||||
id: $scope.groups[i].id,
|
||||
readOnly: ($scope.groups[i].id in $scope.selectedGroups) ?
|
||||
$scope.selectedGroups[$scope.groups[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedGroups = groups;
|
||||
};
|
||||
|
||||
$scope.toggleGroupSelection = function (id) {
|
||||
if (id in $scope.selectedGroups) {
|
||||
delete $scope.selectedGroups[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedGroups[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleGroupReadOnlySelection = function (group) {
|
||||
if (group.id in $scope.selectedGroups) {
|
||||
$scope.selectedGroups[group.id].readOnly = !group.accessAll && !!!$scope.selectedGroups[group.id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.groupSelected = function (group) {
|
||||
return group.id in $scope.selectedGroups || group.accessAll;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedGroups).length >= groupsLength;
|
||||
};
|
||||
|
||||
$scope.submit = function (model) {
|
||||
var collection = cipherService.encryptCollection(model, $state.params.orgId);
|
||||
|
||||
if ($scope.useGroups) {
|
||||
collection.groups = [];
|
||||
|
||||
for (var groupId in $scope.selectedGroups) {
|
||||
if ($scope.selectedGroups.hasOwnProperty(groupId)) {
|
||||
for (var i = 0; i < $scope.groups.length; i++) {
|
||||
if ($scope.groups[i].id === $scope.selectedGroups[groupId].id) {
|
||||
if (!$scope.groups[i].accessAll) {
|
||||
collection.groups.push($scope.selectedGroups[groupId]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.collections.post({ orgId: $state.params.orgId }, collection, function (response) {
|
||||
$analytics.eventTrack('Created Collection');
|
||||
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
|
||||
$uibModalInstance.close(decCollection);
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
107
src/app/organization/organizationCollectionsController.js
Normal file
107
src/app/organization/organizationCollectionsController.js
Normal file
@@ -0,0 +1,107 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationCollectionsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter,
|
||||
toastr, $analytics, $uibModalStack) {
|
||||
$scope.collections = [];
|
||||
$scope.loading = true;
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
loadList();
|
||||
});
|
||||
|
||||
$scope.$on('organizationCollectionsAdd', function (event, args) {
|
||||
$scope.add();
|
||||
});
|
||||
|
||||
$scope.add = function () {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationCollectionsAdd.html',
|
||||
controller: 'organizationCollectionsAddController'
|
||||
});
|
||||
|
||||
modal.result.then(function (collection) {
|
||||
$scope.collections.push(collection);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function (collection) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationCollectionsEdit.html',
|
||||
controller: 'organizationCollectionsEditController',
|
||||
resolve: {
|
||||
id: function () { return collection.id; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function (editedCollection) {
|
||||
var existingCollections = $filter('filter')($scope.collections, { id: editedCollection.id }, true);
|
||||
if (existingCollections && existingCollections.length > 0) {
|
||||
existingCollections[0].name = editedCollection.name;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.users = function (collection) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationCollectionsUsers.html',
|
||||
controller: 'organizationCollectionsUsersController',
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
collection: function () { return collection; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
// nothing to do
|
||||
});
|
||||
};
|
||||
|
||||
$scope.groups = function (collection) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationCollectionsGroups.html',
|
||||
controller: 'organizationCollectionsGroupsController',
|
||||
resolve: {
|
||||
collection: function () { return collection; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
// nothing to do
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function (collection) {
|
||||
if (!confirm('Are you sure you want to delete this collection (' + collection.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.collections.del({ orgId: $state.params.orgId, id: collection.id }, function () {
|
||||
var index = $scope.collections.indexOf(collection);
|
||||
if (index > -1) {
|
||||
$scope.collections.splice(index, 1);
|
||||
}
|
||||
|
||||
$analytics.eventTrack('Deleted Collection');
|
||||
toastr.success(collection.name + ' has been deleted.', 'Collection Deleted');
|
||||
}, function () {
|
||||
toastr.error(collection.name + ' was not able to be deleted.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
function loadList() {
|
||||
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
|
||||
if ($state.params.search) {
|
||||
$uibModalStack.dismissAll();
|
||||
$scope.filterSearch = $state.params.search;
|
||||
$('#filterSearch').focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
139
src/app/organization/organizationCollectionsEditController.js
Normal file
139
src/app/organization/organizationCollectionsEditController.js
Normal file
@@ -0,0 +1,139 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationCollectionsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics, id, authService) {
|
||||
$analytics.eventTrack('organizationCollectionsEditController', { category: 'Modal' });
|
||||
var groupsLength = 0;
|
||||
$scope.collection = {};
|
||||
$scope.groups = [];
|
||||
$scope.selectedGroups = {};
|
||||
$scope.loading = true;
|
||||
$scope.useGroups = false;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return apiService.collections.getDetails({ orgId: $state.params.orgId, id: id }).$promise;
|
||||
}).then(function (collection) {
|
||||
$scope.collection = cipherService.decryptCollection(collection);
|
||||
|
||||
var groups = {};
|
||||
if (collection.Groups) {
|
||||
for (var i = 0; i < collection.Groups.length; i++) {
|
||||
groups[collection.Groups[i].Id] = {
|
||||
id: collection.Groups[i].Id,
|
||||
readOnly: collection.Groups[i].ReadOnly
|
||||
};
|
||||
}
|
||||
}
|
||||
$scope.selectedGroups = groups;
|
||||
|
||||
return authService.getUserProfile();
|
||||
}).then(function (profile) {
|
||||
if (profile.organizations) {
|
||||
var org = profile.organizations[$state.params.orgId];
|
||||
$scope.useGroups = !!org.useGroups;
|
||||
}
|
||||
|
||||
if ($scope.useGroups) {
|
||||
return apiService.groups.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}
|
||||
|
||||
return null;
|
||||
}).then(function (groups) {
|
||||
if (!groups) {
|
||||
$scope.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var groupsArr = [];
|
||||
for (var i = 0; i < groups.Data.length; i++) {
|
||||
groupsArr.push({
|
||||
id: groups.Data[i].Id,
|
||||
name: groups.Data[i].Name,
|
||||
accessAll: groups.Data[i].AccessAll
|
||||
});
|
||||
|
||||
if (!groups.Data[i].AccessAll) {
|
||||
groupsLength++;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.groups = groupsArr;
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.toggleGroupSelectionAll = function ($event) {
|
||||
var groups = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.groups.length; i++) {
|
||||
groups[$scope.groups[i].id] = {
|
||||
id: $scope.groups[i].id,
|
||||
readOnly: ($scope.groups[i].id in $scope.selectedGroups) ?
|
||||
$scope.selectedGroups[$scope.groups[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedGroups = groups;
|
||||
};
|
||||
|
||||
$scope.toggleGroupSelection = function (id) {
|
||||
if (id in $scope.selectedGroups) {
|
||||
delete $scope.selectedGroups[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedGroups[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleGroupReadOnlySelection = function (group) {
|
||||
if (group.id in $scope.selectedGroups) {
|
||||
$scope.selectedGroups[group.id].readOnly = !group.accessAll && !!!$scope.selectedGroups[group.id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.groupSelected = function (group) {
|
||||
return group.id in $scope.selectedGroups || group.accessAll;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedGroups).length >= groupsLength;
|
||||
};
|
||||
|
||||
$scope.submit = function (model) {
|
||||
var collection = cipherService.encryptCollection(model, $state.params.orgId);
|
||||
|
||||
if ($scope.useGroups) {
|
||||
collection.groups = [];
|
||||
|
||||
for (var groupId in $scope.selectedGroups) {
|
||||
if ($scope.selectedGroups.hasOwnProperty(groupId)) {
|
||||
for (var i = 0; i < $scope.groups.length; i++) {
|
||||
if ($scope.groups[i].id === $scope.selectedGroups[groupId].id) {
|
||||
if (!$scope.groups[i].accessAll) {
|
||||
collection.groups.push($scope.selectedGroups[groupId]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.collections.put({
|
||||
orgId: $state.params.orgId,
|
||||
id: id
|
||||
}, collection, function (response) {
|
||||
$analytics.eventTrack('Edited Collection');
|
||||
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
|
||||
$uibModalInstance.close(decCollection);
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationCollectionsUsersController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics, collection, toastr) {
|
||||
$analytics.eventTrack('organizationCollectionsUsersController', { category: 'Modal' });
|
||||
$scope.loading = true;
|
||||
$scope.collection = collection;
|
||||
$scope.users = [];
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
$scope.loading = false;
|
||||
apiService.collections.listUsers(
|
||||
{
|
||||
orgId: $state.params.orgId,
|
||||
id: collection.id
|
||||
},
|
||||
function (userList) {
|
||||
if (userList && userList.Data.length) {
|
||||
var users = [];
|
||||
for (var i = 0; i < userList.Data.length; i++) {
|
||||
users.push({
|
||||
organizationUserId: userList.Data[i].OrganizationUserId,
|
||||
name: userList.Data[i].Name,
|
||||
email: userList.Data[i].Email,
|
||||
type: userList.Data[i].Type,
|
||||
status: userList.Data[i].Status,
|
||||
readOnly: userList.Data[i].ReadOnly,
|
||||
accessAll: userList.Data[i].AccessAll
|
||||
});
|
||||
}
|
||||
$scope.users = users;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.remove = function (user) {
|
||||
if (!confirm('Are you sure you want to remove this user (' + user.email + ') from this ' +
|
||||
'collection (' + collection.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.collections.delUser(
|
||||
{
|
||||
orgId: $state.params.orgId,
|
||||
id: collection.id,
|
||||
orgUserId: user.organizationUserId
|
||||
}, null, function () {
|
||||
toastr.success(user.email + ' has been removed.', 'User Removed');
|
||||
$analytics.eventTrack('Removed User From Collection');
|
||||
var index = $scope.users.indexOf(user);
|
||||
if (index > -1) {
|
||||
$scope.users.splice(index, 1);
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Unable to remove user.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
19
src/app/organization/organizationDashboardController.js
Normal file
19
src/app/organization/organizationDashboardController.js
Normal file
@@ -0,0 +1,19 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationDashboardController', function ($scope, authService, $state, appSettings) {
|
||||
$scope.selfHosted = appSettings.selfHosted;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
authService.getUserProfile().then(function (userProfile) {
|
||||
if (!userProfile.organizations) {
|
||||
return;
|
||||
}
|
||||
$scope.orgProfile = userProfile.organizations[$state.params.orgId];
|
||||
});
|
||||
});
|
||||
|
||||
$scope.goBilling = function () {
|
||||
$state.go('backend.org.billing', { orgId: $state.params.orgId });
|
||||
};
|
||||
});
|
||||
25
src/app/organization/organizationDeleteController.js
Normal file
25
src/app/organization/organizationDeleteController.js
Normal file
@@ -0,0 +1,25 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationDeleteController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
|
||||
authService, toastr, $analytics) {
|
||||
$analytics.eventTrack('organizationDeleteController', { category: 'Modal' });
|
||||
$scope.submit = function () {
|
||||
$scope.submitPromise = cryptoService.hashPassword($scope.masterPassword).then(function (hash) {
|
||||
return apiService.organizations.del({ id: $state.params.orgId }, {
|
||||
masterPasswordHash: hash
|
||||
}).$promise;
|
||||
}).then(function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
authService.removeProfileOrganization($state.params.orgId);
|
||||
$analytics.eventTrack('Deleted Organization');
|
||||
return $state.go('backend.user.vault');
|
||||
}).then(function () {
|
||||
toastr.success('This organization and all associated data has been deleted.', 'Organization Deleted');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
100
src/app/organization/organizationEventsController.js
Normal file
100
src/app/organization/organizationEventsController.js
Normal file
@@ -0,0 +1,100 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationEventsController', function ($scope, $state, apiService, $uibModal, $filter,
|
||||
toastr, $analytics, constants, eventService, $compile, $sce) {
|
||||
$scope.events = [];
|
||||
$scope.orgUsers = [];
|
||||
$scope.loading = true;
|
||||
$scope.continuationToken = null;
|
||||
|
||||
var defaultFilters = eventService.getDefaultDateFilters();
|
||||
$scope.filterStart = defaultFilters.start;
|
||||
$scope.filterEnd = defaultFilters.end;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
load();
|
||||
});
|
||||
|
||||
$scope.refresh = function () {
|
||||
loadEvents(true);
|
||||
};
|
||||
|
||||
$scope.next = function () {
|
||||
loadEvents(false);
|
||||
};
|
||||
|
||||
var i = 0,
|
||||
orgUsersUserIdDict = {},
|
||||
orgUsersIdDict = {};
|
||||
|
||||
function load() {
|
||||
apiService.organizationUsers.list({ orgId: $state.params.orgId }).$promise.then(function (list) {
|
||||
var users = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var user = {
|
||||
id: list.Data[i].Id,
|
||||
userId: list.Data[i].UserId,
|
||||
name: list.Data[i].Name,
|
||||
email: list.Data[i].Email
|
||||
};
|
||||
|
||||
users.push(user);
|
||||
|
||||
var displayName = user.name || user.email;
|
||||
orgUsersUserIdDict[user.userId] = displayName;
|
||||
orgUsersIdDict[user.id] = displayName;
|
||||
}
|
||||
|
||||
$scope.orgUsers = users;
|
||||
|
||||
return loadEvents(true);
|
||||
});
|
||||
}
|
||||
|
||||
function loadEvents(clearExisting) {
|
||||
var filterResult = eventService.formatDateFilters($scope.filterStart, $scope.filterEnd);
|
||||
if (filterResult.error) {
|
||||
alert(filterResult.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (clearExisting) {
|
||||
$scope.continuationToken = null;
|
||||
$scope.events = [];
|
||||
}
|
||||
|
||||
$scope.loading = true;
|
||||
return apiService.events.listOrganization({
|
||||
orgId: $state.params.orgId,
|
||||
start: filterResult.start,
|
||||
end: filterResult.end,
|
||||
continuationToken: $scope.continuationToken
|
||||
}).$promise.then(function (list) {
|
||||
$scope.continuationToken = list.ContinuationToken;
|
||||
|
||||
var events = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var userId = list.Data[i].ActingUserId || list.Data[i].UserId;
|
||||
var eventInfo = eventService.getEventInfo(list.Data[i]);
|
||||
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
|
||||
events.push({
|
||||
message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
|
||||
appIcon: eventInfo.appIcon,
|
||||
appName: eventInfo.appName,
|
||||
userId: userId,
|
||||
userName: userId ? (orgUsersUserIdDict[userId] || '-') : '-',
|
||||
date: list.Data[i].Date,
|
||||
ip: list.Data[i].IpAddress
|
||||
});
|
||||
}
|
||||
if ($scope.events && $scope.events.length > 0) {
|
||||
$scope.events = $scope.events.concat(events);
|
||||
}
|
||||
else {
|
||||
$scope.events = events;
|
||||
}
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
87
src/app/organization/organizationGroupsAddController.js
Normal file
87
src/app/organization/organizationGroupsAddController.js
Normal file
@@ -0,0 +1,87 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationGroupsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics) {
|
||||
$analytics.eventTrack('organizationGroupsAddController', { category: 'Modal' });
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
$scope.loading = true;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return apiService.collections.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}).then(function (collections) {
|
||||
$scope.collections = cipherService.decryptCollections(collections.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = {
|
||||
id: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submit = function (model) {
|
||||
var group = {
|
||||
name: model.name,
|
||||
accessAll: !!model.accessAll,
|
||||
externalId: model.externalId
|
||||
};
|
||||
|
||||
if (!group.accessAll) {
|
||||
group.collections = [];
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
group.collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.groups.post({ orgId: $state.params.orgId }, group, function (response) {
|
||||
$analytics.eventTrack('Created Group');
|
||||
$uibModalInstance.close({
|
||||
id: response.Id,
|
||||
name: response.Name
|
||||
});
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
99
src/app/organization/organizationGroupsController.js
Normal file
99
src/app/organization/organizationGroupsController.js
Normal file
@@ -0,0 +1,99 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationGroupsController', function ($scope, $state, apiService, $uibModal, $filter,
|
||||
toastr, $analytics, $uibModalStack) {
|
||||
$scope.groups = [];
|
||||
$scope.loading = true;
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
loadList();
|
||||
});
|
||||
|
||||
$scope.$on('organizationGroupsAdd', function (event, args) {
|
||||
$scope.add();
|
||||
});
|
||||
|
||||
$scope.add = function () {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationGroupsAdd.html',
|
||||
controller: 'organizationGroupsAddController'
|
||||
});
|
||||
|
||||
modal.result.then(function (group) {
|
||||
$scope.groups.push(group);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function (group) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationGroupsEdit.html',
|
||||
controller: 'organizationGroupsEditController',
|
||||
resolve: {
|
||||
id: function () { return group.id; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function (editedGroup) {
|
||||
var existingGroups = $filter('filter')($scope.groups, { id: editedGroup.id }, true);
|
||||
if (existingGroups && existingGroups.length > 0) {
|
||||
existingGroups[0].name = editedGroup.name;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.users = function (group) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationGroupsUsers.html',
|
||||
controller: 'organizationGroupsUsersController',
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
group: function () { return group; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
// nothing to do
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function (group) {
|
||||
if (!confirm('Are you sure you want to delete this group (' + group.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.groups.del({ orgId: $state.params.orgId, id: group.id }, function () {
|
||||
var index = $scope.groups.indexOf(group);
|
||||
if (index > -1) {
|
||||
$scope.groups.splice(index, 1);
|
||||
}
|
||||
|
||||
$analytics.eventTrack('Deleted Group');
|
||||
toastr.success(group.name + ' has been deleted.', 'Group Deleted');
|
||||
}, function () {
|
||||
toastr.error(group.name + ' was not able to be deleted.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
function loadList() {
|
||||
apiService.groups.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
var groups = [];
|
||||
for (var i = 0; i < list.Data.length; i++) {
|
||||
groups.push({
|
||||
id: list.Data[i].Id,
|
||||
name: list.Data[i].Name
|
||||
});
|
||||
}
|
||||
$scope.groups = groups;
|
||||
$scope.loading = false;
|
||||
|
||||
if ($state.params.search) {
|
||||
$uibModalStack.dismissAll();
|
||||
$scope.filterSearch = $state.params.search;
|
||||
$('#filterSearch').focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
110
src/app/organization/organizationGroupsEditController.js
Normal file
110
src/app/organization/organizationGroupsEditController.js
Normal file
@@ -0,0 +1,110 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationGroupsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics, id) {
|
||||
$analytics.eventTrack('organizationGroupsEditController', { category: 'Modal' });
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
$scope.loading = true;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return apiService.groups.getDetails({ orgId: $state.params.orgId, id: id }).$promise;
|
||||
}).then(function (group) {
|
||||
$scope.group = {
|
||||
id: id,
|
||||
name: group.Name,
|
||||
externalId: group.ExternalId,
|
||||
accessAll: group.AccessAll
|
||||
};
|
||||
|
||||
var collections = {};
|
||||
if (group.Collections) {
|
||||
for (var i = 0; i < group.Collections.length; i++) {
|
||||
collections[group.Collections[i].Id] = {
|
||||
id: group.Collections[i].Id,
|
||||
readOnly: group.Collections[i].ReadOnly
|
||||
};
|
||||
}
|
||||
}
|
||||
$scope.selectedCollections = collections;
|
||||
|
||||
return apiService.collections.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}).then(function (collections) {
|
||||
$scope.collections = cipherService.decryptCollections(collections.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = {
|
||||
id: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submit = function () {
|
||||
var group = {
|
||||
name: $scope.group.name,
|
||||
accessAll: !!$scope.group.accessAll,
|
||||
externalId: $scope.group.externalId
|
||||
};
|
||||
|
||||
if (!group.accessAll) {
|
||||
group.collections = [];
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
group.collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.groups.put({
|
||||
orgId: $state.params.orgId,
|
||||
id: id
|
||||
}, group, function (response) {
|
||||
$analytics.eventTrack('Edited Group');
|
||||
$uibModalInstance.close({
|
||||
id: response.Id,
|
||||
name: response.Name
|
||||
});
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
57
src/app/organization/organizationGroupsUsersController.js
Normal file
57
src/app/organization/organizationGroupsUsersController.js
Normal file
@@ -0,0 +1,57 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationGroupsUsersController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
$analytics, group, toastr) {
|
||||
$analytics.eventTrack('organizationGroupUsersController', { category: 'Modal' });
|
||||
$scope.loading = true;
|
||||
$scope.group = group;
|
||||
$scope.users = [];
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return apiService.groups.listUsers({
|
||||
orgId: $state.params.orgId,
|
||||
id: group.id
|
||||
}).$promise;
|
||||
}).then(function (userList) {
|
||||
var users = [];
|
||||
if (userList && userList.Data.length) {
|
||||
for (var i = 0; i < userList.Data.length; i++) {
|
||||
users.push({
|
||||
organizationUserId: userList.Data[i].OrganizationUserId,
|
||||
name: userList.Data[i].Name,
|
||||
email: userList.Data[i].Email,
|
||||
type: userList.Data[i].Type,
|
||||
status: userList.Data[i].Status,
|
||||
accessAll: userList.Data[i].AccessAll
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.users = users;
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.remove = function (user) {
|
||||
if (!confirm('Are you sure you want to remove this user (' + user.email + ') from this ' +
|
||||
'group (' + group.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.groups.delUser({ orgId: $state.params.orgId, id: group.id, orgUserId: user.organizationUserId }, null,
|
||||
function () {
|
||||
toastr.success(user.email + ' has been removed.', 'User Removed');
|
||||
$analytics.eventTrack('Removed User From Group');
|
||||
var index = $scope.users.indexOf(user);
|
||||
if (index > -1) {
|
||||
$scope.users.splice(index, 1);
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Unable to remove user.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
2
src/app/organization/organizationModule.js
Normal file
2
src/app/organization/organizationModule.js
Normal file
@@ -0,0 +1,2 @@
|
||||
angular
|
||||
.module('bit.organization', ['ui.bootstrap']);
|
||||
162
src/app/organization/organizationPeopleController.js
Normal file
162
src/app/organization/organizationPeopleController.js
Normal file
@@ -0,0 +1,162 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, authService,
|
||||
toastr, $analytics, $filter, $uibModalStack) {
|
||||
$scope.users = [];
|
||||
$scope.useGroups = false;
|
||||
$scope.useEvents = false;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
loadList();
|
||||
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
if (profile.organizations) {
|
||||
var org = profile.organizations[$state.params.orgId];
|
||||
$scope.useGroups = !!org.useGroups;
|
||||
$scope.useEvents = !!org.useEvents;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.reinvite = function (user) {
|
||||
apiService.organizationUsers.reinvite({ orgId: $state.params.orgId, id: user.id }, null, function () {
|
||||
$analytics.eventTrack('Reinvited User');
|
||||
toastr.success(user.email + ' has been invited again.', 'User Invited');
|
||||
}, function () {
|
||||
toastr.error('Unable to invite user.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function (user) {
|
||||
if (!confirm('Are you sure you want to remove this user (' + user.email + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.organizationUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () {
|
||||
$analytics.eventTrack('Deleted User');
|
||||
toastr.success(user.email + ' has been removed.', 'User Removed');
|
||||
var index = $scope.users.indexOf(user);
|
||||
if (index > -1) {
|
||||
$scope.users.splice(index, 1);
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Unable to remove user.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.confirm = function (user) {
|
||||
apiService.users.getPublicKey({ id: user.userId }, function (userKey) {
|
||||
var orgKey = cryptoService.getOrgKey($state.params.orgId);
|
||||
if (!orgKey) {
|
||||
toastr.error('Unable to confirm user.', 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
var key = cryptoService.rsaEncrypt(orgKey.key, userKey.PublicKey);
|
||||
apiService.organizationUsers.confirm({ orgId: $state.params.orgId, id: user.id }, { key: key }, function () {
|
||||
user.status = 2;
|
||||
$analytics.eventTrack('Confirmed User');
|
||||
toastr.success(user.email + ' has been confirmed.', 'User Confirmed');
|
||||
}, function () {
|
||||
toastr.error('Unable to confirm user.', 'Error');
|
||||
});
|
||||
}, function () {
|
||||
toastr.error('Unable to confirm user.', 'Error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('organizationPeopleInvite', function (event, args) {
|
||||
$scope.invite();
|
||||
});
|
||||
|
||||
$scope.invite = function () {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationPeopleInvite.html',
|
||||
controller: 'organizationPeopleInviteController'
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
loadList();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function (orgUser) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationPeopleEdit.html',
|
||||
controller: 'organizationPeopleEditController',
|
||||
resolve: {
|
||||
orgUser: function () { return orgUser; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
loadList();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.groups = function (user) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationPeopleGroups.html',
|
||||
controller: 'organizationPeopleGroupsController',
|
||||
resolve: {
|
||||
orgUser: function () { return user; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function () {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$scope.events = function (user) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationPeopleEvents.html',
|
||||
controller: 'organizationPeopleEventsController',
|
||||
resolve: {
|
||||
orgUser: function () { return user; },
|
||||
orgId: function () { return $state.params.orgId; }
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function loadList() {
|
||||
apiService.organizationUsers.list({ orgId: $state.params.orgId }, function (list) {
|
||||
var users = [];
|
||||
|
||||
for (var i = 0; i < list.Data.length; i++) {
|
||||
var user = {
|
||||
id: list.Data[i].Id,
|
||||
userId: list.Data[i].UserId,
|
||||
name: list.Data[i].Name,
|
||||
email: list.Data[i].Email,
|
||||
status: list.Data[i].Status,
|
||||
type: list.Data[i].Type,
|
||||
accessAll: list.Data[i].AccessAll
|
||||
};
|
||||
|
||||
users.push(user);
|
||||
}
|
||||
|
||||
$scope.users = users;
|
||||
|
||||
if ($state.params.search) {
|
||||
$uibModalStack.dismissAll();
|
||||
$scope.filterSearch = $state.params.search;
|
||||
$('#filterSearch').focus();
|
||||
}
|
||||
|
||||
if ($state.params.viewEvents) {
|
||||
$uibModalStack.dismissAll();
|
||||
var eventUser = $filter('filter')($scope.users, { id: $state.params.viewEvents });
|
||||
if (eventUser && eventUser.length) {
|
||||
$scope.events(eventUser[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
104
src/app/organization/organizationPeopleEditController.js
Normal file
104
src/app/organization/organizationPeopleEditController.js
Normal file
@@ -0,0 +1,104 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
orgUser, $analytics) {
|
||||
$analytics.eventTrack('organizationPeopleEditController', { category: 'Modal' });
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
apiService.organizationUsers.get({ orgId: $state.params.orgId, id: orgUser.id }, function (user) {
|
||||
var collections = {};
|
||||
if (user && user.Collections) {
|
||||
for (var i = 0; i < user.Collections.length; i++) {
|
||||
collections[user.Collections[i].Id] = {
|
||||
id: user.Collections[i].Id,
|
||||
readOnly: user.Collections[i].ReadOnly
|
||||
};
|
||||
}
|
||||
}
|
||||
$scope.email = orgUser.email;
|
||||
$scope.type = user.Type;
|
||||
$scope.accessAll = user.AccessAll;
|
||||
$scope.selectedCollections = collections;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = {
|
||||
id: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submitPromise = null;
|
||||
$scope.submit = function (model) {
|
||||
var collections = [];
|
||||
if (!$scope.accessAll) {
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.organizationUsers.put(
|
||||
{
|
||||
orgId: $state.params.orgId,
|
||||
id: orgUser.id
|
||||
}, {
|
||||
type: $scope.type,
|
||||
collections: collections,
|
||||
accessAll: $scope.accessAll
|
||||
}, function () {
|
||||
$analytics.eventTrack('Edited User');
|
||||
$uibModalInstance.close();
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
75
src/app/organization/organizationPeopleEventsController.js
Normal file
75
src/app/organization/organizationPeopleEventsController.js
Normal file
@@ -0,0 +1,75 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleEventsController', function ($scope, apiService, $uibModalInstance,
|
||||
orgUser, $analytics, eventService, orgId, $compile, $sce) {
|
||||
$analytics.eventTrack('organizationPeopleEventsController', { category: 'Modal' });
|
||||
$scope.email = orgUser.email;
|
||||
$scope.events = [];
|
||||
$scope.loading = true;
|
||||
$scope.continuationToken = null;
|
||||
|
||||
var defaultFilters = eventService.getDefaultDateFilters();
|
||||
$scope.filterStart = defaultFilters.start;
|
||||
$scope.filterEnd = defaultFilters.end;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
loadEvents(true);
|
||||
});
|
||||
|
||||
$scope.refresh = function () {
|
||||
loadEvents(true);
|
||||
};
|
||||
|
||||
$scope.next = function () {
|
||||
loadEvents(false);
|
||||
};
|
||||
|
||||
function loadEvents(clearExisting) {
|
||||
var filterResult = eventService.formatDateFilters($scope.filterStart, $scope.filterEnd);
|
||||
if (filterResult.error) {
|
||||
alert(filterResult.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (clearExisting) {
|
||||
$scope.continuationToken = null;
|
||||
$scope.events = [];
|
||||
}
|
||||
|
||||
$scope.loading = true;
|
||||
return apiService.events.listOrganizationUser({
|
||||
orgId: orgId,
|
||||
id: orgUser.id,
|
||||
start: filterResult.start,
|
||||
end: filterResult.end,
|
||||
continuationToken: $scope.continuationToken
|
||||
}).$promise.then(function (list) {
|
||||
$scope.continuationToken = list.ContinuationToken;
|
||||
|
||||
var events = [];
|
||||
for (var i = 0; i < list.Data.length; i++) {
|
||||
var eventInfo = eventService.getEventInfo(list.Data[i]);
|
||||
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
|
||||
events.push({
|
||||
message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
|
||||
appIcon: eventInfo.appIcon,
|
||||
appName: eventInfo.appName,
|
||||
date: list.Data[i].Date,
|
||||
ip: list.Data[i].IpAddress
|
||||
});
|
||||
}
|
||||
if ($scope.events && $scope.events.length > 0) {
|
||||
$scope.events = $scope.events.concat(events);
|
||||
}
|
||||
else {
|
||||
$scope.events = events;
|
||||
}
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
85
src/app/organization/organizationPeopleGroupsController.js
Normal file
85
src/app/organization/organizationPeopleGroupsController.js
Normal file
@@ -0,0 +1,85 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleGroupsController', function ($scope, $state, $uibModalInstance, apiService,
|
||||
orgUser, $analytics) {
|
||||
$analytics.eventTrack('organizationPeopleGroupsController', { category: 'Modal' });
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.groups = [];
|
||||
$scope.selectedGroups = {};
|
||||
$scope.orgUser = orgUser;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
return apiService.groups.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}).then(function (groupsList) {
|
||||
var groups = [];
|
||||
for (var i = 0; i < groupsList.Data.length; i++) {
|
||||
groups.push({
|
||||
id: groupsList.Data[i].Id,
|
||||
name: groupsList.Data[i].Name
|
||||
});
|
||||
}
|
||||
$scope.groups = groups;
|
||||
|
||||
return apiService.organizationUsers.listGroups({ orgId: $state.params.orgId, id: orgUser.id }).$promise;
|
||||
}).then(function (groupIds) {
|
||||
var selectedGroups = {};
|
||||
if (groupIds) {
|
||||
for (var i = 0; i < groupIds.length; i++) {
|
||||
selectedGroups[groupIds[i]] = true;
|
||||
}
|
||||
}
|
||||
$scope.selectedGroups = selectedGroups;
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.toggleGroupSelectionAll = function ($event) {
|
||||
var groups = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.groups.length; i++) {
|
||||
groups[$scope.groups[i].id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedGroups = groups;
|
||||
};
|
||||
|
||||
$scope.toggleGroupSelection = function (id) {
|
||||
if (id in $scope.selectedGroups) {
|
||||
delete $scope.selectedGroups[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedGroups[id] = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.groupSelected = function (group) {
|
||||
return group.id in $scope.selectedGroups;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedGroups).length === $scope.groups.length;
|
||||
};
|
||||
|
||||
$scope.submitPromise = null;
|
||||
$scope.submit = function (model) {
|
||||
var groups = [];
|
||||
for (var groupId in $scope.selectedGroups) {
|
||||
if ($scope.selectedGroups.hasOwnProperty(groupId)) {
|
||||
groups.push(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.organizationUsers.putGroups({ orgId: $state.params.orgId, id: orgUser.id }, {
|
||||
groupIds: groups,
|
||||
}, function () {
|
||||
$analytics.eventTrack('Edited User Groups');
|
||||
$uibModalInstance.close();
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
91
src/app/organization/organizationPeopleInviteController.js
Normal file
91
src/app/organization/organizationPeopleInviteController.js
Normal file
@@ -0,0 +1,91 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationPeopleInviteController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
||||
$analytics) {
|
||||
$analytics.eventTrack('organizationPeopleInviteController', { category: 'Modal' });
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
$scope.model = {
|
||||
type: 'User'
|
||||
};
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
|
||||
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
|
||||
$scope.loading = false;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = {
|
||||
id: $scope.collections[i].id,
|
||||
readOnly: ($scope.collections[i].id in $scope.selectedCollections) ?
|
||||
$scope.selectedCollections[$scope.collections[i].id].readOnly : false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = {
|
||||
id: id,
|
||||
readOnly: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleCollectionReadOnlySelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
$scope.selectedCollections[id].readOnly = !!!$scope.selectedCollections[id].readOnly;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submitPromise = null;
|
||||
$scope.submit = function (model) {
|
||||
var collections = [];
|
||||
|
||||
if (!model.accessAll) {
|
||||
for (var collectionId in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(collectionId)) {
|
||||
collections.push($scope.selectedCollections[collectionId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var splitEmails = model.emails.trim().split(/\s*,\s*/);
|
||||
|
||||
$scope.submitPromise = apiService.organizationUsers.invite({ orgId: $state.params.orgId }, {
|
||||
emails: splitEmails,
|
||||
type: model.type,
|
||||
collections: collections,
|
||||
accessAll: model.accessAll
|
||||
}, function () {
|
||||
$analytics.eventTrack('Invited User');
|
||||
$uibModalInstance.close();
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
59
src/app/organization/organizationSettingsController.js
Normal file
59
src/app/organization/organizationSettingsController.js
Normal file
@@ -0,0 +1,59 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationSettingsController', function ($scope, $state, apiService, toastr, authService, $uibModal,
|
||||
$analytics, appSettings) {
|
||||
$scope.selfHosted = appSettings.selfHosted;
|
||||
$scope.model = {};
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
apiService.organizations.get({ id: $state.params.orgId }, function (org) {
|
||||
$scope.model = {
|
||||
name: org.Name,
|
||||
billingEmail: org.BillingEmail,
|
||||
businessName: org.BusinessName,
|
||||
businessAddress1: org.BusinessAddress1,
|
||||
businessAddress2: org.BusinessAddress2,
|
||||
businessAddress3: org.BusinessAddress3,
|
||||
businessCountry: org.BusinessCountry,
|
||||
businessTaxNumber: org.BusinessTaxNumber
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
$scope.generalSave = function () {
|
||||
if ($scope.selfHosted) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.generalPromise = apiService.organizations.put({ id: $state.params.orgId }, $scope.model, function (org) {
|
||||
authService.updateProfileOrganization(org).then(function (updatedOrg) {
|
||||
$analytics.eventTrack('Updated Organization Settings');
|
||||
toastr.success('Organization has been updated.', 'Success!');
|
||||
});
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.import = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/tools/views/toolsImport.html',
|
||||
controller: 'organizationSettingsImportController'
|
||||
});
|
||||
};
|
||||
|
||||
$scope.export = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/tools/views/toolsExport.html',
|
||||
controller: 'organizationSettingsExportController'
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationDelete.html',
|
||||
controller: 'organizationDeleteController'
|
||||
});
|
||||
};
|
||||
});
|
||||
147
src/app/organization/organizationSettingsExportController.js
Normal file
147
src/app/organization/organizationSettingsExportController.js
Normal file
@@ -0,0 +1,147 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationSettingsExportController', function ($scope, apiService, $uibModalInstance, cipherService,
|
||||
$q, toastr, $analytics, $state, constants) {
|
||||
$analytics.eventTrack('organizationSettingsExportController', { category: 'Modal' });
|
||||
$scope.export = function (model) {
|
||||
$scope.startedExport = true;
|
||||
var decCiphers = [],
|
||||
decCollections = [];
|
||||
|
||||
var collectionsPromise = apiService.collections.listOrganization({ orgId: $state.params.orgId },
|
||||
function (collections) {
|
||||
decCollections = cipherService.decryptCollections(collections.Data, $state.params.orgId, true);
|
||||
}).$promise;
|
||||
|
||||
var ciphersPromise = apiService.ciphers.listOrganizationDetails({ organizationId: $state.params.orgId },
|
||||
function (ciphers) {
|
||||
decCiphers = cipherService.decryptCiphers(ciphers.Data);
|
||||
}).$promise;
|
||||
|
||||
$q.all([collectionsPromise, ciphersPromise]).then(function () {
|
||||
if (!decCiphers.length) {
|
||||
toastr.error('Nothing to export.', 'Error!');
|
||||
$scope.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var collectionsDict = {};
|
||||
for (var i = 0; i < decCollections.length; i++) {
|
||||
collectionsDict[decCollections[i].id] = decCollections[i];
|
||||
}
|
||||
|
||||
try {
|
||||
var exportCiphers = [];
|
||||
for (i = 0; i < decCiphers.length; i++) {
|
||||
// only export logins and secure notes
|
||||
if (decCiphers[i].type !== constants.cipherType.login &&
|
||||
decCiphers[i].type !== constants.cipherType.secureNote) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var cipher = {
|
||||
collections: [],
|
||||
type: null,
|
||||
name: decCiphers[i].name,
|
||||
notes: decCiphers[i].notes,
|
||||
fields: null,
|
||||
// Login props
|
||||
login_uri: null,
|
||||
login_username: null,
|
||||
login_password: null,
|
||||
login_totp: null
|
||||
};
|
||||
|
||||
var j;
|
||||
if (decCiphers[i].collectionIds) {
|
||||
for (j = 0; j < decCiphers[i].collectionIds.length; j++) {
|
||||
if (collectionsDict.hasOwnProperty(decCiphers[i].collectionIds[j])) {
|
||||
cipher.collections.push(collectionsDict[decCiphers[i].collectionIds[j]].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (decCiphers[i].fields) {
|
||||
for (j = 0; j < decCiphers[i].fields.length; j++) {
|
||||
if (!cipher.fields) {
|
||||
cipher.fields = '';
|
||||
}
|
||||
else {
|
||||
cipher.fields += '\n';
|
||||
}
|
||||
|
||||
cipher.fields += ((decCiphers[i].fields[j].name || '') + ': ' + decCiphers[i].fields[j].value);
|
||||
}
|
||||
}
|
||||
|
||||
switch (decCiphers[i].type) {
|
||||
case constants.cipherType.login:
|
||||
cipher.type = 'login';
|
||||
cipher.login_uri = decCiphers[i].login.uri;
|
||||
cipher.login_username = decCiphers[i].login.username;
|
||||
cipher.login_password = decCiphers[i].login.password;
|
||||
cipher.login_totp = decCiphers[i].login.totp;
|
||||
break;
|
||||
case constants.cipherType.secureNote:
|
||||
cipher.type = 'note';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
exportCiphers.push(cipher);
|
||||
}
|
||||
|
||||
var csvString = Papa.unparse(exportCiphers);
|
||||
var csvBlob = new Blob([csvString]);
|
||||
|
||||
// IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
window.navigator.msSaveBlob(csvBlob, makeFileName());
|
||||
}
|
||||
else {
|
||||
var a = window.document.createElement('a');
|
||||
a.href = window.URL.createObjectURL(csvBlob, { type: 'text/plain' });
|
||||
a.download = makeFileName();
|
||||
document.body.appendChild(a);
|
||||
// IE: "Access is denied".
|
||||
// ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
|
||||
$analytics.eventTrack('Exported Organization Data');
|
||||
toastr.success('Your data has been exported. Check your browser\'s downloads folder.', 'Success!');
|
||||
$scope.close();
|
||||
}
|
||||
catch (err) {
|
||||
toastr.error('Something went wrong. Please try again.', 'Error!');
|
||||
$scope.close();
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Something went wrong. Please try again.', 'Error!');
|
||||
$scope.close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
function makeFileName() {
|
||||
var now = new Date();
|
||||
var dateString =
|
||||
now.getFullYear() + '' + padNumber(now.getMonth() + 1, 2) + '' + padNumber(now.getDate(), 2) +
|
||||
padNumber(now.getHours(), 2) + '' + padNumber(now.getMinutes(), 2) +
|
||||
padNumber(now.getSeconds(), 2);
|
||||
|
||||
return 'bitwarden_org_export_' + dateString + '.csv';
|
||||
}
|
||||
|
||||
function padNumber(number, width, paddingCharacter) {
|
||||
paddingCharacter = paddingCharacter || '0';
|
||||
number = number + '';
|
||||
return number.length >= width ? number : new Array(width - number.length + 1).join(paddingCharacter) + number;
|
||||
}
|
||||
});
|
||||
129
src/app/organization/organizationSettingsImportController.js
Normal file
129
src/app/organization/organizationSettingsImportController.js
Normal file
@@ -0,0 +1,129 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationSettingsImportController', function ($scope, $state, apiService, $uibModalInstance, cipherService,
|
||||
toastr, importService, $analytics, $sce, validationService, cryptoService) {
|
||||
$analytics.eventTrack('organizationSettingsImportController', { category: 'Modal' });
|
||||
$scope.model = { source: '' };
|
||||
$scope.source = {};
|
||||
$scope.splitFeatured = false;
|
||||
|
||||
$scope.options = [
|
||||
{
|
||||
id: 'bitwardencsv',
|
||||
name: 'bitwarden (csv)',
|
||||
featured: true,
|
||||
sort: 1,
|
||||
instructions: $sce.trustAsHtml('Export using the web vault (vault.bitwarden.com). ' +
|
||||
'Log into the web vault and navigate to your organization\'s admin area. Then to go ' +
|
||||
'"Settings" > "Tools" > "Export".')
|
||||
},
|
||||
{
|
||||
id: 'lastpass',
|
||||
name: 'LastPass (csv)',
|
||||
featured: true,
|
||||
sort: 2,
|
||||
instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' +
|
||||
'<a target="_blank" href="https://help.bitwarden.com/article/import-from-lastpass/">' +
|
||||
'https://help.bitwarden.com/article/import-from-lastpass/</a>')
|
||||
}
|
||||
];
|
||||
|
||||
$scope.setSource = function () {
|
||||
for (var i = 0; i < $scope.options.length; i++) {
|
||||
if ($scope.options[i].id === $scope.model.source) {
|
||||
$scope.source = $scope.options[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.setSource();
|
||||
|
||||
$scope.import = function (model, form) {
|
||||
if (!model.source || model.source === '') {
|
||||
validationService.addError(form, 'source', 'Select the format of the import file.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
var file = document.getElementById('file').files[0];
|
||||
if (!file && (!model.fileContents || model.fileContents === '')) {
|
||||
validationService.addError(form, 'file', 'Select the import file or copy/paste the import file contents.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.processing = true;
|
||||
importService.importOrg(model.source, file || model.fileContents, importSuccess, importError);
|
||||
};
|
||||
|
||||
function importSuccess(collections, ciphers, collectionRelationships) {
|
||||
if (!collections.length && !ciphers.length) {
|
||||
importError('Nothing was imported.');
|
||||
return;
|
||||
}
|
||||
else if (ciphers.length) {
|
||||
var halfway = Math.floor(ciphers.length / 2);
|
||||
var last = ciphers.length - 1;
|
||||
if (cipherIsBadData(ciphers[0]) && cipherIsBadData(ciphers[halfway]) && cipherIsBadData(ciphers[last])) {
|
||||
importError('Data is not formatted correctly. Please check your import file and try again.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
apiService.ciphers.importOrg({ orgId: $state.params.orgId }, {
|
||||
collections: cipherService.encryptCollections(collections, $state.params.orgId),
|
||||
ciphers: cipherService.encryptCiphers(ciphers, cryptoService.getOrgKey($state.params.orgId)),
|
||||
collectionRelationships: collectionRelationships
|
||||
}, function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
$state.go('backend.org.vault', { orgId: $state.params.orgId }).then(function () {
|
||||
$analytics.eventTrack('Imported Org Data', { label: $scope.model.source });
|
||||
toastr.success('Data has been successfully imported into your vault.', 'Import Success');
|
||||
});
|
||||
}, importError);
|
||||
}
|
||||
|
||||
function cipherIsBadData(cipher) {
|
||||
return (cipher.name === null || cipher.name === '--') &&
|
||||
(cipher.login && (cipher.login.password === null || cipher.login.password === ''));
|
||||
}
|
||||
|
||||
function importError(error) {
|
||||
$analytics.eventTrack('Import Org Data Failed', { label: $scope.model.source });
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
|
||||
if (error) {
|
||||
var data = error.data;
|
||||
if (data && data.ValidationErrors) {
|
||||
var message = '';
|
||||
for (var key in data.ValidationErrors) {
|
||||
if (!data.ValidationErrors.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.ValidationErrors[key].length; i++) {
|
||||
message += (key + ': ' + data.ValidationErrors[key][i] + ' ');
|
||||
}
|
||||
}
|
||||
|
||||
if (message !== '') {
|
||||
toastr.error(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (data && data.Message) {
|
||||
toastr.error(data.Message);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
toastr.error(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
toastr.error('Something went wrong. Try again.', 'Oh No!');
|
||||
}
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
99
src/app/organization/organizationVaultAddCipherController.js
Normal file
99
src/app/organization/organizationVaultAddCipherController.js
Normal file
@@ -0,0 +1,99 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultAddCipherController', function ($scope, apiService, $uibModalInstance, cryptoService,
|
||||
cipherService, passwordService, $analytics, authService, orgId, $uibModal, constants) {
|
||||
$analytics.eventTrack('organizationVaultAddCipherController', { category: 'Modal' });
|
||||
$scope.constants = constants;
|
||||
$scope.selectedType = constants.cipherType.login.toString();
|
||||
$scope.cipher = {
|
||||
type: constants.cipherType.login,
|
||||
login: {},
|
||||
identity: {},
|
||||
card: {},
|
||||
secureNote: {
|
||||
type: '0'
|
||||
}
|
||||
};
|
||||
$scope.hideFolders = $scope.hideFavorite = $scope.fromOrg = true;
|
||||
|
||||
authService.getUserProfile().then(function (userProfile) {
|
||||
var orgProfile = userProfile.organizations[orgId];
|
||||
$scope.useTotp = orgProfile.useTotp;
|
||||
});
|
||||
|
||||
$scope.typeChanged = function () {
|
||||
$scope.cipher.type = parseInt($scope.selectedType);
|
||||
};
|
||||
|
||||
$scope.savePromise = null;
|
||||
$scope.save = function () {
|
||||
$scope.cipher.organizationId = orgId;
|
||||
var cipher = cipherService.encryptCipher($scope.cipher);
|
||||
$scope.savePromise = apiService.ciphers.postAdmin(cipher, function (cipherResponse) {
|
||||
$analytics.eventTrack('Created Organization Cipher');
|
||||
var decCipher = cipherService.decryptCipherPreview(cipherResponse);
|
||||
$uibModalInstance.close(decCipher);
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
if (!$scope.cipher.login.password || confirm('Are you sure you want to overwrite the current password?')) {
|
||||
$analytics.eventTrack('Generated Password From Add');
|
||||
$scope.cipher.login.password = passwordService.generatePassword({ length: 14, special: true });
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addField = function () {
|
||||
if (!$scope.cipher.fields) {
|
||||
$scope.cipher.fields = [];
|
||||
}
|
||||
|
||||
$scope.cipher.fields.push({
|
||||
type: constants.fieldType.text.toString(),
|
||||
name: null,
|
||||
value: null
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeField = function (field) {
|
||||
var index = $scope.cipher.fields.indexOf(field);
|
||||
if (index > -1) {
|
||||
$scope.cipher.fields.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.clipboardSuccess = function (e) {
|
||||
e.clearSelection();
|
||||
selectPassword(e);
|
||||
};
|
||||
|
||||
$scope.clipboardError = function (e, password) {
|
||||
if (password) {
|
||||
selectPassword(e);
|
||||
}
|
||||
alert('Your web browser does not support easy clipboard copying. Copy it manually instead.');
|
||||
};
|
||||
|
||||
function selectPassword(e) {
|
||||
var target = $(e.trigger).parent().prev();
|
||||
if (target.attr('type') === 'text') {
|
||||
target.select();
|
||||
}
|
||||
}
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('close');
|
||||
};
|
||||
|
||||
$scope.showUpgrade = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/paidOrgRequired.html',
|
||||
controller: 'paidOrgRequiredController',
|
||||
resolve: {
|
||||
orgId: function () { return orgId; }
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,90 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService,
|
||||
cipherService, cipherId, $analytics, validationService, toastr, $timeout) {
|
||||
$analytics.eventTrack('organizationVaultAttachmentsController', { category: 'Modal' });
|
||||
$scope.cipher = {};
|
||||
$scope.loading = true;
|
||||
$scope.isPremium = true;
|
||||
$scope.canUseAttachments = true;
|
||||
var closing = false;
|
||||
|
||||
apiService.ciphers.getAdmin({ id: cipherId }, function (cipher) {
|
||||
$scope.cipher = cipherService.decryptCipher(cipher);
|
||||
$scope.loading = false;
|
||||
}, function () {
|
||||
$scope.loading = false;
|
||||
});
|
||||
|
||||
$scope.save = function (form) {
|
||||
var files = document.getElementById('file').files;
|
||||
if (!files || !files.length) {
|
||||
validationService.addError(form, 'file', 'Select a file.', true);
|
||||
return;
|
||||
}
|
||||
|
||||
var key = cryptoService.getOrgKey($scope.cipher.organizationId);
|
||||
$scope.savePromise = cipherService.encryptAttachmentFile(key, files[0]).then(function (encValue) {
|
||||
var fd = new FormData();
|
||||
var blob = new Blob([encValue.data], { type: 'application/octet-stream' });
|
||||
fd.append('data', blob, encValue.fileName);
|
||||
return apiService.ciphers.postAttachment({ id: cipherId }, fd).$promise;
|
||||
}).then(function (response) {
|
||||
$analytics.eventTrack('Added Attachment');
|
||||
toastr.success('The attachment has been added.');
|
||||
closing = true;
|
||||
$uibModalInstance.close(true);
|
||||
}, function (e) {
|
||||
var errors = validationService.parseErrors(e);
|
||||
toastr.error(errors.length ? errors[0] : 'An error occurred.');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.download = function (attachment) {
|
||||
attachment.loading = true;
|
||||
var key = cryptoService.getOrgKey($scope.cipher.organizationId);
|
||||
cipherService.downloadAndDecryptAttachment(key, attachment, true).then(function (res) {
|
||||
$timeout(function () {
|
||||
attachment.loading = false;
|
||||
});
|
||||
}, function () {
|
||||
$timeout(function () {
|
||||
attachment.loading = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.remove = function (attachment) {
|
||||
if (!confirm('Are you sure you want to delete this attachment (' + attachment.fileName + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
attachment.loading = true;
|
||||
apiService.ciphers.delAttachment({ id: cipherId, attachmentId: attachment.id }).$promise.then(function () {
|
||||
attachment.loading = false;
|
||||
$analytics.eventTrack('Deleted Organization Attachment');
|
||||
var index = $scope.cipher.attachments.indexOf(attachment);
|
||||
if (index > -1) {
|
||||
$scope.cipher.attachments.splice(index, 1);
|
||||
}
|
||||
}, function () {
|
||||
toastr.error('Cannot delete attachment.');
|
||||
attachment.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.$on('modal.closing', function (e, reason, closed) {
|
||||
if (closing) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
closing = true;
|
||||
$uibModalInstance.close(!!$scope.cipher.attachments && $scope.cipher.attachments.length > 0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultCipherCollectionsController', function ($scope, apiService, $uibModalInstance, cipherService,
|
||||
cipher, $analytics, collections) {
|
||||
$analytics.eventTrack('organizationVaultCipherCollectionsController', { category: 'Modal' });
|
||||
$scope.cipher = {};
|
||||
$scope.collections = [];
|
||||
$scope.selectedCollections = {};
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
var collectionUsed = [];
|
||||
for (var i = 0; i < collections.length; i++) {
|
||||
if (collections[i].id) {
|
||||
collectionUsed.push(collections[i]);
|
||||
}
|
||||
}
|
||||
$scope.collections = collectionUsed;
|
||||
|
||||
$scope.cipher = cipher;
|
||||
|
||||
var selectedCollections = {};
|
||||
if ($scope.cipher.collectionIds) {
|
||||
for (i = 0; i < $scope.cipher.collectionIds.length; i++) {
|
||||
selectedCollections[$scope.cipher.collectionIds[i]] = true;
|
||||
}
|
||||
}
|
||||
$scope.selectedCollections = selectedCollections;
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
if ($event.target.checked) {
|
||||
for (var i = 0; i < $scope.collections.length; i++) {
|
||||
collections[$scope.collections[i].id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.selectedCollections = collections;
|
||||
};
|
||||
|
||||
$scope.toggleCollectionSelection = function (id) {
|
||||
if (id in $scope.selectedCollections) {
|
||||
delete $scope.selectedCollections[id];
|
||||
}
|
||||
else {
|
||||
$scope.selectedCollections[id] = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.collectionSelected = function (collection) {
|
||||
return collection.id in $scope.selectedCollections;
|
||||
};
|
||||
|
||||
$scope.allSelected = function () {
|
||||
return Object.keys($scope.selectedCollections).length === $scope.collections.length;
|
||||
};
|
||||
|
||||
$scope.submit = function () {
|
||||
var request = {
|
||||
collectionIds: []
|
||||
};
|
||||
|
||||
for (var id in $scope.selectedCollections) {
|
||||
if ($scope.selectedCollections.hasOwnProperty(id)) {
|
||||
request.collectionIds.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.submitPromise = apiService.ciphers.putCollectionsAdmin({ id: cipher.id }, request)
|
||||
.$promise.then(function (response) {
|
||||
$analytics.eventTrack('Edited Cipher Collections');
|
||||
$uibModalInstance.close({
|
||||
action: 'collectionsEdit',
|
||||
collectionIds: request.collectionIds
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
104
src/app/organization/organizationVaultCipherEventsController.js
Normal file
104
src/app/organization/organizationVaultCipherEventsController.js
Normal file
@@ -0,0 +1,104 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultCipherEventsController', function ($scope, apiService, $uibModalInstance,
|
||||
cipher, $analytics, eventService) {
|
||||
$analytics.eventTrack('organizationVaultCipherEventsController', { category: 'Modal' });
|
||||
$scope.cipher = cipher;
|
||||
$scope.events = [];
|
||||
$scope.loading = true;
|
||||
$scope.continuationToken = null;
|
||||
|
||||
var defaultFilters = eventService.getDefaultDateFilters();
|
||||
$scope.filterStart = defaultFilters.start;
|
||||
$scope.filterEnd = defaultFilters.end;
|
||||
|
||||
$uibModalInstance.opened.then(function () {
|
||||
load();
|
||||
});
|
||||
|
||||
$scope.refresh = function () {
|
||||
loadEvents(true);
|
||||
};
|
||||
|
||||
$scope.next = function () {
|
||||
loadEvents(false);
|
||||
};
|
||||
|
||||
var i = 0,
|
||||
orgUsersUserIdDict = {},
|
||||
orgUsersIdDict = {};
|
||||
|
||||
function load() {
|
||||
apiService.organizationUsers.list({ orgId: cipher.organizationId }).$promise.then(function (list) {
|
||||
var users = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var user = {
|
||||
id: list.Data[i].Id,
|
||||
userId: list.Data[i].UserId,
|
||||
name: list.Data[i].Name,
|
||||
email: list.Data[i].Email
|
||||
};
|
||||
|
||||
users.push(user);
|
||||
|
||||
var displayName = user.name || user.email;
|
||||
orgUsersUserIdDict[user.userId] = displayName;
|
||||
orgUsersIdDict[user.id] = displayName;
|
||||
}
|
||||
|
||||
$scope.orgUsers = users;
|
||||
|
||||
return loadEvents(true);
|
||||
});
|
||||
}
|
||||
|
||||
function loadEvents(clearExisting) {
|
||||
var filterResult = eventService.formatDateFilters($scope.filterStart, $scope.filterEnd);
|
||||
if (filterResult.error) {
|
||||
alert(filterResult.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (clearExisting) {
|
||||
$scope.continuationToken = null;
|
||||
$scope.events = [];
|
||||
}
|
||||
|
||||
$scope.loading = true;
|
||||
return apiService.events.listCipher({
|
||||
id: cipher.id,
|
||||
start: filterResult.start,
|
||||
end: filterResult.end,
|
||||
continuationToken: $scope.continuationToken
|
||||
}).$promise.then(function (list) {
|
||||
$scope.continuationToken = list.ContinuationToken;
|
||||
|
||||
var events = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var userId = list.Data[i].ActingUserId || list.Data[i].UserId;
|
||||
var eventInfo = eventService.getEventInfo(list.Data[i], { cipherInfo: false });
|
||||
events.push({
|
||||
message: eventInfo.message,
|
||||
appIcon: eventInfo.appIcon,
|
||||
appName: eventInfo.appName,
|
||||
userId: userId,
|
||||
userName: userId ? (orgUsersUserIdDict[userId] || '-') : '-',
|
||||
date: list.Data[i].Date,
|
||||
ip: list.Data[i].IpAddress
|
||||
});
|
||||
}
|
||||
if ($scope.events && $scope.events.length > 0) {
|
||||
$scope.events = $scope.events.concat(events);
|
||||
}
|
||||
else {
|
||||
$scope.events = events;
|
||||
}
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
243
src/app/organization/organizationVaultController.js
Normal file
243
src/app/organization/organizationVaultController.js
Normal file
@@ -0,0 +1,243 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultController', function ($scope, apiService, cipherService, $analytics, $q, $state,
|
||||
$localStorage, $uibModal, $filter, authService, $uibModalStack) {
|
||||
$scope.ciphers = [];
|
||||
$scope.collections = [];
|
||||
$scope.loading = true;
|
||||
$scope.useEvents = false;
|
||||
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
if (profile.organizations) {
|
||||
var org = profile.organizations[$state.params.orgId];
|
||||
$scope.useEvents = !!org.useEvents;
|
||||
}
|
||||
});
|
||||
|
||||
var collectionPromise = apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (collections) {
|
||||
var decCollections = [{
|
||||
id: null,
|
||||
name: 'Unassigned',
|
||||
collapsed: $localStorage.collapsedOrgCollections && 'unassigned' in $localStorage.collapsedOrgCollections
|
||||
}];
|
||||
|
||||
for (var i = 0; i < collections.Data.length; i++) {
|
||||
var decCollection = cipherService.decryptCollection(collections.Data[i], null, true);
|
||||
decCollection.collapsed = $localStorage.collapsedOrgCollections &&
|
||||
decCollection.id in $localStorage.collapsedOrgCollections;
|
||||
decCollections.push(decCollection);
|
||||
}
|
||||
|
||||
$scope.collections = decCollections;
|
||||
}).$promise;
|
||||
|
||||
var cipherPromise = apiService.ciphers.listOrganizationDetails({ organizationId: $state.params.orgId },
|
||||
function (ciphers) {
|
||||
var decCiphers = [];
|
||||
|
||||
for (var i = 0; i < ciphers.Data.length; i++) {
|
||||
var decCipher = cipherService.decryptCipherPreview(ciphers.Data[i]);
|
||||
decCiphers.push(decCipher);
|
||||
}
|
||||
|
||||
$scope.ciphers = decCiphers;
|
||||
}).$promise;
|
||||
|
||||
$q.all([collectionPromise, cipherPromise]).then(function () {
|
||||
$scope.loading = false;
|
||||
$("#search").focus();
|
||||
|
||||
if ($state.params.search) {
|
||||
$uibModalStack.dismissAll();
|
||||
$scope.$emit('setSearchVaultText', $state.params.search);
|
||||
}
|
||||
|
||||
if ($state.params.viewEvents) {
|
||||
$uibModalStack.dismissAll();
|
||||
var cipher = $filter('filter')($scope.ciphers, { id: $state.params.viewEvents });
|
||||
if (cipher && cipher.length) {
|
||||
$scope.viewEvents(cipher[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.filterByCollection = function (collection) {
|
||||
return function (cipher) {
|
||||
if (!cipher.collectionIds || !cipher.collectionIds.length) {
|
||||
return collection.id === null;
|
||||
}
|
||||
|
||||
return cipher.collectionIds.indexOf(collection.id) > -1;
|
||||
};
|
||||
};
|
||||
|
||||
$scope.collectionSort = function (item) {
|
||||
if (!item.id) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return item.name.toLowerCase();
|
||||
};
|
||||
|
||||
$scope.collapseExpand = function (collection) {
|
||||
if (!$localStorage.collapsedOrgCollections) {
|
||||
$localStorage.collapsedOrgCollections = {};
|
||||
}
|
||||
|
||||
var id = collection.id || 'unassigned';
|
||||
|
||||
if (id in $localStorage.collapsedOrgCollections) {
|
||||
delete $localStorage.collapsedOrgCollections[id];
|
||||
}
|
||||
else {
|
||||
$localStorage.collapsedOrgCollections[id] = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.editCipher = function (cipher) {
|
||||
var editModel = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/vault/views/vaultEditCipher.html',
|
||||
controller: 'organizationVaultEditCipherController',
|
||||
resolve: {
|
||||
cipherId: function () { return cipher.id; },
|
||||
orgId: function () { return $state.params.orgId; }
|
||||
}
|
||||
});
|
||||
|
||||
editModel.result.then(function (returnVal) {
|
||||
var index;
|
||||
if (returnVal.action === 'edit') {
|
||||
index = $scope.ciphers.indexOf(cipher);
|
||||
if (index > -1) {
|
||||
returnVal.data.collectionIds = $scope.ciphers[index].collectionIds;
|
||||
$scope.ciphers[index] = returnVal.data;
|
||||
}
|
||||
}
|
||||
else if (returnVal.action === 'delete') {
|
||||
index = $scope.ciphers.indexOf(cipher);
|
||||
if (index > -1) {
|
||||
$scope.ciphers.splice(index, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('organizationVaultAddCipher', function (event, args) {
|
||||
$scope.addCipher();
|
||||
});
|
||||
|
||||
$scope.addCipher = function () {
|
||||
var addModel = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/vault/views/vaultAddCipher.html',
|
||||
controller: 'organizationVaultAddCipherController',
|
||||
resolve: {
|
||||
orgId: function () { return $state.params.orgId; }
|
||||
}
|
||||
});
|
||||
|
||||
addModel.result.then(function (addedCipher) {
|
||||
$scope.ciphers.push(addedCipher);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.editCollections = function (cipher) {
|
||||
var modal = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationVaultCipherCollections.html',
|
||||
controller: 'organizationVaultCipherCollectionsController',
|
||||
resolve: {
|
||||
cipher: function () { return cipher; },
|
||||
collections: function () { return $scope.collections; }
|
||||
}
|
||||
});
|
||||
|
||||
modal.result.then(function (response) {
|
||||
if (response.collectionIds) {
|
||||
cipher.collectionIds = response.collectionIds;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.viewEvents = function (cipher) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/organization/views/organizationVaultCipherEvents.html',
|
||||
controller: 'organizationVaultCipherEventsController',
|
||||
resolve: {
|
||||
cipher: function () { return cipher; }
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.attachments = function (cipher) {
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
return !!profile.organizations[cipher.organizationId].maxStorageGb;
|
||||
}).then(function (useStorage) {
|
||||
if (!useStorage) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/paidOrgRequired.html',
|
||||
controller: 'paidOrgRequiredController',
|
||||
resolve: {
|
||||
orgId: function () { return cipher.organizationId; }
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var attachmentModel = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/vault/views/vaultAttachments.html',
|
||||
controller: 'organizationVaultAttachmentsController',
|
||||
resolve: {
|
||||
cipherId: function () { return cipher.id; }
|
||||
}
|
||||
});
|
||||
|
||||
attachmentModel.result.then(function (hasAttachments) {
|
||||
cipher.hasAttachments = hasAttachments;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeCipher = function (cipher, collection) {
|
||||
if (!confirm('Are you sure you want to remove this item (' + cipher.name + ') from the ' +
|
||||
'collection (' + collection.name + ') ?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var request = {
|
||||
collectionIds: []
|
||||
};
|
||||
|
||||
for (var i = 0; i < cipher.collectionIds.length; i++) {
|
||||
if (cipher.collectionIds[i] !== collection.id) {
|
||||
request.collectionIds.push(cipher.collectionIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
apiService.ciphers.putCollections({ id: cipher.id }, request).$promise.then(function (response) {
|
||||
$analytics.eventTrack('Removed Cipher From Collection');
|
||||
cipher.collectionIds = request.collectionIds;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteCipher = function (cipher) {
|
||||
if (!confirm('Are you sure you want to delete this item (' + cipher.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.ciphers.delAdmin({ id: cipher.id }, function () {
|
||||
$analytics.eventTrack('Deleted Cipher');
|
||||
var index = $scope.ciphers.indexOf(cipher);
|
||||
if (index > -1) {
|
||||
$scope.ciphers.splice(index, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
101
src/app/organization/organizationVaultEditCipherController.js
Normal file
101
src/app/organization/organizationVaultEditCipherController.js
Normal file
@@ -0,0 +1,101 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationVaultEditCipherController', function ($scope, apiService, $uibModalInstance, cryptoService,
|
||||
cipherService, passwordService, cipherId, $analytics, orgId, $uibModal, constants) {
|
||||
$analytics.eventTrack('organizationVaultEditCipherController', { category: 'Modal' });
|
||||
$scope.cipher = {};
|
||||
$scope.hideFolders = $scope.hideFavorite = $scope.fromOrg = true;
|
||||
$scope.constants = constants;
|
||||
|
||||
apiService.ciphers.getAdmin({ id: cipherId }, function (cipher) {
|
||||
$scope.cipher = cipherService.decryptCipher(cipher);
|
||||
$scope.useTotp = $scope.cipher.organizationUseTotp;
|
||||
});
|
||||
|
||||
$scope.save = function (model) {
|
||||
var cipher = cipherService.encryptCipher(model, $scope.cipher.type);
|
||||
$scope.savePromise = apiService.ciphers.putAdmin({ id: cipherId }, cipher, function (cipherResponse) {
|
||||
$analytics.eventTrack('Edited Organization Cipher');
|
||||
var decCipher = cipherService.decryptCipherPreview(cipherResponse);
|
||||
$uibModalInstance.close({
|
||||
action: 'edit',
|
||||
data: decCipher
|
||||
});
|
||||
}).$promise;
|
||||
};
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
if (!$scope.cipher.login.password || confirm('Are you sure you want to overwrite the current password?')) {
|
||||
$analytics.eventTrack('Generated Password From Edit');
|
||||
$scope.cipher.login.password = passwordService.generatePassword({ length: 14, special: true });
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addField = function () {
|
||||
if (!$scope.cipher.login.fields) {
|
||||
$scope.cipher.login.fields = [];
|
||||
}
|
||||
|
||||
$scope.cipher.fields.push({
|
||||
type: constants.fieldType.text.toString(),
|
||||
name: null,
|
||||
value: null
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeField = function (field) {
|
||||
var index = $scope.cipher.fields.indexOf(field);
|
||||
if (index > -1) {
|
||||
$scope.cipher.fields.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.clipboardSuccess = function (e) {
|
||||
e.clearSelection();
|
||||
selectPassword(e);
|
||||
};
|
||||
|
||||
$scope.clipboardError = function (e, password) {
|
||||
if (password) {
|
||||
selectPassword(e);
|
||||
}
|
||||
alert('Your web browser does not support easy clipboard copying. Copy it manually instead.');
|
||||
};
|
||||
|
||||
function selectPassword(e) {
|
||||
var target = $(e.trigger).parent().prev();
|
||||
if (target.attr('type') === 'text') {
|
||||
target.select();
|
||||
}
|
||||
}
|
||||
|
||||
$scope.delete = function () {
|
||||
if (!confirm('Are you sure you want to delete this item (' + $scope.cipher.name + ')?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.ciphers.delAdmin({ id: $scope.cipher.id }, function () {
|
||||
$analytics.eventTrack('Deleted Organization Cipher From Edit');
|
||||
$uibModalInstance.close({
|
||||
action: 'delete',
|
||||
data: $scope.cipher.id
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.showUpgrade = function () {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/paidOrgRequired.html',
|
||||
controller: 'paidOrgRequiredController',
|
||||
resolve: {
|
||||
orgId: function () { return orgId; }
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
230
src/app/organization/views/organizationBilling.html
Normal file
230
src/app/organization/views/organizationBilling.html
Normal file
@@ -0,0 +1,230 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Billing
|
||||
<small>manage your billing & licensing</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="callout callout-warning" ng-if="subscription && subscription.cancelled">
|
||||
<h4><i class="fa fa-warning"></i> Canceled</h4>
|
||||
The subscription to this organization has been canceled.
|
||||
</div>
|
||||
<div class="callout callout-warning" ng-if="subscription && subscription.markedForCancel">
|
||||
<h4><i class="fa fa-warning"></i> Pending Cancellation</h4>
|
||||
<p>
|
||||
The subscription to this organization has been marked for cancellation at the end of the
|
||||
current billing period.
|
||||
</p>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="reinstate()">
|
||||
Reinstate Plan
|
||||
</button>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Plan</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl ng-if="selfHosted">
|
||||
<dt>Name</dt>
|
||||
<dd>{{plan.name || '-'}}</dd>
|
||||
<dt>Expiration</dt>
|
||||
<dd ng-if="loading">
|
||||
Loading...
|
||||
</dd>
|
||||
<dd ng-if="!loading && expiration">
|
||||
{{expiration | date: 'medium'}}
|
||||
</dd>
|
||||
<dd ng-if="!loading && !expiration">
|
||||
Never expires
|
||||
</dd>
|
||||
</dl>
|
||||
<dl ng-if="!selfHosted">
|
||||
<dt>Name</dt>
|
||||
<dd>{{plan.name || '-'}}</dd>
|
||||
<dt>Total Seats</dt>
|
||||
<dd>{{plan.seats || '-'}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-sm-6" ng-if="!selfHosted">
|
||||
<dl>
|
||||
<dt>Status</dt>
|
||||
<dd>
|
||||
<span style="text-transform: capitalize;">{{(subscription && subscription.status) || '-'}}</span>
|
||||
<span ng-if="subscription.markedForCancel">- marked for cancellation</span>
|
||||
</dd>
|
||||
<dt>Next Charge</dt>
|
||||
<dd>{{nextInvoice ? ((nextInvoice.date | date: 'mediumDate') + ', ' + (nextInvoice.amount | currency:'$')) : '-'}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-if="!selfHosted && !noSubscription">
|
||||
<div class="col-md-6">
|
||||
<strong>Details</strong>
|
||||
<div ng-show="loading">
|
||||
Loading...
|
||||
</div>
|
||||
<div class="table-responsive" style="margin: 0;" ng-show="!loading">
|
||||
<table class="table" style="margin: 0;">
|
||||
<tbody>
|
||||
<tr ng-repeat="item in subscription.items">
|
||||
<td>
|
||||
{{item.name}} {{item.qty > 1 ? '×' + item.qty : ''}}
|
||||
@ {{item.amount | currency:'$'}} /{{item.interval}}
|
||||
</td>
|
||||
<td class="text-right">{{(item.qty * item.amount) | currency:'$'}} /{{item.interval}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer" ng-if="!selfHosted">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="changePlan()">
|
||||
Change Plan
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="cancel()"
|
||||
ng-if="!noSubscription && !subscription.cancelled && !subscription.markedForCancel">
|
||||
Cancel Plan
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="reinstate()"
|
||||
ng-if="!noSubscription && subscription.markedForCancel">
|
||||
Reinstate Plan
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="license()"
|
||||
ng-if="!subscription.cancelled">
|
||||
Download License
|
||||
</button>
|
||||
</div>
|
||||
<div class="box-footer" ng-if="selfHosted">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="updateLicense()">
|
||||
Update License
|
||||
</button>
|
||||
<a href="https://vault.bitwarden.com" class="btn btn-default btn-flat" target="_blank">
|
||||
Manage Billing
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">User Seats</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div ng-show="loading">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!loading">
|
||||
You plan currently has a total of <b>{{plan.seats}}</b> seats.
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer" ng-if="!selfHosted && !noSubscription && canAdjustSeats">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="adjustSeats(true)">
|
||||
Add Seats
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="adjustSeats(false)">
|
||||
Remove Seats
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default" ng-if="storage && !selfHosted">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Storage</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
You plan has a total of {{storage.maxGb}} GB of encrypted file storage.
|
||||
You are currently using {{storage.currentName}}.
|
||||
</p>
|
||||
<div class="progress" style="margin: 0;">
|
||||
<div class="progress-bar progress-bar-info" role="progressbar"
|
||||
aria-valuenow="{{storage.percentage}}" aria-valuemin="0" aria-valuemax="1"
|
||||
style="min-width: 50px; width: {{storage.percentage}}%;">
|
||||
{{storage.percentage}}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="adjustStorage(true)">
|
||||
Add Storage
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="adjustStorage(false)">
|
||||
Remove Storage
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default" ng-if="!selfHosted">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Payment Method</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div ng-show="loading">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!loading && !paymentSource">
|
||||
<i class="fa fa-credit-card"></i> No payment method on file.
|
||||
</div>
|
||||
<div ng-show="!loading && paymentSource">
|
||||
<div class="callout callout-warning" ng-if="paymentSource.type === 1 && paymentSource.needsVerification">
|
||||
<h4><i class="fa fa-warning"></i> You must verify your bank account</h4>
|
||||
<p>
|
||||
We have made two micro-deposits to your bank account (it may take 1-2 business days to show up).
|
||||
Enter these amounts to verify the bank account. Failure to verify the bank account will result in a
|
||||
missed payment and your organization being disabled.
|
||||
</p>
|
||||
<button class="btn btn-default btn-flat" ng-click="verifyBank()">Verify Now</button>
|
||||
</div>
|
||||
<i class="fa" ng-class="{'fa-credit-card': paymentSource.type === 0,
|
||||
'fa-university': paymentSource.type === 1, 'fa-paypal fa-fw text-blue': paymentSource.type === 2}"></i>
|
||||
{{paymentSource.description}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="changePayment()">
|
||||
{{ paymentSource ? 'Change Payment Method' : 'Add Payment Method' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default" ng-if="!selfHosted">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Charges</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div ng-show="loading">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!loading && !charges.length">
|
||||
No charges.
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="charges.length">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr ng-repeat="charge in charges">
|
||||
<td style="width: 30px">
|
||||
<a href="#" stop-click ng-click="viewInvoice(charge)" title="Invoice">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td style="width: 200px">
|
||||
{{charge.date | date: 'mediumDate'}}
|
||||
</td>
|
||||
<td style="min-width: 150px">
|
||||
{{charge.paymentSource}}
|
||||
</td>
|
||||
<td style="width: 150px; text-transform: capitalize;">
|
||||
{{charge.status}}
|
||||
</td>
|
||||
<td class="text-right" style="width: 150px;">
|
||||
{{charge.amount | currency:'$'}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
Note: Any charges will appear on your statement as <b>BITWARDEN</b>.
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,46 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">
|
||||
<i class="fa fa-users"></i>
|
||||
{{add ? 'Add Seats' : 'Remove Seats'}}
|
||||
</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<div class="callout callout-default" ng-show="add">
|
||||
<h4><i class="fa fa-dollar"></i> Note About Charges</h4>
|
||||
<p>
|
||||
Adding seats to your plan will result in adjustments to your billing totals and immediately charge your
|
||||
payment method on file. The first charge will be prorated for the remainder of the current billing cycle.
|
||||
</p>
|
||||
</div>
|
||||
<div class="callout callout-default" ng-show="!add">
|
||||
<h4><i class="fa fa-dollar"></i> Note About Charges</h4>
|
||||
<p>
|
||||
Removing seats will result in adjustments to your billing totals that will be prorated as credits
|
||||
to your next billing charge.
|
||||
</p>
|
||||
</div>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="seats">{{add ? 'Seats To Add' : 'Seats To Remove'}}</label>
|
||||
<input type="number" id="seats" name="SeatAdjustment" ng-model="seatAdjustment" class="form-control"
|
||||
required min="0" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-file-text-o"></i> Change Plan</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
You can <a href="https://bitwarden.com/contact/" target="_blank">contact us</a>
|
||||
if you would like to change your plan. Please ensure that you have an active payment
|
||||
method on file.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,43 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
Verify Bank Account
|
||||
</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Enter the two micro-deposit amounts from your bank account. Both amounts will be less than $1.00 each.
|
||||
For example, if we deposited $0.32 and $0.45 you would enter the values "32" and "45".
|
||||
</p>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amount1">Amount 1</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">$ 0.</span>
|
||||
<input type="number" id="amount1" name="Amount1" ng-model="amount1" class="form-control"
|
||||
required min="1" max="99" placeholder="xx" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amount2">Amount 2</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">$ 0.</span>
|
||||
<input type="number" id="amount2" name="Amount2" ng-model="amount2" class="form-control"
|
||||
required min="1" max="99" placeholder="xx" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
70
src/app/organization/views/organizationCollections.html
Normal file
70
src/app/organization/views/organizationCollections.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Collections
|
||||
<small>control what you share</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
|
||||
<div class="box-filters hidden-xs">
|
||||
<div class="form-group form-group-sm has-feedback has-feedback-left">
|
||||
<input type="text" id="filterSearch" class="form-control" placeholder="Search collections..."
|
||||
style="width: 200px;" ng-model="filterSearch">
|
||||
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-primary btn-sm btn-flat" ng-click="add()">
|
||||
<i class="fa fa-fw fa-plus-circle"></i> New Collection
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body" ng-class="{'no-padding': filteredCollections.length}">
|
||||
<div ng-show="loading && !collections.length">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!filteredCollections.length && filterSearch">
|
||||
No collections to list.
|
||||
</div>
|
||||
<div ng-show="!loading && !collections.length">
|
||||
<p>There are no collections yet for your organization.</p>
|
||||
<button type="button" ng-click="add()" class="btn btn-default btn-flat">Add a Collection</button>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="collections.length">
|
||||
<table class="table table-striped table-hover table-vmiddle">
|
||||
<tbody>
|
||||
<tr ng-repeat="collection in filteredCollections = (collections | filter: (filterSearch || '') |
|
||||
orderBy: ['name']) track by collection.id">
|
||||
<td style="width: 70px;">
|
||||
<div class="btn-group" data-append-to="body">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-cog"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" stop-click ng-click="users(collection)">
|
||||
<i class="fa fa-fw fa-users"></i> Users
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" stop-click ng-click="delete(collection)" class="text-red">
|
||||
<i class="fa fa-fw fa-trash"></i> Delete
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<a href="#" stop-click ng-click="edit(collection)">
|
||||
{{collection.name}}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
83
src/app/organization/views/organizationCollectionsAdd.html
Normal file
83
src/app/organization/views/organizationCollectionsAdd.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-cubes"></i> Add New Collection</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<div class="callout callout-default">
|
||||
<h4><i class="fa fa-info-circle"></i> Note</h4>
|
||||
<p>
|
||||
After creating the collection, you can associate a user to it by selecting a specific user on the "People" page.
|
||||
</p>
|
||||
<p>
|
||||
You can associate new logins to the collection from your organization's "Vault" or by sharing an existing
|
||||
login from "My vault".
|
||||
</p>
|
||||
</div>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="email">Name</label>
|
||||
<input type="text" id="name" name="Name" ng-model="model.name" class="form-control" required api-field />
|
||||
</div>
|
||||
<div ng-if="useGroups">
|
||||
<h4>Group Access</h4>
|
||||
<div ng-show="loading && !groups.length">
|
||||
Loading groups...
|
||||
</div>
|
||||
<div ng-show="!loading && !groups.length">
|
||||
<p>No groups for your organization.</p>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="groups.length" style="margin: 0;">
|
||||
<table class="table table-striped table-hover" style="margin: 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;">
|
||||
<input type="checkbox"
|
||||
ng-checked="allSelected()"
|
||||
ng-click="toggleGroupSelectionAll($event)">
|
||||
</th>
|
||||
<th>Name</th>
|
||||
<th style="width: 100px; text-align: center;">Read Only</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="group in groups | orderBy: ['name']">
|
||||
<td valign="middle">
|
||||
<input type="checkbox"
|
||||
name="selectedGroups[]"
|
||||
value="{{group.id}}"
|
||||
ng-checked="groupSelected(group)"
|
||||
ng-click="toggleGroupSelection(group.id)"
|
||||
ng-disabled="group.accessAll">
|
||||
</td>
|
||||
<td valign="middle">
|
||||
{{group.name}}
|
||||
<i class="fa fa-unlock text-muted fa-fw" ng-show="group.accessAll"
|
||||
title="This group can access all items"></i>
|
||||
</td>
|
||||
<td style="width: 100px; text-align: center;" valign="middle">
|
||||
<input type="checkbox"
|
||||
name="selectedGroupsReadonly[]"
|
||||
value="{{group.id}}"
|
||||
ng-disabled="!groupSelected(group) || group.accessAll"
|
||||
ng-checked="groupSelected(group) && selectedGroups[group.id].readOnly"
|
||||
ng-click="toggleGroupReadOnlySelection(group)">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
84
src/app/organization/views/organizationCollectionsEdit.html
Normal file
84
src/app/organization/views/organizationCollectionsEdit.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-cubes"></i> Edit Collection</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit(collection)" api-form="submitPromise" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<div class="callout callout-default">
|
||||
<h4><i class="fa fa-info-circle"></i> Note</h4>
|
||||
<p>
|
||||
Select "Users" from the listing options to manage existing users for this collection. Associate new users by
|
||||
editing the user's access on the "People" page.
|
||||
</p>
|
||||
<p>
|
||||
You can associate new logins to the collection from your organization's "Vault" or by sharing an existing
|
||||
login from "My vault".
|
||||
</p>
|
||||
</div>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="email">Name</label>
|
||||
<input type="text" id="name" name="Name" ng-model="collection.name" class="form-control" required api-field />
|
||||
</div>
|
||||
<div ng-if="useGroups">
|
||||
<h4>Group Access</h4>
|
||||
<div ng-show="loading && !groups.length">
|
||||
Loading groups...
|
||||
</div>
|
||||
<div ng-show="!loading && !groups.length">
|
||||
<p>No groups for your organization.</p>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="groups.length" style="margin: 0;">
|
||||
<table class="table table-striped table-hover" style="margin: 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;">
|
||||
<input type="checkbox"
|
||||
ng-checked="allSelected()"
|
||||
ng-click="toggleGroupSelectionAll($event)">
|
||||
</th>
|
||||
<th>Name</th>
|
||||
<th style="width: 100px; text-align: center;">Read Only</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="group in groups | orderBy: ['name']">
|
||||
<td valign="middle">
|
||||
<input type="checkbox"
|
||||
name="selectedGroups[]"
|
||||
value="{{group.id}}"
|
||||
ng-checked="groupSelected(group)"
|
||||
ng-click="toggleGroupSelection(group.id)"
|
||||
ng-disabled="group.accessAll">
|
||||
</td>
|
||||
<td valign="middle">
|
||||
{{group.name}}
|
||||
<i class="fa fa-unlock text-muted fa-fw" ng-show="group.accessAll"
|
||||
title="This group can access all items"></i>
|
||||
</td>
|
||||
<td style="width: 100px; text-align: center;" valign="middle">
|
||||
<input type="checkbox"
|
||||
name="selectedGroupsReadonly[]"
|
||||
value="{{group.id}}"
|
||||
ng-disabled="!groupSelected(group) || group.accessAll"
|
||||
ng-checked="groupSelected(group) && selectedGroups[group.id].readOnly"
|
||||
ng-click="toggleGroupReadOnlySelection(group)">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
64
src/app/organization/views/organizationCollectionsUsers.html
Normal file
64
src/app/organization/views/organizationCollectionsUsers.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-users"></i> User Access <small>{{collection.name}}</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div ng-show="loading && !users.length">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!loading && !users.length">
|
||||
<p>
|
||||
No users for this collection. You can associate a new user to this collection by
|
||||
selecting a specific user on the "People" page.
|
||||
</p>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="users.length" style="margin: 0;">
|
||||
<table class="table table-striped table-hover table-vmiddle" style="margin: 0;">
|
||||
<tbody>
|
||||
<tr ng-repeat="user in users | orderBy: ['email']">
|
||||
<td style="width: 70px;">
|
||||
<div class="btn-group" data-append-to=".modal">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-cog"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-show="!user.accessAll">
|
||||
<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="#" stop-click>
|
||||
No options...
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 45px;">
|
||||
<letter-avatar data="{{user.name || user.email}}"></letter-avatar>
|
||||
</td>
|
||||
<td>
|
||||
{{user.email}}
|
||||
<div ng-if="user.name"><small class="text-muted">{{user.name}}</small></div>
|
||||
</td>
|
||||
<td style="width: 60px;" class="text-right">
|
||||
<i class="fa fa-unlock" ng-show="user.accessAll" title="Can Access All Items"></i>
|
||||
<i class="fa fa-pencil-square-o" ng-show="!user.readOnly" title="Can Edit"></i>
|
||||
</td>
|
||||
<td style="width: 100px;">
|
||||
{{user.type | enumName: 'OrgUserType'}}
|
||||
</td>
|
||||
<td style="width: 120px;">
|
||||
<span class="label {{user.status | enumLabelClass: 'OrgUserStatus'}}">
|
||||
{{user.status | enumName: 'OrgUserStatus'}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
34
src/app/organization/views/organizationDashboard.html
Normal file
34
src/app/organization/views/organizationDashboard.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Dashboard
|
||||
<small>{{orgProfile.name}}</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="callout callout-warning" ng-if="!orgProfile.enabled">
|
||||
<h4><i class="fa fa-warning"></i> Organization Disabled</h4>
|
||||
<p>This organization is currently disabled. Users will not see your shared logins or collections.</p>
|
||||
<p ng-if="!selfHosted">Contact us if you would like to reinstate this organization.</p>
|
||||
<p ng-if="selfHosted">Update your license to reinstate this organization.</p>
|
||||
<a ng-if="selfHosted" class="btn btn-default btn-flat" href="#" stop-click ng-click="goBilling()">
|
||||
Billing & Licensing
|
||||
</a>
|
||||
<a class="btn btn-default btn-flat" href="https://bitwarden.com/contact/" target="_blank">
|
||||
Contact Us
|
||||
</a>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Let's Get Started!</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>Dashboard features are coming soon. Get started by inviting users and creating your collections.</p>
|
||||
<a class="btn btn-default btn-flat" ui-sref="backend.org.people({orgId: orgProfile.id})">
|
||||
Invite Users
|
||||
</a>
|
||||
<a class="btn btn-default btn-flat" ui-sref="backend.org.collections({orgId: orgProfile.id})">
|
||||
Manage Collections
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
34
src/app/organization/views/organizationDelete.html
Normal file
34
src/app/organization/views/organizationDelete.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><i class="fa fa-trash"></i> Delete Organization</h4>
|
||||
</div>
|
||||
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Continue below to delete this organization and all associated data. This data includes any collections and
|
||||
their associated logins. Individual user accounts will remain, though they will not be associated to this
|
||||
organization anymore.
|
||||
</p>
|
||||
<div class="callout callout-warning">
|
||||
<h4><i class="fa fa-warning"></i> Warning</h4>
|
||||
Deleting this organization is permanent. It cannot be undone.
|
||||
</div>
|
||||
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="masterPassword">Master Password</label>
|
||||
<input type="password" id="masterPassword" name="MasterPasswordHash" ng-model="masterPassword" class="form-control"
|
||||
required api-field />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Delete
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user