diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd31d5c2b..5fdb100ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '18.14.0' + node-version: '18.17.0' # Npm global packages caching - name: Cache global npm modules @@ -74,7 +74,7 @@ jobs: cache-name: cache-node-modules with: # npm modules cache files are stored in `./node_modules` - path: ./node_modules + path: ./node_modules' key: ${{ runner.os }}-build-cache-v1-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-build-cache-v1-${{ hashFiles('**/package-lock.json') }} diff --git a/COPYING b/COPYING deleted file mode 100644 index 41dec8733..000000000 --- a/COPYING +++ /dev/null @@ -1,15 +0,0 @@ -Cryptopus - Web application for storing and sharing passwords and other sensitive data. -Copyright (C) 2012-2015 Puzzle ITC GmbH. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index d7c003b58..9df027831 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + ![logo](https://raw.githubusercontent.com/puzzle/cryptopus/57f8ad8de410e4a0ba16227620727787f22c7d1c/frontend/public/assets/images/cryptopussy.svg) [![Cryptopus CI build](https://github.com/puzzle/cryptopus/actions/workflows/build.yml/badge.svg)](https://github.com/puzzle/cryptopus/actions/workflows/build.yml) @@ -12,9 +13,39 @@ Cryptopus combines symmetric and asymmetric encryption. Learn more about Cryptopus on our [wiki](https://github.com/puzzle/cryptopus/wiki) page. -# Getting started +![Cryptogif](https://github.com/puzzle/cryptopus/assets/88040929/64d10f03-b2b4-4dc8-9153-ab01d38c0947) + +# Key Features +### Credential management +- Cryptopus lets you store your credentials with options for userame, email, password, pin, token or + a custom attribute. +- To generate your password for a new account we provide you with a built-in password generator with + customizable option like length or use of special characters. +- Since we want to increase the awarness to cyber security we ship our password generator with a + evaluation system which evaluates your password and tells you how secure it is. +- Last but not least we enable standard copy actions for an efficient login. + +### Sharing +- With our transfer algorithm we support sharing passwords with other users or teams. +- Similar to our credential sharing service it is possible to share files with other members or + even add them to a credential if necessary. + +### OpenID Connect +- With Version > 3.6 Cryptopus supports Single-Sign-On (SSO) with OpenID Connect / Keycloak for + simple logins => fast, easy, secure! + +### Translations +- As one of the only cryptographic tools on the market, we now provide translations for Swissgerman + which follows the implementation of German, French and English + +### Support +- With one of the most known and most prestigious projects we assure you that this + project will never run out of support. +- New features and updates are going to be implemented and published in this repository, so + stay in touch! + +# Getting involved -## System requirements 👩🏽‍💻 Development instructions [here][setup]. [setup]: https://github.com/puzzle/cryptopus/wiki/Development @@ -44,19 +75,6 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details. -# License - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or (at -your option) any later version. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see -[licenses](http://www.gnu.org/licenses/). - -Copyright (c) 2008-2022, Puzzle ITC GmbH. - # Contact Information Cryptopus was made by the guys at Puzzle ITC. Please go to diff --git a/VERSION b/VERSION index ef425ca98..d346e2ab7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.2 +5.3 diff --git a/app/controllers/api/encryptables_controller.rb b/app/controllers/api/encryptables_controller.rb index 1d0e9d980..da1e94492 100644 --- a/app/controllers/api/encryptables_controller.rb +++ b/app/controllers/api/encryptables_controller.rb @@ -2,7 +2,7 @@ class Api::EncryptablesController < ApiController - self.permitted_attrs = [:name, :description, :file] + self.permitted_attrs = [:name, :description, :file, :folder_id] helper_method :team @@ -68,7 +68,7 @@ def model_class end def define_model_class - if credential_id.present? + if credential_id.present? || params[:folder_id].present? Encryptable::File else Encryptable::Credentials @@ -81,10 +81,14 @@ def build_entry super end - def file_credential + def credential Encryptable::Credentials.find(credential_id) end + def folder + Folder.find(params[:folder_id]) + end + def fetch_entry model_scope.find(entry_id) end @@ -126,10 +130,10 @@ def permitted_attrs permitted_attrs = self.class.permitted_attrs.deep_dup if model_class == Encryptable::File - permitted_attrs + [:filename, :credentials_id, :file] + permitted_attrs + [:filename, :credentials_id] elsif model_class == Encryptable::Credentials permitted_attrs + [:cleartext_username, :cleartext_password, :cleartext_token, - :cleartext_pin, :cleartext_email, :folder_id, + :cleartext_pin, :cleartext_email, :cleartext_custom_attr, :cleartext_custom_attr_label] else [] @@ -165,23 +169,18 @@ def fetch_encryptable_files def build_encryptable_file filename = params[:file].original_filename - file = new_file(file_credential, params[:description], filename) + file = Encryptable::File.new(description: params[:description], name: filename) + file.encryptable_credential = credential if credential_id.present? + file.folder = folder if credential_id.blank? file.content_type = params[:file].content_type file.cleartext_file = params[:file].read - instance_variable_set(:"@#{ivar_name}", file) end - def new_file(parent_encryptable, description, name) - Encryptable::File.new(encryptable_credential: parent_encryptable, - description: description, - name: name) - end - def credential_id return params[:id] if params[:id].present? - params[:credential_id] + nil_param?(params[:credential_id]) end def encrypt(encryptable) diff --git a/app/controllers/api/env_settings_controller.rb b/app/controllers/api/env_settings_controller.rb index 55cf4631c..bd98a2935 100644 --- a/app/controllers/api/env_settings_controller.rb +++ b/app/controllers/api/env_settings_controller.rb @@ -32,7 +32,7 @@ def index private def last_login_message - Flash::LastLoginMessage.new(session).message + # Flash::LastLoginMessage.new(session).message end def fallback_info diff --git a/app/controllers/concerns/param_converters.rb b/app/controllers/concerns/param_converters.rb index 0a1d7ff14..9c47dbb09 100644 --- a/app/controllers/concerns/param_converters.rb +++ b/app/controllers/concerns/param_converters.rb @@ -7,4 +7,8 @@ module ParamConverters def true?(value) %w[1 yes true].include?(value.to_s.downcase) end + + def nil_param?(value) + value == 'null' ? nil : value + end end diff --git a/app/models/encryptable/file.rb b/app/models/encryptable/file.rb index c8724b944..00cee5de6 100644 --- a/app/models/encryptable/file.rb +++ b/app/models/encryptable/file.rb @@ -10,6 +10,7 @@ class Encryptable::File < Encryptable foreign_key: :credential_id validates :name, uniqueness: { scope: :credential_id }, if: :credential_id + validates :name, uniqueness: { scope: :folder_id }, if: :folder_id validate :file_size, on: [:create, :update] diff --git a/app/serializers/encryptable/file_serializer.rb b/app/serializers/encryptable/file_serializer.rb index fcf69a065..376c6a3a3 100644 --- a/app/serializers/encryptable/file_serializer.rb +++ b/app/serializers/encryptable/file_serializer.rb @@ -1,11 +1,7 @@ # frozen_string_literal: true -class Encryptable::FileSerializer < ApplicationSerializer - attributes :id, :name, :description, :sender_name +class Encryptable::FileSerializer < EncryptableSerializer + attributes :id, :name, :description, :sender_name, :created_at - def sender_name - object.sender&.label - end - - belongs_to :encryptable_credential + belongs_to :encryptable_credential, if: -> { object.encryptable_credential.present? } end diff --git a/app/serializers/folder_serializer.rb b/app/serializers/folder_serializer.rb index 632b3dd4d..cc27ebd0c 100644 --- a/app/serializers/folder_serializer.rb +++ b/app/serializers/folder_serializer.rb @@ -20,16 +20,9 @@ class FolderSerializer < ActiveModel::Serializer attributes :id, :name, :description, :unread_transferred_count - has_many :encryptables, serializer: EncryptableMinimalSerializer do - if object.personal_inbox? - object.encryptables.order('created_at DESC') - else - object.encryptables.order(:name) - end - end + has_many :encryptables, serializer: EncryptableMinimalSerializer def unread_transferred_count object.personal_inbox? ? object.unread_count_transferred_encryptables : nil end - end diff --git a/bin/frontend-tests.sh b/bin/frontend-tests.sh index 8f9414a15..9e51ccc91 100755 --- a/bin/frontend-tests.sh +++ b/bin/frontend-tests.sh @@ -14,9 +14,9 @@ rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi cd frontend if [[ $SERVER == true ]]; then - export NODE_OPTIONS=--openssl-legacy-provider && ember test --server + ember test --server else - export NODE_OPTIONS=--openssl-legacy-provider && yarn test + ember test fi rc=$? cd .. diff --git a/bin/prepare-frontend.sh b/bin/prepare-frontend.sh index 83452ddcd..b9bf42892 100755 --- a/bin/prepare-frontend.sh +++ b/bin/prepare-frontend.sh @@ -1,6 +1,6 @@ #!/bin/bash -export NODE_OPTIONS=--openssl-legacy-provider && yarn --cwd frontend/ install -export NODE_OPTIONS=--openssl-legacy-provider && yarn --cwd frontend/ build-prod +yarn --cwd frontend/ install +yarn --cwd frontend/ build-prod rm public/frontend-index.html rsync --ignore-existing -r frontend/dist/* public/ mv public/{index,frontend-index}.html diff --git a/config/docker/development/Ember.dockerfile b/config/docker/development/Ember.dockerfile index bf3832071..2eef34396 100644 --- a/config/docker/development/Ember.dockerfile +++ b/config/docker/development/Ember.dockerfile @@ -1,4 +1,4 @@ -FROM danlynn/ember-cli:4.8.0-node_18.12 +FROM danlynn/ember-cli:5.2.1-node_18.17 RUN chown 1000:1000 /myapp diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 90b7b8d39..d2f31df0d 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -14,8 +14,10 @@ # :unsafe_eval, allows execution of eval statements # :unsafe_inline, allows inline resources usage - policy.default_src :none - policy.font_src :self + policy.default_src :none unless Rails.env.development? + policy.font_src :self, "http://localhost:4200/text-security-disc-compat.eot?#iefix", + "http://localhost:4200/text-security-disc.woff2", + "http://localhost:4200/text-security-disc-compat.ttf" policy.img_src :self policy.connect_src :self, 'https://sentry.puzzle.ch' diff --git a/config/initializers/scrub_logs.rb b/config/initializers/scrub_logs.rb new file mode 100644 index 000000000..9d67cac15 --- /dev/null +++ b/config/initializers/scrub_logs.rb @@ -0,0 +1,16 @@ +module ActiveSupport + module TaggedLogging + module Formatter + # Hide Encryptable#encrypted_data column from SQL queries because it's huge. + def scrub_encrypted_data_source(input) + input.gsub(/\["encrypted_data", ".*, \["/, '["encrypted_data", "REDACTED"], ["') + end + + alias orig_call call + + def call(severity, timestamp, progname, msg) + orig_call(severity, timestamp, progname, scrub_encrypted_data_source(msg)) + end + end + end +end diff --git a/config/locales/ch_be.yml b/config/locales/ch_be.yml index 9504b4ea0..0bf7a1772 100644 --- a/config/locales/ch_be.yml +++ b/config/locales/ch_be.yml @@ -97,7 +97,7 @@ ch_be: encryptable/file: attributes: name: - taken: Datei isch schomau ufägladä wordä + taken: Dateiname isch schomau verwändet worde #Pundit pundit: diff --git a/config/locales/de.yml b/config/locales/de.yml index 00f2e71bf..1d936d819 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -97,7 +97,7 @@ de: encryptable/file: attributes: name: - taken: Datei ist schon hochgeladen worden + taken: Dateiname wurde bereits verwendet #Pundit pundit: diff --git a/config/locales/en.yml b/config/locales/en.yml index 8b31abff8..2de123db7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -97,7 +97,7 @@ en: encryptable/file: attributes: name: - taken: File has already been taken + taken: File name has already been taken #Pundit pundit: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index d76b0e36e..a84cc2cdc 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -97,7 +97,7 @@ fr: encryptable/file: attributes: name: - taken: Le fichier a déjà été pris + taken: Le nom du fichier a déjà été utilisé #Pundit pundit: diff --git a/docker-compose.yml b/docker-compose.yml index 3ba6b7365..413d9df11 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,14 +32,13 @@ services: - ./frontend:/myapp - ./tmp/bash_history:/root/.bash_history - yarn_cache:/myapp/node_modules + - ./frontend/tmp:/tmp tmpfs: - /myapp/tmp ports: - "4200:4200" - "7020:7020" - "7357:7357" - environment: - - NODE_OPTIONS=--openssl-legacy-provider volumes: bundler_cache: yarn_cache: diff --git a/frontend/app/components/admin/user/table.js b/frontend/app/components/admin/user/table.js index b71503133..7ddfdd2cb 100644 --- a/frontend/app/components/admin/user/table.js +++ b/frontend/app/components/admin/user/table.js @@ -16,7 +16,6 @@ export default class AdminUsersTable extends Component { if (this.args.users) { this.users = this.args.users - .toArray() .filter((user) => { return !user.isDeleted; }) diff --git a/frontend/app/components/admin/users.js b/frontend/app/components/admin/users.js index 80e20d594..da2d56319 100644 --- a/frontend/app/components/admin/users.js +++ b/frontend/app/components/admin/users.js @@ -17,7 +17,7 @@ export default class UsersComponent extends Component { super(...arguments); if (this.args.unlockedUsers) - this.unlockedUsers = this.args.unlockedUsers.toArray(); + this.unlockedUsers = this.args.unlockedUsers.slice(); } @action diff --git a/frontend/app/components/credential-transfer.js b/frontend/app/components/credential-transfer.js index 2231f1ed8..73f529b85 100644 --- a/frontend/app/components/credential-transfer.js +++ b/frontend/app/components/credential-transfer.js @@ -15,11 +15,15 @@ export default class CredentialTransfer extends BaseFormComponent { @tracked encryptableName; @tracked candidates; @tracked receiver; + @tracked submitIsDisabled = true; constructor() { super(...arguments); this.record = this.store.createRecord("encryptable-transfer"); + this.record.csrfToken = ENV.CSRFToken; + this.record.encryptableId = this.args.encryptableId; + this.encryptableName = this.args.encryptableName; this.changeset = new Changeset( this.record, @@ -27,14 +31,6 @@ export default class CredentialTransfer extends BaseFormComponent { EncryptableTransferCredential ); - this.changeset.csrfToken = ENV.CSRFToken; - - this.encryptableId = this.args.encryptableId; - this.encryptableName = this.args.encryptableName; - this.changeset.encryptableId = this.encryptableId; - - this.loadValidation(); - this.loadCandidates(); } @@ -48,6 +44,7 @@ export default class CredentialTransfer extends BaseFormComponent { async loadValidation() { await this.changeset.validate(); + this.submitIsDisabled = !this.changeset.isValid; } @action diff --git a/frontend/app/components/encryptable-file/form.js b/frontend/app/components/encryptable-file/form.js index 6385ead06..a8eafdc0f 100644 --- a/frontend/app/components/encryptable-file/form.js +++ b/frontend/app/components/encryptable-file/form.js @@ -1,44 +1,94 @@ import BaseFormComponent from "../base-form-component"; -import EncryptableFileValidations from "../../validations/encryptable-file"; +import { + credentialsAttachment, + encryptableFile +} from "../../validations/encryptable-file"; import lookupValidator from "ember-changeset-validations"; import Changeset from "ember-changeset"; import { action } from "@ember/object"; import { inject as service } from "@ember/service"; import { tracked } from "@glimmer/tracking"; import ENV from "frontend/config/environment"; +import { isPresent, isEmpty } from "@ember/utils"; import { fileUploadValidation } from "../../helpers/file-upload-validation"; export default class Form extends BaseFormComponent { @service store; @service router; @service fileQueue; + @service navService; - @tracked errors; + @tracked assignableTeams; - EncryptableFileValidations = EncryptableFileValidations; + @tracked errors; constructor() { super(...arguments); - + const FileValidation = this.args.attachment + ? credentialsAttachment + : encryptableFile; this.record = this.store.createRecord("encryptable-file"); + this.record.encryptable = this.args.encryptable; + this.record.csrfToken = ENV.CSRFToken; this.changeset = new Changeset( this.record, - lookupValidator(EncryptableFileValidations), - EncryptableFileValidations + lookupValidator(FileValidation), + FileValidation ); - this.changeset.encryptable = this.args.encryptable; + this.store.findAll("team").then((teams) => { + this.assignableTeams = teams; + }); + this.changeset.csrfToken = ENV.CSRFToken; } @action - abort() { - this.fileQueue.flush(); - if (this.args.onAbort) { + setDefaults() { + this.presetTeamAndFolder(); + this.changeset.validate(); + } + + get availableFolders() { + return isPresent(this.changeset.team) + ? this.store + .peekAll("folder") + .filter( + (folder) => folder.team.get("id") === this.changeset.team.get("id") + ) + : []; + } + + presetTeamAndFolder() { + let selectedFolder = this.args.folder || this.navService.selectedFolder; + let selectedTeam = + selectedFolder?.get("team") || this.navService.selectedTeam; + + if (!isEmpty(selectedTeam)) { + this.changeset.set("team", selectedTeam); + } + if (!isEmpty(selectedFolder)) { + this.changeset.set("folder", selectedFolder); + } + } + + @action + setSelectedTeam(selectedTeam) { + this.changeset.set("team", selectedTeam); + this.setSelectedFolder(null); + } + + @action + setSelectedFolder(selectedFolder) { + this.changeset.folder = selectedFolder; + this.changeset.set("folder", selectedFolder); + } + + @action + abort(byButton) { + if (this.args.onAbort && byButton) { this.args.onAbort(); - this.args.onHidden(); - return; } } @@ -50,23 +100,27 @@ export default class Form extends BaseFormComponent { ); if (isFileValid) { - await this.changeset.validate(); - this.record.encryptableCredential = this.args.encryptableCredential; + const encryptableCredential = this.args.encryptableCredential; + if(encryptableCredential) { + this.changeset.encryptableCredential = encryptableCredential; + } return this.changeset.isValid; } + return false; } - showSuccessMessage() { let msg = this.intl.t("flashes.encryptable_files.uploaded"); this.notify.success(msg); } - handleSubmitSuccess() { - this.abort(); + handleSubmitSuccess(savedRecords) { + this.abort(true); } handleSubmitError(response) { - this.errors = JSON.parse(response.body).errors; + response.json().then((data) => { + this.errors = data.errors; + }); this.changeset.file = null; this.record.encryptableCredential = null; } diff --git a/frontend/app/components/encryptable/form.js b/frontend/app/components/encryptable/form.js index c91fde6da..9cbc6c522 100644 --- a/frontend/app/components/encryptable/form.js +++ b/frontend/app/components/encryptable/form.js @@ -1,14 +1,13 @@ -import { action } from "@ember/object"; +import {action} from "@ember/object"; import AccountValidations from "../../validations/encryptable"; import lookupValidator from "ember-changeset-validations"; import Changeset from "ember-changeset"; -import { inject as service } from "@ember/service"; -import { tracked } from "@glimmer/tracking"; +import {inject as service} from "@ember/service"; +import {tracked} from "@glimmer/tracking"; import BaseFormComponent from "../base-form-component"; -import { isPresent } from "@ember/utils"; -import { isEmpty } from "@ember/utils"; -import { capitalize } from "@ember/string"; -import { A } from "@ember/array"; +import {isPresent} from "@ember/utils"; +import {capitalize} from "@ember/string"; +import {A} from "@ember/array"; export default class Form extends BaseFormComponent { @service store; @@ -17,6 +16,8 @@ export default class Form extends BaseFormComponent { @service userService; @service notify; + @tracked selectedTeam; + @tracked selectedFolder; @tracked selectedAttribute = null; @tracked assignableTeams; @@ -61,20 +62,22 @@ export default class Form extends BaseFormComponent { constructor() { super(...arguments); - this.record = - this.args.encryptable || - this.store.createRecord("encryptable-credential"); - this.isNewRecord = this.record.isNew; - - this.changeset = this.accountChangeset; - + this.isNewRecord = !this.args.encryptable; if (this.isNewRecord) { - this.presetTeamAndFolder(); + this.record = this.store.createRecord("encryptable-credential"); + this.selectedTeam = this.navService.selectedTeam; + this.selectedFolder = this.navService.selectedFolder; + } else { + this.record = this.args.encryptable; + this.selectedTeam = this.args.encryptable.folder.team; + this.selectedFolder = this.args.encryptable.folder; } - if (this.isNewRecord && isPresent(this.args.folder)) { - this.changeset.folder = this.args.folder; - } + this.changeset = new Changeset( + this.record, + lookupValidator(AccountValidations), + AccountValidations + ); this.store.findAll("team").then((teams) => { this.assignableTeams = teams; @@ -86,25 +89,13 @@ export default class Form extends BaseFormComponent { this.store.findRecord("encryptable-credential", this.record.id); } - presetTeamAndFolder() { - let selectedTeam = this.navService.selectedTeam; - let selectedFolder = this.navService.selectedFolder; - - if (!isEmpty(selectedTeam)) { - this.changeset.team = selectedTeam; - } - if (!isEmpty(selectedFolder)) { - this.changeset.folder = selectedFolder; - } - } - get availableFolders() { - return isPresent(this.changeset.team) + return isPresent(this.selectedTeam) ? this.store - .peekAll("folder") - .filter( - (folder) => folder.team.get("id") === this.changeset.team.get("id") - ) + .peekAll("folder") + .filter( + (folder) => folder.team.get("id") === this.selectedTeam.get("id") + ) : []; } @@ -129,13 +120,13 @@ export default class Form extends BaseFormComponent { @action setSelectedTeam(selectedTeam) { - this.changeset.team = selectedTeam; + this.selectedTeam = selectedTeam; this.setFolder(null); } @action setFolder(folder) { - this.changeset.folder = folder; + this.selectedFolder = folder; } @action @@ -162,6 +153,8 @@ export default class Form extends BaseFormComponent { } async beforeSubmit() { + this.changeset.folder = this.selectedFolder; + this.changeset.team = this.selectedTeam; await this.changeset.validate(); return this.changeset.isValid; } @@ -201,16 +194,8 @@ export default class Form extends BaseFormComponent { } presetTeamIfFolderSelected() { - if (isPresent(this.changeset.folder)) { - this.changeset.team = this.changeset.folder.get("team"); + if (isPresent(this.selectedFolder)) { + this.selectedTeam = this.selectedFolder.get("team"); } } - - get accountChangeset() { - return new Changeset( - this.record, - lookupValidator(AccountValidations), - AccountValidations - ); - } } diff --git a/frontend/app/components/encryptable/show.js b/frontend/app/components/encryptable/show.js index 202b485e2..616a59efe 100644 --- a/frontend/app/components/encryptable/show.js +++ b/frontend/app/components/encryptable/show.js @@ -19,9 +19,6 @@ export default class ShowComponent extends Component { @tracked isFileCreating = false; - @tracked - isFile = this.args.encryptable.isFile; - @tracked isCredentialSharing = false; diff --git a/frontend/app/components/file-transfer.js b/frontend/app/components/file-transfer.js index 84051e184..9985be9e7 100644 --- a/frontend/app/components/file-transfer.js +++ b/frontend/app/components/file-transfer.js @@ -18,10 +18,14 @@ export default class FileTransfer extends BaseFormComponent { @tracked isFileCreating = false; + @tracked + submitIsDisabled = true; + constructor() { super(...arguments); this.record = this.store.createRecord("encryptable-transfer"); + this.record.csrfToken = ENV.CSRFToken; this.changeset = new Changeset( this.record, @@ -29,10 +33,6 @@ export default class FileTransfer extends BaseFormComponent { EncryptableTransferFile ); - this.changeset.csrfToken = ENV.CSRFToken; - - this.loadValidation(); - this.loadCandidates(); } @@ -87,6 +87,7 @@ export default class FileTransfer extends BaseFormComponent { async loadValidation() { await this.changeset.validate(); + this.submitIsDisabled = !this.changeset.isValid; } validateUploadedFile() { diff --git a/frontend/app/components/folder/form.js b/frontend/app/components/folder/form.js index 911d8b635..f179feb3c 100644 --- a/frontend/app/components/folder/form.js +++ b/frontend/app/components/folder/form.js @@ -5,8 +5,6 @@ import Changeset from "ember-changeset"; import { inject as service } from "@ember/service"; import { tracked } from "@glimmer/tracking"; import BaseFormComponent from "../base-form-component"; -import { isPresent } from "@ember/utils"; - export default class Form extends BaseFormComponent { @service store; @service router; @@ -14,15 +12,21 @@ export default class Form extends BaseFormComponent { @service userService; @tracked assignableTeams; + @tracked team; FolderValidations = FolderValidations; constructor() { super(...arguments); - this.record = this.args.folder || this.store.createRecord("folder"); - - this.isNewRecord = this.record.isNew; + this.isNewRecord = !this.args.folder; + if(this.isNewRecord) { + this.record = this.store.createRecord("folder"); + this.team = this.navService.selectedTeam; + } else { + this.record = this.args.folder; + this.team = this.args.folder.team; + } this.changeset = new Changeset( this.record, @@ -30,13 +34,6 @@ export default class Form extends BaseFormComponent { FolderValidations ); - if (this.isNewRecord && this.navService.selectedTeam) - this.changeset.team = this.navService.selectedTeam; - - if (this.isNewRecord && isPresent(this.args.team)) { - this.changeset.team = this.args.team; - } - this.store.findAll("team").then((teams) => { this.assignableTeams = teams; }); @@ -45,6 +42,7 @@ export default class Form extends BaseFormComponent { @action abort() { if (this.args.onAbort) { + this.record.rollbackAttributes(); this.args.onAbort(); return; } @@ -52,10 +50,11 @@ export default class Form extends BaseFormComponent { @action setSelectedTeam(selectedTeam) { - this.changeset.team = selectedTeam; + this.team = selectedTeam; } async beforeSubmit() { + this.changeset.team = this.team; await this.changeset.validate(); return this.changeset.isValid; } diff --git a/frontend/app/components/folder/show.js b/frontend/app/components/folder/show.js index 701239b05..1f91cf27d 100644 --- a/frontend/app/components/folder/show.js +++ b/frontend/app/components/folder/show.js @@ -12,7 +12,10 @@ export default class ShowComponent extends Component { isFolderEditing = false; @tracked - isNewEncryptable = false; + isNewEncryptableCredential = false; + + @tracked + isNewEncryptableFile = false; get shouldRenderEncryptables() { return !isEmpty(this.args.folder.encryptables) && !this.isCollapsed; @@ -33,9 +36,13 @@ export default class ShowComponent extends Component { } @action - toggleEncryptableCreating() { - this.navService.setSelectedFolderById(this.args.folder.id); - this.isNewEncryptable = !this.isNewEncryptable; + toggleEncryptableCredentialCreating() { + this.isNewEncryptableCredential = !this.isNewEncryptableCredential; + } + + @action + toggleEncryptableFileCreating() { + this.isNewEncryptableFile = !this.isNewEncryptableFile; } expandSelectedFolder() { diff --git a/frontend/app/components/index-button.js b/frontend/app/components/index-button.js new file mode 100644 index 000000000..a0b65441e --- /dev/null +++ b/frontend/app/components/index-button.js @@ -0,0 +1,3 @@ +import Component from "@ember/component"; + +export default class IndexButton extends Component {} diff --git a/frontend/app/components/nav-bar.js b/frontend/app/components/nav-bar.js index c5e587f90..b00293ae2 100644 --- a/frontend/app/components/nav-bar.js +++ b/frontend/app/components/nav-bar.js @@ -13,7 +13,10 @@ export default class NavBarComponent extends Component { searchInterval; @tracked - isNewEncryptable = false; + isNewEncryptableCredential = false; + + @tracked + isNewEncryptableFile = false; @tracked isNewFolder = false; @@ -38,8 +41,13 @@ export default class NavBarComponent extends Component { } @action - toggleEncryptableCreating() { - this.isNewEncryptable = !this.isNewEncryptable; + toggleEncryptableCredentialCreating() { + this.isNewEncryptableCredential = !this.isNewEncryptableCredential; + } + + @action + toggleEncryptableFileCreating() { + this.isNewEncryptableFile = !this.isNewEncryptableFile; } @action diff --git a/frontend/app/components/side-nav-bar.js b/frontend/app/components/side-nav-bar.js index 3f44b7eab..de9bb98c8 100644 --- a/frontend/app/components/side-nav-bar.js +++ b/frontend/app/components/side-nav-bar.js @@ -37,10 +37,10 @@ export default class SideNavBar extends Component { @action setSelectedTeam(team) { - let alreadyTheSame = this.navService.selectedTeam === team; - - if (alreadyTheSame) this.collapsed = !this.collapsed; - else { + let alreadyActiveTeam = this.navService.selectedTeam === team; + if (alreadyActiveTeam) { + this.collapsed = !this.collapsed + } else { this.router.transitionTo("teams.show", team.id).then(() => { this.collapsed = false; }); diff --git a/frontend/app/components/team/form.js b/frontend/app/components/team/form.js index 7352fe193..e9c9b75ee 100644 --- a/frontend/app/components/team/form.js +++ b/frontend/app/components/team/form.js @@ -15,8 +15,8 @@ export default class Form extends BaseFormComponent { constructor() { super(...arguments); - this.record = this.args.team || this.store.createRecord("team"); - this.isNewRecord = this.record.isNew; + this.isNewRecord = !this.args.team; + this.record = this.isNewRecord ? this.store.createRecord("team") : this.args.team; this.changeset = new Changeset( this.record, diff --git a/frontend/app/components/validation-errors-list.js b/frontend/app/components/validation-errors-list.js new file mode 100644 index 000000000..03ec9b22b --- /dev/null +++ b/frontend/app/components/validation-errors-list.js @@ -0,0 +1,3 @@ +import Component from "@ember/component"; + +export default class ValidationErrorsList extends Component {} diff --git a/frontend/app/helpers/file-upload-validation.js b/frontend/app/helpers/file-upload-validation.js index eb54dd744..48461194a 100644 --- a/frontend/app/helpers/file-upload-validation.js +++ b/frontend/app/helpers/file-upload-validation.js @@ -2,15 +2,15 @@ import { helper } from "@ember/component/helper"; const TenMB = 10000000; export function fileUploadValidation(file, intl, notify) { - if (file.size > TenMB) { + if (file?.size > TenMB) { let msg = intl.t("flashes.encryptable_files.uploaded_size_to_high"); notify.error(msg); return false; - } else if (file.size === 0) { + } else if (file?.size === 0) { let msg = intl.t("flashes.encryptable_files.uploaded_file_blank"); notify.error(msg); return false; - } else if (file.name === "") { + } else if (file?.name === "") { let msg = intl.t("flashes.encryptable_files.uploaded_filename_is_empty"); notify.error(msg); return false; diff --git a/frontend/app/index.html b/frontend/app/index.html index 6907f82e8..70130daa0 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -16,10 +16,9 @@ {{content-for "body"}} -
- - + + {{content-for "body-footer"}} diff --git a/frontend/app/initializers/env-settings.js b/frontend/app/initializers/env-settings.js deleted file mode 100644 index d18755dfc..000000000 --- a/frontend/app/initializers/env-settings.js +++ /dev/null @@ -1,38 +0,0 @@ -import ENV from "../config/environment"; - -export function initialize(/* application */) { - if (ENV.environment !== "test") { - /* eslint-disable no-undef */ - const req = new XMLHttpRequest(); - req.open("GET", "/api/env_settings", false); - req.addEventListener("load", reqListener); - req.send(); - } -} - -function reqListener() { - const envSettings = JSON.parse(this.responseText); - ENV.sentryDsn = envSettings.sentry; - ENV.currentUserId = envSettings.current_user.id; - ENV.currentUserRole = envSettings.current_user.role; - ENV.currentUserGivenname = envSettings.current_user.givenname; - ENV.currentUserUsername = envSettings.current_user.username; - ENV.currentUserLastLoginAt = envSettings.current_user.last_login_at; - ENV.currentUserLastLoginFrom = envSettings.current_user.last_login_from; - ENV.currentUserAuth = envSettings.current_user.auth; - ENV.currentUserDefaultCcliUserId = - envSettings.current_user.default_ccli_user_id; - ENV.preferredLocale = envSettings.current_user.preferred_locale; - ENV.lastLoginMessage = envSettings.last_login_message; - ENV.geoIP = envSettings.geo_ip; - ENV.appVersion = envSettings.version; - ENV.CSRFToken = envSettings.csrf_token; - ENV.authProvider = envSettings.auth_provider; - ENV.fallbackInfo = envSettings.fallback_info; -} - -/* eslint-enable no-undef */ - -export default { - initialize -}; diff --git a/frontend/app/initializers/sentry.js b/frontend/app/initializers/sentry.js index c87d36c92..b862d995d 100644 --- a/frontend/app/initializers/sentry.js +++ b/frontend/app/initializers/sentry.js @@ -13,6 +13,5 @@ export function initialize() { } export default { - after: ["env-settings"], initialize }; diff --git a/frontend/app/models/encryptable-credential.js b/frontend/app/models/encryptable-credential.js index c2ed6b8e2..6920533ac 100644 --- a/frontend/app/models/encryptable-credential.js +++ b/frontend/app/models/encryptable-credential.js @@ -11,7 +11,11 @@ export default class EncryptableCredential extends Encryptable { @attr("string") cleartextCustomAttr; @attr("string") cleartextCustomAttrLabel; @attr() usedEncryptedDataAttrs; - @hasMany("encryptable-file") encryptableFiles; + @hasMany("encryptable-file", { + async: false, + inverse: "encryptableCredential" + }) + encryptableFiles; get isPasswordBlank() { return this.isFullyLoaded && isNone(this.cleartextPassword); diff --git a/frontend/app/models/encryptable-file.js b/frontend/app/models/encryptable-file.js index ca4ab1217..094b76053 100644 --- a/frontend/app/models/encryptable-file.js +++ b/frontend/app/models/encryptable-file.js @@ -1,36 +1,53 @@ import Encryptable from "./encryptable"; -import { attr, belongsTo } from "@ember-data/model"; +import {attr, belongsTo} from "@ember-data/model"; export default class EncryptableFile extends Encryptable { @attr file; - @belongsTo("encryptable-credential") encryptableCredential; + @belongsTo("encryptable-credential") + encryptableCredential; + @belongsTo("folder", {async: false, inverse: "encryptables", as: "encryptable"}) folder; async save() { if (this.isDeleted) { return super.save(); } const url = `/api/encryptables`; - const credentialId = await this.encryptableCredential.get("id"); + const opts = await this.getRequestConfig(); + let promise = this.file.upload(url, opts); + promise + .then((savedRecords) => { + savedRecords.json().then((body) => { + this.id = body.data.id; + this.name = body.data.attributes.name; + this.filename = body.data.attributes.filename; + }); + }); + return promise; + } - const opts = { + async getRequestConfig() { + const credentialId = await this.encryptableCredential.get("id"); + if (this.folder != null) { + const folderId = await this.folder.get("id"); + return { + data: { + description: this.description || "", + ...(credentialId !== undefined && {credential_id: credentialId}), + ...(folderId !== undefined && {folder_id: folderId}) + }, + headers: { + "X-CSRF-Token": this.csrfToken + } + }; + } + return { data: { description: this.description || "", - credential_id: credentialId + ...(credentialId !== undefined && {credential_id: credentialId}) }, headers: { "X-CSRF-Token": this.csrfToken } }; - - let promise = this.file.upload(url, opts); - promise - .then((savedRecords) => { - let data = JSON.parse(savedRecords.body).data; - this.id = data.id; - this.filename = data.attributes.filename; - }) - .catch(() => {}); - - return promise; } } diff --git a/frontend/app/models/encryptable.js b/frontend/app/models/encryptable.js index e4c657724..92b485b32 100644 --- a/frontend/app/models/encryptable.js +++ b/frontend/app/models/encryptable.js @@ -7,7 +7,7 @@ export default class Encryptable extends Model { @attr("string") createdAt; @attr("string") updatedAt; @attr("string") sender_name; - @belongsTo("folder") folder; + @belongsTo("folder", {async: false, inverse: "encryptables", as: "encryptable"}) folder; get isCredential() { return this.constructor.modelName === "encryptable-credential"; diff --git a/frontend/app/models/folder.js b/frontend/app/models/folder.js index d768bc675..f391220ea 100644 --- a/frontend/app/models/folder.js +++ b/frontend/app/models/folder.js @@ -4,8 +4,8 @@ export default class Folder extends Model { @attr("string") name; @attr("string") description; @attr("number") unreadTransferredCount; - @hasMany("encryptable") encryptables; - @belongsTo("team") team; + @hasMany("encryptable", { async: false, inverse: "folder", polymorphic: true, as: "encryptable" }) encryptables; + @belongsTo("team", { async: false, inverse: "folders" }) team; get isInboxFolder() { return this.name === "inbox" && this.team.get("isPersonalTeam"); diff --git a/frontend/app/models/team.js b/frontend/app/models/team.js index 004cea361..e87a81e77 100644 --- a/frontend/app/models/team.js +++ b/frontend/app/models/team.js @@ -10,8 +10,8 @@ export default class Team extends Model { @attr("boolean") favourised; @attr("boolean") deletable; @attr("number") unread_count; - @hasMany("folder") folders; - @hasMany("teammember") teammembers; + @hasMany("folder", { async: false, inverse: "team" }) folders; + @hasMany("teammember", { async: false, inverse: "team" }) teammembers; get isPersonalTeam() { return this.type === "Team::Personal"; diff --git a/frontend/app/models/teammember.js b/frontend/app/models/teammember.js index 139621b80..d8ccb70ea 100644 --- a/frontend/app/models/teammember.js +++ b/frontend/app/models/teammember.js @@ -2,8 +2,8 @@ import Model, { attr, belongsTo } from "@ember-data/model"; export default class Teammember extends Model { @attr("string") label; - @belongsTo("team") team; - @belongsTo("user-human") user; + @belongsTo("team", { async: false, inverse: "teammembers" }) team; + @belongsTo("user-human", { async: false, inverse: null }) user; @attr("boolean") deletable; @attr("boolean") admin; } diff --git a/frontend/app/routes/admin.js b/frontend/app/routes/admin.js index d07d8ecd7..f1caa69d8 100644 --- a/frontend/app/routes/admin.js +++ b/frontend/app/routes/admin.js @@ -1,13 +1,14 @@ -import BaseRoute from "./base"; import { inject as service } from "@ember/service"; +import ApplicationRoute from "./application"; -export default class AdminRoute extends BaseRoute { +export default class AdminRoute extends ApplicationRoute { @service userService; @service navService; + @service router; beforeModel() { if (!this.userService.mayManageSettings) { - return this.transitionTo("index"); + return this.router.transitionTo("index"); } } diff --git a/frontend/app/routes/admin/settings.js b/frontend/app/routes/admin/settings.js index 8554f8dc1..a3c64fb25 100644 --- a/frontend/app/routes/admin/settings.js +++ b/frontend/app/routes/admin/settings.js @@ -6,12 +6,13 @@ import en from "i18n-iso-countries/langs/en.json"; export default class AdminSettingsRoute extends AdminRoute { ISOArray = []; - constructor() { - super(...arguments); + + async beforeModel() { countries.registerLocale(en); let locale = ENV.preferredLocale !== "ch_be" ? ENV.preferredLocale : "de"; this.ISOArray = Object.entries(countries.getNames(locale)); } + model() { const countries = this.ISOArray.map((countryArray) => { return { value: countryArray[0], label: countryArray[1] }; diff --git a/frontend/app/routes/application.js b/frontend/app/routes/application.js index c9c04fae5..a697daa95 100644 --- a/frontend/app/routes/application.js +++ b/frontend/app/routes/application.js @@ -3,11 +3,15 @@ import { inject as service } from "@ember/service"; import { action } from "@ember/object"; import ENV from "../config/environment"; -export default class IndexRoute extends Route { +export default class ApplicationRoute extends Route { @service notify; @service intl; + @service logoutTimerService; + @service store; + @service envSettingsService; - beforeModel() { + async beforeModel() { + await this.envSettingsService.applyEnvSettings(); let selectedLocale = this.intl.locales.includes( ENV.preferredLocale.replace("_", "-") ) @@ -27,6 +31,12 @@ export default class IndexRoute extends Route { } } + @action + didTransition() { + this.logoutTimerService.start(); + return true; // Bubble the didTransition event + } + getErrorMessage(error) { let msg = this.intl.t("something_went_wrong"); let error_msg = error?.errors[0]; diff --git a/frontend/app/routes/base.js b/frontend/app/routes/base.js deleted file mode 100644 index 4eefec535..000000000 --- a/frontend/app/routes/base.js +++ /dev/null @@ -1,13 +0,0 @@ -import Route from "@ember/routing/route"; -import { action } from "@ember/object"; -import { inject as service } from "@ember/service"; - -export default class BaseRoute extends Route { - @service logoutTimerService; - - @action - didTransition() { - this.logoutTimerService.start(); - return true; // Bubble the didTransition event - } -} diff --git a/frontend/app/routes/dashboard.js b/frontend/app/routes/dashboard.js index 3094f7e35..6b4f9fcce 100644 --- a/frontend/app/routes/dashboard.js +++ b/frontend/app/routes/dashboard.js @@ -1,9 +1,10 @@ -import BaseRoute from "./base"; import { inject as service } from "@ember/service"; import RSVP from "rsvp"; +import ApplicationRoute from "./application"; -export default class DashboardRoute extends BaseRoute { +export default class DashboardRoute extends ApplicationRoute { @service navService; + @service store; queryParams = { q: { diff --git a/frontend/app/routes/encryptable.js b/frontend/app/routes/encryptable.js index 9b44acf69..8055fcb0c 100644 --- a/frontend/app/routes/encryptable.js +++ b/frontend/app/routes/encryptable.js @@ -1,3 +1,3 @@ -import BaseRoute from "./base"; +import ApplicationRoute from "./application"; -export default class EncryptablesRoute extends BaseRoute {} +export default class EncryptablesRoute extends ApplicationRoute {} diff --git a/frontend/app/routes/encryptables/edit.js b/frontend/app/routes/encryptables/edit.js index 2c172291d..9e2b5fda6 100644 --- a/frontend/app/routes/encryptables/edit.js +++ b/frontend/app/routes/encryptables/edit.js @@ -1,6 +1,6 @@ -import BaseRoute from "@ember/routing/route"; +import ApplicationRoute from "../application"; -export default class EncryptableEditRoute extends BaseRoute { +export default class EncryptableEditRoute extends ApplicationRoute { model(params) { return this.store.findRecord("encryptable", params.id); } diff --git a/frontend/app/routes/encryptables/new.js b/frontend/app/routes/encryptables/new.js index 1e7b97354..19b92d1dc 100644 --- a/frontend/app/routes/encryptables/new.js +++ b/frontend/app/routes/encryptables/new.js @@ -1,6 +1,6 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; -export default BaseRoute.extend({ +export default ApplicationRoute.extend({ queryParams: { folder_id: { refreshModel: true diff --git a/frontend/app/routes/encryptables/show.js b/frontend/app/routes/encryptables/show.js index b331693b2..cf6b19216 100644 --- a/frontend/app/routes/encryptables/show.js +++ b/frontend/app/routes/encryptables/show.js @@ -1,8 +1,8 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; import { inject as service } from "@ember/service"; import RSVP from "rsvp"; -export default class EncryptableShowRoute extends BaseRoute { +export default class EncryptableShowRoute extends ApplicationRoute { @service navService; afterModel() { diff --git a/frontend/app/routes/folders/edit.js b/frontend/app/routes/folders/edit.js index 0466bc466..884f3ee3e 100644 --- a/frontend/app/routes/folders/edit.js +++ b/frontend/app/routes/folders/edit.js @@ -1,6 +1,6 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; -export default BaseRoute.extend({ +export default ApplicationRoute.extend({ queryParams: { team_id: { refreshModel: true diff --git a/frontend/app/routes/folders/new.js b/frontend/app/routes/folders/new.js index 6928ff93d..6656ff716 100644 --- a/frontend/app/routes/folders/new.js +++ b/frontend/app/routes/folders/new.js @@ -1,6 +1,6 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; -export default BaseRoute.extend({ +export default ApplicationRoute.extend({ queryParams: { team_id: { refreshModel: true diff --git a/frontend/app/routes/index.js b/frontend/app/routes/index.js index 41306f82f..d2c55d2ca 100644 --- a/frontend/app/routes/index.js +++ b/frontend/app/routes/index.js @@ -1,8 +1,8 @@ -import BaseRoute from "./base"; import { inject as service } from "@ember/service"; import ENV from "../config/environment"; +import ApplicationRoute from "./application"; -export default class IndexRoute extends BaseRoute { +export default class IndexRoute extends ApplicationRoute { @service navService; @service notify; diff --git a/frontend/app/routes/profile.js b/frontend/app/routes/profile.js index e7a3f06a8..70e84e469 100644 --- a/frontend/app/routes/profile.js +++ b/frontend/app/routes/profile.js @@ -1,9 +1,9 @@ -import BaseRoute from "./base"; import ENV from "../config/environment"; import RSVP from "rsvp"; import { inject as service } from "@ember/service"; +import ApplicationRoute from "./application"; -export default class ProfileRoute extends BaseRoute { +export default class ProfileRoute extends ApplicationRoute { @service navService; model() { diff --git a/frontend/app/routes/teams.js b/frontend/app/routes/teams.js index 6aae0cdac..6d61eadbe 100644 --- a/frontend/app/routes/teams.js +++ b/frontend/app/routes/teams.js @@ -1,3 +1,3 @@ -import BaseRoute from "./base"; +import ApplicationRoute from "./application"; -export default class TeamsRoute extends BaseRoute {} +export default class TeamsRoute extends ApplicationRoute {} diff --git a/frontend/app/routes/teams/configure.js b/frontend/app/routes/teams/configure.js index 5468e2690..00c93b64e 100644 --- a/frontend/app/routes/teams/configure.js +++ b/frontend/app/routes/teams/configure.js @@ -1,6 +1,6 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; -export default class TeamsConfigureRoute extends BaseRoute { +export default class TeamsConfigureRoute extends ApplicationRoute { async model(params) { return params.team_id; } diff --git a/frontend/app/routes/teams/edit.js b/frontend/app/routes/teams/edit.js index baf5fa2d8..eee75d84b 100644 --- a/frontend/app/routes/teams/edit.js +++ b/frontend/app/routes/teams/edit.js @@ -1,6 +1,6 @@ -import BaseRoute from "../base"; +import ApplicationRoute from "../application"; -export default BaseRoute.extend({ +export default ApplicationRoute.extend({ model(params) { return this.store.findRecord("team", params.id); } diff --git a/frontend/app/routes/teams/folders-show.js b/frontend/app/routes/teams/folders-show.js index 020e6522f..0bb46ad2d 100644 --- a/frontend/app/routes/teams/folders-show.js +++ b/frontend/app/routes/teams/folders-show.js @@ -1,8 +1,8 @@ import { inject as service } from "@ember/service"; -import BaseRoute from "../base"; import { action } from "@ember/object"; +import ApplicationRoute from "../application"; -export default class TeamsFoldersIndexRoute extends BaseRoute { +export default class TeamsFoldersIndexRoute extends ApplicationRoute { @service navService; templateName = "teams/index"; diff --git a/frontend/app/routes/teams/index.js b/frontend/app/routes/teams/index.js index 3f1d6a49a..412f9c384 100644 --- a/frontend/app/routes/teams/index.js +++ b/frontend/app/routes/teams/index.js @@ -1,9 +1,10 @@ -import BaseRoute from "../base"; import { isPresent } from "@ember/utils"; import { inject as service } from "@ember/service"; +import ApplicationRoute from "../application"; -export default class TeamsIndexRoute extends BaseRoute { +export default class TeamsIndexRoute extends ApplicationRoute { @service navService; + @service router; queryParams = { q: { @@ -16,7 +17,7 @@ export default class TeamsIndexRoute extends BaseRoute { let definedParamValues = Object.values(params).filter((value) => !!value); if (definedParamValues.length === 0) { transition.abort(); - this.transitionTo("index"); + this.router.transitionTo("index"); } else if (isPresent(params["q"])) { this.navService.clearNavSelection(); this.navService.searchQuery = params["q"]; diff --git a/frontend/app/routes/teams/new.js b/frontend/app/routes/teams/new.js index 4f4b74a02..83e4955b3 100644 --- a/frontend/app/routes/teams/new.js +++ b/frontend/app/routes/teams/new.js @@ -1,3 +1,2 @@ -import BaseRoute from "../base"; - -export default BaseRoute.extend({}); +import ApplicationRoute from "../application"; +export default ApplicationRoute.extend({}); diff --git a/frontend/app/routes/teams/show.js b/frontend/app/routes/teams/show.js index a02f44943..f6de13b15 100644 --- a/frontend/app/routes/teams/show.js +++ b/frontend/app/routes/teams/show.js @@ -1,8 +1,8 @@ import { inject as service } from "@ember/service"; -import BaseRoute from "../base"; import { action } from "@ember/object"; +import ApplicationRoute from "../application"; -export default class TeamsShowRoute extends BaseRoute { +export default class TeamsShowRoute extends ApplicationRoute { @service navService; @service notify; @service intl; diff --git a/frontend/app/services/env-settings-service.js b/frontend/app/services/env-settings-service.js new file mode 100644 index 000000000..24f3d6db6 --- /dev/null +++ b/frontend/app/services/env-settings-service.js @@ -0,0 +1,33 @@ +import Service from "@ember/service"; +import ENV from "../config/environment"; + +export default class EnvSettingsService extends Service { + + async applyEnvSettings() { + if(ENV.environment !== "test") { + const response = await fetch("/api/env_settings"); + const envSettings = await response.json(); + await this.setEnvSettings(envSettings); + } + } + + async setEnvSettings(envSettings) { + ENV.sentryDsn = envSettings.sentry; + ENV.currentUserId = envSettings.current_user.id; + ENV.currentUserRole = envSettings.current_user.role; + ENV.currentUserGivenname = envSettings.current_user.givenname; + ENV.currentUserUsername = envSettings.current_user.username; + ENV.currentUserLastLoginAt = envSettings.current_user.last_login_at; + ENV.currentUserLastLoginFrom = envSettings.current_user.last_login_from; + ENV.currentUserAuth = envSettings.current_user.auth; + ENV.currentUserDefaultCcliUserId = + envSettings.current_user.default_ccli_user_id; + ENV.preferredLocale = envSettings.current_user.preferred_locale; + ENV.lastLoginMessage = envSettings.last_login_message; + ENV.geoIP = envSettings.geo_ip; + ENV.appVersion = envSettings.version; + ENV.CSRFToken = envSettings.csrf_token; + ENV.authProvider = envSettings.auth_provider; + ENV.fallbackInfo = envSettings.fallback_info; + } +} diff --git a/frontend/app/services/nav-service.js b/frontend/app/services/nav-service.js index d7e61f6ad..7075c6029 100644 --- a/frontend/app/services/nav-service.js +++ b/frontend/app/services/nav-service.js @@ -46,7 +46,7 @@ export default class NavService extends Service { } _sortTeams(teams) { - return teams.toArray().sort((a, b) => { + return teams.slice().sort((a, b) => { if (a.isPersonalTeam) { return -1; } diff --git a/frontend/app/styles/app.scss b/frontend/app/styles/app.scss index 853c0ae5c..04914359e 100644 --- a/frontend/app/styles/app.scss +++ b/frontend/app/styles/app.scss @@ -48,10 +48,6 @@ $font-family-sans-serif: var(--pzsh-font-family) !default; flex-direction: row; } -.float-right { - float: right !important; -} - .pt-10 { padding-top: 10%; } @@ -71,13 +67,6 @@ $font-family-sans-serif: var(--pzsh-font-family) !default; margin-top: 1%; } -.ml-2 { - margin-left: 2%; -} -.ml-5 { - margin-left: 5%; -} - .mb-2 { margin-bottom: 2%; } @@ -122,24 +111,10 @@ li a { margin-bottom: 5px !important; } -.ml-5 { - margin-left: 5%; -} - .mt-32 { margin-top: 32px; } -.ml-15 { - margin-left: 15px; -} - -.ml-254 { - margin-left: 254px !important; -} -.ml-238 { - margin-left: 238px !important; -} .mt-60 { margin-top: 54px !important; } @@ -298,10 +273,6 @@ li a { background-color: #f8f8f8; } -.pl-none { - padding-left: 0 !important; -} - .search-badge { padding: 5px 10px 3px 8px !important; margin-left: 10px; @@ -484,7 +455,7 @@ h5, h6 { margin-bottom: -5px; } -@media screen and (max-width: 799px){ +@media screen and (max-width: 799px) { .ember-notify-default.ember-notify-cn { bottom: 11em !important; } @@ -502,3 +473,18 @@ h5, h6 { font-size: 1.5rem; } +.powerSelect { + background-color: #325c9e; + width: 100%; +} + +.powerSelect { + span.ember-power-select-status-icon { + display: none !important; + } +} + +.ember-power-select-placeholder { + color: white !important; +} + diff --git a/frontend/app/styles/custom-bootstrap.scss b/frontend/app/styles/custom-bootstrap.scss new file mode 100644 index 000000000..78f2e1cb3 --- /dev/null +++ b/frontend/app/styles/custom-bootstrap.scss @@ -0,0 +1,2 @@ +$btn-color: #ff0000; +$btn-color: #ff0000 diff --git a/frontend/app/styles/encryptable-form.scss b/frontend/app/styles/encryptable-form.scss index 3619d5735..e48f69aa7 100644 --- a/frontend/app/styles/encryptable-form.scss +++ b/frontend/app/styles/encryptable-form.scss @@ -53,17 +53,14 @@ margin-bottom: 0.5rem; } -#add-field-dropdown { - border-color: #CCC; - width: 100%; - max-width: 100%; - height: 35px; - margin-left: 5%; +.d-flex .ember-basic-dropdown { + width: 39%; + max-width: 39%; } -.d-flex .ember-basic-dropdown { - width: 36%; - max-width: 36%; +#file-upload-dropdowns .ember-basic-dropdown { + width: 100%; + max-width: 100%; } #encryptable-form-team .ember-basic-dropdown .ember-basic-dropdown-trigger, diff --git a/frontend/app/styles/nav-bar.scss b/frontend/app/styles/nav-bar.scss index 914fb3e0e..a9223c208 100644 --- a/frontend/app/styles/nav-bar.scss +++ b/frontend/app/styles/nav-bar.scss @@ -121,10 +121,6 @@ padding-left: 32px !important; } - .ml-238 { - margin-left: 238px !important; - } - .side-nav-bar-teams-list .list-group-item:hover { cursor: pointer; background-color: #1E5A96 !important; diff --git a/frontend/app/styles/side-nav-bar.scss b/frontend/app/styles/side-nav-bar.scss index 3bcff55bf..5acd69d76 100644 --- a/frontend/app/styles/side-nav-bar.scss +++ b/frontend/app/styles/side-nav-bar.scss @@ -16,7 +16,7 @@ background-color: white; } -.toggle-button.active { +.toggle-button-active { background-color: white !important; border-color: #238BCA !important; } @@ -142,7 +142,7 @@ background-color: rgba(0, 0, 0, 0.12) !important; } - .toggle-button.active { + .toggle-button-active { background-color: rgba(0, 0, 0, 0.12) !important; border-color: #116289 !important; } @@ -169,7 +169,6 @@ border-bottom-right-radius: 0; border-color: rgba(167, 167, 167, 0.44) !important; } - } @media screen and (min-width: 1501px) { @@ -189,7 +188,6 @@ border-bottom-right-radius: 0; border-color: rgba(167, 167, 167, 0.44) !important; } - } @media screen and (min-width: 992px) { @@ -197,7 +195,7 @@ background-color: #ffffff; } - .toggle-button.active { + .toggle-button-active { background-color: #fff !important; border-color: #238BCA !important; } diff --git a/frontend/app/templates/application.hbs b/frontend/app/templates/application.hbs index 4b284db6d..65edf79c0 100644 --- a/frontend/app/templates/application.hbs +++ b/frontend/app/templates/application.hbs @@ -1,35 +1,37 @@ - - - +
+ + + -{{#if this.navService.isOnDashboardRoute}} - -

Puzzle Cryptopus

-

{{t "slogan"}}

- Cryptopus logo -
- {{outlet}} -{{else}} -
- {{#if this.navService.showSideNavBar}} - {{#unless this.screenWidthService.isShownOnHamburgermenu}} - - {{/unless}} - {{/if}} + {{#if this.navService.isOnDashboardRoute}} + +

Puzzle Cryptopus

+

{{t "slogan"}}

+ Cryptopus logo +
+ {{outlet}} + {{else}} +
+ {{#if this.navService.showSideNavBar}} + {{#unless this.screenWidthService.isShownOnHamburgermenu}} + + {{/unless}} + {{/if}} - {{#if this.navService.showSideNavBar}} -
- {{outlet}} -
- {{else}} -
- {{outlet}} -
- {{/if}} -
-{{/if}} - + {{#if this.navService.showSideNavBar}} +
+ {{outlet}} +
+ {{else}} +
+ {{outlet}} +
+ {{/if}} +
+ {{/if}} + -
+
+
diff --git a/frontend/app/templates/components/admin/user/form.hbs b/frontend/app/templates/components/admin/user/form.hbs index c076af744..e03941f5c 100644 --- a/frontend/app/templates/components/admin/user/form.hbs +++ b/frontend/app/templates/components/admin/user/form.hbs @@ -1,4 +1,5 @@ -