diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /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/db.sqlite3 b/db.sqlite3
new file mode 100644
index 0000000..e69de29
diff --git a/manage.py b/manage.py
new file mode 100644
index 0000000..d5ef8d2
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == '__main__':
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pwdselfservice.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
diff --git a/pwdselfservice/__init__.py b/pwdselfservice/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pwdselfservice/local_settings.py b/pwdselfservice/local_settings.py
new file mode 100644
index 0000000..eee84db
--- /dev/null
+++ b/pwdselfservice/local_settings.py
@@ -0,0 +1,30 @@
+# AD配置
+AD_HOST = 'abc.com'
+AD_LOGIN_USER = 'abc\pwdadmin'
+AD_LOGIN_USER_PWD = 'gVykWgNNF0oBQzwmwPp8'
+BASE_DN = 'OU=RD,DC=abc,DC=com'
+
+# 钉钉配置
+# 钉钉统一接口地址,不可修改。
+DING_URL = "https://oapi.dingtalk.com/sns"
+
+# 钉钉企业ID
+DING_CORP_ID = 'ding0176902811df32'
+
+# 钉钉E应用
+DING_AGENT_ID = '25311eeee'
+DING_APP_KEY = 'dingqdzmax324v'
+DING_APP_SECRET = 'rnGRJhhw5kVmzykG9mrTDxewmI4e0myPAluMlguYQOaadsf2fhgfdfsx'
+
+# 钉钉移动应用接入
+DING_SELF_APP_ID = 'dingoabrzugusdfdf33fgfds
+DING_SELF_APP_SECRET = 'IrH2MedSgesguFjGvFCTjXYBRZDhA5AI4ADQU5710sgLffdsadf32uhgfdsfs'
+
+# Crypty key 通过generate_key生成,可不用修改,如果需要自行生成,请使用Crypto.generate_key自行生成,用于加密页面提交的明文密码
+CRYPTO_KEY = b'dp8U9y7NAhCD3MoNwPzPBhBtTZ1uI_WWSdpNs6wUDgs='
+
+# COOKIE 超时,定义多长时间页面失效,单位秒。
+TMPID_COOKIE_AGE = 300
+
+# 主页域名,index.html中的钉钉跳转等需要指定域名。
+HOME_URL = 'https://pwd.abc.com'
\ No newline at end of file
diff --git a/pwdselfservice/settings.py b/pwdselfservice/settings.py
new file mode 100644
index 0000000..66adc43
--- /dev/null
+++ b/pwdselfservice/settings.py
@@ -0,0 +1,186 @@
+"""
+Django settings for pwdselfservice project.
+
+Generated by 'django-admin startproject' using Django 2.1.8.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/2.1/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'nxnm3#&2tat_c2i6%$y74a)t$(3irh^gpwaleoja1kdv30fmcm'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = False
+
+ALLOWED_HOSTS = ['*']
+
+# 创建日志的路径
+LOG_PATH = os.path.join(BASE_DIR, 'log')
+# 如果地址不存在,则会自动创建log文件夹
+if not os.path.isdir(LOG_PATH):
+ os.mkdir(LOG_PATH)
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,#此选项开启表示禁用部分日志,不建议设置为True
+ 'formatters': {
+ 'verbose': {
+ 'format': '%(asctime)s %(levelname)s %(pathname)s %(module)s.%(funcName)s %(lineno)d: %(message)s'
+ #日志格式
+ },
+ 'simple': {
+ 'format': '%(asctime)s %(levelname)s %(pathname)s %(module)s.%(funcName)s %(lineno)d: %(message)s'
+ },
+ },
+ 'filters': {
+ 'require_debug_true': {
+ '()': 'django.utils.log.RequireDebugTrue',#过滤器,只有当setting的DEBUG = True时生效
+ },
+ },
+ 'handlers': {
+ 'console': {
+ 'level': 'DEBUG',
+ 'filters': ['require_debug_true'],
+ 'class': 'logging.StreamHandler',
+ 'formatter': 'verbose'
+ },
+ 'file': {#重点配置部分
+ 'level': 'DEBUG',
+ 'class': 'logging.FileHandler',
+ 'filename': '%s/log.log' % LOG_PATH,#日志保存文件
+ 'formatter': 'verbose'#日志格式,与上边的设置对应选择
+ }
+ },
+ 'loggers': {
+ 'django': {#日志记录器
+ 'handlers': ['file'],
+ 'level': 'DEBUG',
+ 'propagate': True,
+ }
+ },
+}
+
+
+# SESSION
+# 只有在settings.SESSION_SAVE_EVERY_REQUEST 为True时才有效
+SESSION_SAVE_EVERY_REQUEST = True
+# 过期时间分钟
+SESSION_COOKIE_AGE = 300
+# False 会话cookie可以在用户浏览器中保持有效期。True:关闭浏览器,则Cookie失效。
+SESSION_EXPIRE_AT_BROWSER_CLOSE = True
+# 建议配置,阻止 javascript 对会话数据的访问,提高安全性。
+# SESSION_COOKIE_HTTPONLY= True
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'resetpwd',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'pwdselfservice.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [os.path.join(BASE_DIR, 'templates')]
+ ,
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'pwdselfservice.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/2.1/topics/i18n/
+
+LANGUAGE_CODE = 'zh-hans'
+
+TIME_ZONE = 'Asia/Shanghai'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = False
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/2.1/howto/static-files/
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+STATIC_URL = '/static/'
+STATIC_ROOT = 'static'
+
+STATICFILES_DIRS = [
+ os.path.join(BASE_DIR, 'static'),
+]
+
diff --git a/pwdselfservice/urls.py b/pwdselfservice/urls.py
new file mode 100644
index 0000000..99622c9
--- /dev/null
+++ b/pwdselfservice/urls.py
@@ -0,0 +1,15 @@
+from django.urls import path, include, re_path
+from django.views.generic.base import RedirectView
+from django.conf import urls
+import resetpwd.views
+from django.conf.urls.static import static
+
+urlpatterns = {
+ # path('admin/', admin.site.urls)
+ path("favicon.ico", RedirectView.as_view(url='static/img/favicon.ico')),
+ path('', resetpwd.views.resetpwd_index, name='index'),
+ path('resetcheck', resetpwd.views.resetpwd_check_userinfo, name='resetcheck'),
+ path('resetpwd', resetpwd.views.resetpwd_reset, name='resetpwd'),
+ path('resetunlock', resetpwd.views.resetpwd_unlock, name='resetunlock'),
+ path('resetmsg', resetpwd.views.reset_msg, name='resetmsg'),
+}
diff --git a/pwdselfservice/wsgi.py b/pwdselfservice/wsgi.py
new file mode 100644
index 0000000..6446a49
--- /dev/null
+++ b/pwdselfservice/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for pwdselfservice project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pwdselfservice.settings')
+
+application = get_wsgi_application()
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..00de17a
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,123 @@
+# 初学Django时碰到的一个需求,因为公司中很多员工在修改密码之后,有一些关联的客户端或网页中的旧密码没有更新,导致密码在尝试多次之后账号被锁,为了减少这种让人头疼的重置解锁密码的操蛋工作,自己做了一个自助修改小平台。
+
+## 代码写得很LOW,有需要的可以直接拿去用。
+
+
+## 需要的基础环境:
+* Python 3.6.x
+* Nginx(建议)
+* Uwsgi(建议)
+
+## 钉钉必要条件:
+#### E应用配置
+* 在钉钉工作台中通过“自建应用”创建应用,选择“企业内部自主开发”,在应用首页中获取应用的AgentId、AppKey、AppSecret。
+* 应用需要权限:身份验证、消息通知、通讯录只读权限、手机号码信息、邮箱等个人信息、智能人事,范围是全部员工或自行选择
+* 应用安全域名和IP一定要配置,否则无法返回接口数据。
+
+#### 移动接入应用:
+* 登录中开启扫码登录,配置回调域名:“https://pwd.abc.com/resetcheck”
+ 其中pwd.abc.com请按自己实际域名来,并记录相关的appId、appSecret。
+
+
+## 按自己实际的配置修改项目配置参数:
+修改pwdselfservice/local_settings.py中的参数,按自己的实际参数修改
+
+``` python
+# AD配置
+AD_HOST = 'abc.com'
+AD_LOGIN_USER = 'abc\pwdadmin'
+AD_LOGIN_USER_PWD = 'gVykWgNNF0oBQzwmwPp8'
+BASE_DN = 'OU=rd,DC=abc,DC=com'
+
+# 钉钉配置
+# 钉钉统一接口地址,不可修改
+DING_URL = "https://oapi.dingtalk.com/sns"
+
+# 钉钉企业ID
+DING_CORP_ID = 'ding01769028f06d321'
+
+# 钉钉E应用
+DING_AGENT_ID = '25304321'
+DING_APP_KEY = 'dingqdzmn611l5321321'
+DING_APP_SECRET = 'rnGRJhhw5kVmzykG9mrTDxewmI4e0myP1123333221jzeKv3amQYWcInLV3x'
+
+# 钉钉移动应用接入
+DING_SELF_APP_ID = 'dingoabr112233xts'
+DING_SELF_APP_SECRET = 'IrH2MedSgesguFjGvFCTjXYBRZD3322112233332211222
+
+# Crypty key 通过Crypty.generate_key生成
+CRYPTO_KEY = b'dp8U9y7NAhCD3MoNwPzPBhBtTZ1uI_WWSdpNs6wUDgs='
+
+# COOKIE 超时
+TMPID_COOKIE_AGE = 300
+
+# 主页域名
+HOME_URL = 'https://pwd.abc.com'
+
+```
+
+
+### 自行安装完python3之后,使用python3目录下的pip3进行安装依赖:
+### 我自行安装的Python路径为/usr/local/python3
+项目目录下的requestment文件里记录了所依赖的相关python模块,安装方法:
+* /usr/local/python3/bin/pip3 install -r requestment
+
+等待所有模块安装完成之后进行下一步。
+
+安装完依赖后,直接执行
+/usr/local/python3/bin/python3 manager.py runserver x.x.x.x:8000
+即可访问正常访问项目
+
+## 通过uwsgi启动:
+/usr/local/python3/bin/uwsgi -d --ini /usr/loca/wwwroot/pwdselfservice/uwsgi.ini
+
+其中/xxx/xxx/pwdselfservice/uwsgi.ini是你自己的服务器中此文件的真实地址
+
+启动之后也可以通过IP+端口访问了。
+
+提供2个脚本,让uwsgi在修改文件时能自动重载:
+
+uwsgi-start.sh:
+```shell
+#!/bin/sh
+/usr/local/python3/bin/uwsgi -d --ini /usr/loca/wwwroot/pwdselfservice/uwsgi.ini --touch-reload "/usr/loca/wwwroot/pwdselfservice/reload.set"
+```
+
+uwsgi-autoreload.sh:
+```shell
+#!/bin/sh
+objectdir="/usr/loca/wwwroot/pwdselfservice"
+
+/usr/bin/inotifywait -mrq --exclude "(logs|\.swp|\.swx|\.log|\.pyc|\.sqlite3)" --timefmt '%d/%m/%y %H:%M' --format '%T %wf' --event modify,delete,move,create,attrib ${objectdir} | while read files
+do
+/bin/touch /usr/loca/wwwroot/pwdselfservice/reload.set
+continue
+done &
+```
+脚本内的路径按自己实际情况修改
+
+## Nginx配置:
+
+Nginx Server配置:
+* proxy_pass的IP地址改成自己的服务器IP
+* 配置可自己写一个vhost或直接加在nginx.conf中
+``` nginx
+server {
+ listen 80;
+ server_name pwd.abc.com;
+
+ location / {
+ proxy_pass http://192.168.x.x:8000;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+
+ }
+ access_log /var/log/nginx/vhost/pwd.log access;
+ error_log /var/log/nginx/vhost/pwd.err error;
+}
+```
+
+- 执行Nginx reload操作,重新加载配置
+
+
diff --git a/requestment b/requestment
new file mode 100644
index 0000000..947c1fe
--- /dev/null
+++ b/requestment
@@ -0,0 +1,7 @@
+Django==2.1.8
+dingtalk-sdk>=1.2.2
+pycrypto==2.6
+cryptography
+ldap3
+requests
+uwsgi
\ No newline at end of file
diff --git a/resetpwd/__init__.py b/resetpwd/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/resetpwd/ad.py b/resetpwd/ad.py
new file mode 100644
index 0000000..131b0e1
--- /dev/null
+++ b/resetpwd/ad.py
@@ -0,0 +1,99 @@
+from ldap3 import *
+from pwdselfservice.local_settings import *
+
+
+def __ad_connect():
+ username = str(AD_LOGIN_USER).lower()
+ server = Server(host=AD_HOST, use_ssl=True, port=636, get_info='ALL')
+ try:
+ conn = Connection(server, auto_bind=True, user=username, password=AD_LOGIN_USER_PWD, authentication='NTLM')
+ return conn
+ except Exception:
+ raise Exception('Server Error. Could not connect to Domain Controller')
+
+
+def ad_ensure_user_by_sam(username):
+ """
+ 通过sAMAccountName查询某个用户是否在AD中
+ :param username: 除去@domain.com 的部分
+ :return: True or False
+ """
+ conn = __ad_connect()
+ base_dn = BASE_DN
+ condition = '(&(objectclass=person)(mail=' + username + '))'
+ attributes = ['sAMAccountName']
+ return conn.search(base_dn, condition, attributes=attributes)
+
+
+def ad_ensure_user_by_mail(user_mail_addr):
+ """
+ 通过mail查询某个用户是否在AD中
+ :param user_mail_addr:
+ :return: True or False
+ """
+ conn = __ad_connect()
+ base_dn = BASE_DN
+ condition = '(&(objectclass=person)(mail=' + user_mail_addr + '))'
+ attributes = ['mail']
+ return conn.search(base_dn, condition, attributes=attributes)
+
+
+def ad_get_user_displayname_by_mail(user_mail_addr):
+ conn = __ad_connect()
+ conn.search(BASE_DN, '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=[
+ 'displayName'])
+ user_displayname = conn.entries[0]['displayName']
+ conn.unbind()
+ return user_displayname
+
+
+def ad_get_user_dn_by_mail(user_mail_addr):
+ conn = __ad_connect()
+ conn.search(BASE_DN,
+ '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['distinguishedName'])
+ user_dn = conn.entries[0]['distinguishedName']
+ return user_dn
+
+
+def ad_get_user_status_by_mail(user_mail_addr):
+ conn = __ad_connect()
+ conn.search(BASE_DN,
+ '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['userAccountControl'])
+ user_account_control = conn.entries[0]['userAccountControl']
+ return user_account_control
+
+
+def ad_unlock_user_by_mail(user_mail_addr):
+ conn = __ad_connect()
+ user_dn = ad_get_user_dn_by_mail(user_mail_addr)
+ result = conn.extend.microsoft.unlock_account(user="%s" % user_dn)
+ conn.unbind()
+ return result
+
+
+def ad_reset_user_pwd_by_mail(user_mail_addr, new_password):
+ conn = __ad_connect()
+ user_dn = ad_get_user_dn_by_mail(user_mail_addr)
+ result = conn.extend.microsoft.modify_password(user="%s" % user_dn, new_password="%s" % new_password)
+ conn.unbind()
+ return result
+
+
+def ad_modify_user_pwd_by_mail(user_mail_addr, old_password, new_password):
+ conn = __ad_connect()
+ user_dn = ad_get_user_dn_by_mail(user_mail_addr)
+ result = conn.extend.microsoft.modify_password(user="%s" % user_dn, new_password="%s" % new_password,
+ old_password="%s" % old_password)
+ conn.unbind()
+ return result
+
+
+def ad_get_user_locked_status_by_mail(user_mail_addr):
+ conn = __ad_connect()
+ conn.search(BASE_DN, '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['lockoutTime'])
+ locked_status = conn.entries[0]['lockoutTime']
+ print(locked_status)
+ if '1601-01-01' in str(locked_status):
+ return 0
+ else:
+ return locked_status
diff --git a/resetpwd/admin.py b/resetpwd/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/resetpwd/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/resetpwd/apps.py b/resetpwd/apps.py
new file mode 100644
index 0000000..d0bf5a2
--- /dev/null
+++ b/resetpwd/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class ResetpwdConfig(AppConfig):
+ name = 'resetpwd'
diff --git a/resetpwd/crypto.py b/resetpwd/crypto.py
new file mode 100644
index 0000000..c996977
--- /dev/null
+++ b/resetpwd/crypto.py
@@ -0,0 +1,22 @@
+from cryptography.fernet import Fernet
+
+
+class Crypto(object):
+ """docstring for ClassName"""
+ def __init__(self, key):
+ self.factory = Fernet(key)
+
+ @staticmethod
+ def generate_key():
+ key = Fernet.generate_key()
+ print(key)
+
+ # 加密
+ def encrypt(self, string):
+ token = str(self.factory.encrypt(string.encode('utf-8')), 'utf-8')
+ return token
+
+ # 解密
+ def decrypt(self, token):
+ string = self.factory.decrypt(bytes(token.encode('utf-8'))).decode('utf-8')
+ return string
diff --git a/resetpwd/dingding.py b/resetpwd/dingding.py
new file mode 100644
index 0000000..845bede
--- /dev/null
+++ b/resetpwd/dingding.py
@@ -0,0 +1,82 @@
+from dingtalk.client import *
+import requests
+from pwdselfservice.local_settings import *
+
+
+def ding_get_access_token():
+ resp = requests.get(
+ url=DING_URL + "/gettoken",
+ params=dict(appid=DING_SELF_APP_ID, appsecret=DING_SELF_APP_SECRET)
+ )
+ resp = resp.json()
+ if resp['access_token']:
+ return resp['access_token']
+ else:
+ return None
+
+
+def ding_get_persistent_code(code, token):
+ resp = requests.post(
+ url="%s/get_persistent_code?access_token=%s" % (DING_URL, token),
+ json=dict(tmp_auth_code=code),
+ )
+ resp = resp.json()
+ if resp['unionid']:
+ return resp['unionid']
+ else:
+ return None
+
+
+def ding_client_connect():
+ client = AppKeyClient(corp_id=DING_CORP_ID, app_key=DING_APP_KEY, app_secret=DING_APP_SECRET)
+ return client
+
+
+def ding_get_dept_user_list_detail(dept_id, offset, size):
+ client = ding_client_connect()
+ result = client.user.list(department_id=dept_id, offset=offset, size=size)
+ return result
+
+
+def ding_get_userinfo_by_code(code):
+ """
+ :param code: requestAuthCode接口中获取的CODE
+ :return:
+ """
+ client = ding_client_connect()
+ resutl = client.user.getuserinfo(code)
+ return resutl
+
+
+def ding_get_userid_by_unionid(unionid):
+ """
+ :param unionid: 用户在当前钉钉开放平台账号范围内的唯一标识
+ :return:
+ """
+ client = ding_client_connect()
+ resutl = client.user.get_userid_by_unionid(unionid)
+ if resutl['userid']:
+ return resutl['userid']
+ else:
+ return None
+
+
+def ding_get_org_user_count():
+ """
+ 企业员工数量
+ only_active – 是否包含未激活钉钉的人员数量
+ :return:
+ """
+ client = ding_client_connect()
+ resutl = client.user.get_org_user_count('only_active')
+ return resutl
+
+
+def ding_get_userinfo_detail(user_id):
+ """
+ user_id – 用户ID
+ :return:
+ """
+ client = ding_client_connect()
+ resutl = client.user.get(user_id)
+ return resutl
diff --git a/resetpwd/form.py b/resetpwd/form.py
new file mode 100644
index 0000000..dd02390
--- /dev/null
+++ b/resetpwd/form.py
@@ -0,0 +1,34 @@
+from django.forms import fields as c_fields
+from django import forms as c_forms
+from django.core.exceptions import ValidationError
+
+
+class CheckForm(c_forms.Form):
+ new_password = c_fields.RegexField(
+ '(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}',
+ # 密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位
+ strip=True,
+ min_length=8,
+ max_length=30,
+ error_messages={'required': '新密码不能为空.',
+ 'invalid': '密码必须包含数字,字母、特殊字符',
+ 'min_length': "密码长度不能小于8个字符",
+ 'max_length': "密码长度不能大于30个字符"}
+ )
+ old_password = c_fields.CharField(error_messages={'required': '确认密码不能为空'})
+ ensure_password = c_fields.CharField(error_messages={'required': '确认密码不能为空'})
+ user_email = c_fields.CharField(error_messages={'required': '邮箱不能为空', 'invalid': '邮箱格式错误'})
+
+ def clean(self):
+ pwd0 = self.cleaned_data.get('old_password')
+ pwd1 = self.cleaned_data.get('new_password')
+ pwd2 = self.cleaned_data.get('ensure_password')
+ if pwd1 == pwd2:
+ pass
+ elif pwd0 == pwd1:
+ # 这里异常模块导入要放在函数里面,放到文件开头有时会报错,找不到
+ from django.core.exceptions import ValidationError
+ raise ValidationError('新旧密码不能一样')
+ else:
+ from django.core.exceptions import ValidationError
+ raise ValidationError('新密码和确认密码输入不一致')
diff --git a/resetpwd/migrations/__init__.py b/resetpwd/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/resetpwd/models.py b/resetpwd/models.py
new file mode 100644
index 0000000..8ecf29d
--- /dev/null
+++ b/resetpwd/models.py
@@ -0,0 +1,4 @@
+from django.db import models
+from django import forms
+from django.contrib import auth
+
diff --git a/resetpwd/pwdcheck.py b/resetpwd/pwdcheck.py
new file mode 100644
index 0000000..0c611eb
--- /dev/null
+++ b/resetpwd/pwdcheck.py
@@ -0,0 +1,30 @@
+from django.shortcuts import render, reverse, HttpResponsePermanentRedirect, redirect
+from django.http import *
+from django.contrib import messages
+from dingtalk import *
+from .models import *
+from .crypto import Crypto
+from .ad import ad_get_user_locked_status_by_mail, ad_unlock_user_by_mail, ad_reset_user_pwd_by_mail, \
+ ad_get_user_status_by_mail, ad_ensure_user_by_mail, ad_modify_user_pwd_by_mail
+from .dingding import ding_get_userinfo_detail, ding_get_userid_by_unionid, ding_get_userinfo_by_code, \
+ ding_get_persistent_code, ding_get_access_token
+from pwdselfservice.local_settings import *
+from .form import *
+
+
+class CustomPasswortValidator(object):
+
+ def __init__(self, min_length=1, max_length=30):
+ self.min_length = min_length
+
+ def validate(self, password):
+ special_characters = "[~\!@#\$%\^&\*\(\)_\+{}\":;'\[\]]"
+ if not any(char.isdigit() for char in password):
+ raise ValidationError(_('Password must contain at least %(min_length)d digit.') % {'min_length': self.min_length})
+ if not any(char.isalpha() for char in password):
+ raise ValidationError(_('Password must contain at least %(min_length)d letter.') % {'min_length': self.min_length})
+ if not any(char in special_characters for char in password):
+ raise ValidationError(_('Password must contain at least %(min_length)d special character.') % {'min_length': self.min_length})
+
+ def get_help_text(self):
+ return ""
diff --git a/resetpwd/tests.py b/resetpwd/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/resetpwd/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/resetpwd/views.py b/resetpwd/views.py
new file mode 100644
index 0000000..a72ec02
--- /dev/null
+++ b/resetpwd/views.py
@@ -0,0 +1,382 @@
+from django.shortcuts import render
+from django.http import *
+from .crypto import Crypto
+from .ad import ad_get_user_locked_status_by_mail, ad_unlock_user_by_mail, ad_reset_user_pwd_by_mail, \
+ ad_get_user_status_by_mail, ad_ensure_user_by_mail, ad_modify_user_pwd_by_mail
+from .dingding import ding_get_userinfo_detail, ding_get_userid_by_unionid, \
+ ding_get_persistent_code, ding_get_access_token
+from pwdselfservice.local_settings import *
+from .form import CheckForm
+import logging
+
+
+msg_template = 'msg.html'
+home_url = HOME_URL
+logger = logging.getLogger('django')
+
+def resetpwd_index(request):
+ home_url = HOME_URL
+ app_id = DING_SELF_APP_ID
+ if request.method == 'GET':
+ return render(request, 'index.html', locals())
+ else:
+ logger.error('[异常] 请求方法:%s,请求路径:%s' % (request.method, request.path))
+
+ if request.method == 'POST':
+ check_form = CheckForm(request.POST)
+ if check_form.is_valid():
+ form_obj = check_form.cleaned_data
+ user_email = form_obj.get("user_email")
+ old_password = form_obj.get("old_password")
+ new_password = form_obj.get("new_password")
+ else:
+ msg = check_form.as_p().errors
+ logger.error('[异常] 请求方法:%s,请求路径:%s,错误信息:%s' % (request.method, request.path, msg))
+ context = {
+ 'msg': msg,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+ if user_email and old_password and new_password:
+ try:
+ # 判断账号是否被锁定
+ if ad_get_user_locked_status_by_mail(user_mail_addr=user_email) is not 0:
+ context = {
+ 'msg': "此账号己被锁定,请先解锁账号。",
+ 'button_click': "window.history.back()",
+ 'button_display': "返回"
+ }
+ return render(request, msg_template, context)
+
+ if ad_get_user_status_by_mail(user_mail_addr=user_email) == 514 or ad_get_user_status_by_mail(
+ user_mail_addr=user_email) == 66050:
+ context = {
+ 'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+ else:
+ try:
+ result = ad_modify_user_pwd_by_mail(user_mail_addr=user_email, old_password=old_password,
+ new_password=new_password)
+ if result is True:
+ context = {
+ 'msg': "密码己修改成功,请妥善保管密码。你可直接关闭此页面!",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+ else:
+ context = {
+ 'msg': "密码未修改成功,请确认旧密码是否正确。",
+ 'button_click': "window.history.back()",
+ 'button_display': "返回"
+ }
+ return render(request, msg_template, context)
+
+ except IndexError:
+ context = {
+ 'msg': "请确认邮箱账号[%s]是否正确?未能在Active Directory中检索到相关信息。" % user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except Exception as e:
+ context = {
+ 'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+ except IndexError:
+ context = {
+ 'msg': "请确认邮箱账号[%s]是否正确?未能在Active Directory中检索到相关信息。" % user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except Exception as e:
+ context = {
+ 'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
+ 'button_click': "window.history.back()",
+ 'button_display': "返回"
+ }
+ return render(request, msg_template, context)
+
+ else:
+ context = {
+ 'msg': "用户名、旧密码、新密码参数不正确,请重新确认后输入。",
+ 'button_click': "window.history.back()",
+ 'button_display': "返回"
+ }
+ return render(request, msg_template, context)
+
+ else:
+ context = {
+ 'msg': "请从主页进行修改密码操作或扫码验证用户信息。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+
+def resetpwd_check_userinfo(request):
+ code = request.GET.get('code')
+ if code:
+ logger.info('[成功] 请求方法:%s,请求路径:%s,CODE:%s' % (request.method, request.path, code))
+ else:
+ logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到CODE。' % (request.method, request.path))
+ try:
+ unionid = ding_get_persistent_code(code, ding_get_access_token())
+ # unionid 在钉钉企业中是否存在
+ if not unionid:
+ logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到unionid。' % (request.method, request.path))
+ context = {
+ 'msg': '未能在钉钉企业通讯录中检索到相关信息,请确认当前登录钉钉的账号已在企业中注册!',
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ ding_user_info = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))
+ try:
+ # 钉钉中此账号是否可用
+ if ding_user_info['active']:
+ crypto = Crypto(CRYPTO_KEY)
+ unionid_cryto = crypto.encrypt(unionid)
+ # 配置cookie,并重定向到重置密码页面。
+ set_cookie = HttpResponseRedirect('resetpwd')
+ set_cookie.set_cookie('tmpid', unionid_cryto, expires=TMPID_COOKIE_AGE)
+ return set_cookie
+ else:
+ context = {
+ 'msg': '邮箱是[%s]的用户在钉钉中未激活或可能己离职' % ding_user_info['email'],
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except IndexError:
+ context = {
+ 'msg': "用户不存在或己离职",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except Exception as e:
+ logger.error('[异常] :%s' % str(e))
+
+ except KeyError:
+ context = {
+ 'msg': "错误,钉钉临时Code己失效,请从主页重新扫码。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ logger.error('[异常] :%s' % str(KeyError))
+ return render(request, msg_template, context)
+
+ except Exception as e:
+ context = {
+ 'msg': "错误[%s],请与管理员联系." % str(e),
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ logger.error('[异常] :%s' % str(e))
+ return render(request, msg_template, context)
+
+
+def resetpwd_reset(request):
+ global unionid_crypto
+ if request.method == 'GET':
+ try:
+ unionid_crypto = request.COOKIES.get('tmpid')
+ except Exception as e:
+ logger.error('[异常] :%s' % str(e))
+ if not unionid_crypto:
+ logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到CODE或CODE己超时。' % (request.method, request.path))
+ context = {
+ 'msg': "会话己超时,请重新扫码验证用户信息。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ crypto = Crypto(CRYPTO_KEY)
+ unionid = crypto.decrypt(unionid_crypto)
+ user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
+ if user_email:
+ context = {
+ 'user_email': user_email,
+ }
+ return render(request, 'resetpwd.html', context)
+ else:
+ context = {
+ 'msg': "%s 您好,企业钉钉中未能找到您账号的邮箱配置,请联系HR完善信息。" % ding_get_userinfo_detail(ding_get_userid_by_unionid(
+ unionid))['name'],
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+ elif request.method == 'POST':
+ new_password = request.POST.get('new_password').strip()
+ unionid_crypto = request.COOKIES.get('tmpid')
+ if not unionid_crypto:
+ context = {
+ 'msg': "会话己超时,请重新扫码验证用户信息。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ crypto = Crypto(CRYPTO_KEY)
+ unionid = crypto.decrypt(unionid_crypto)
+ user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
+ if ad_ensure_user_by_mail(user_mail_addr=user_email) is False:
+ context = {
+ 'msg': "账号[%s]在AD中不存在,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该邮箱账号己被禁用!\n猜测:您的邮箱是否是带有数字或其它字母区分?" % user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ if ad_get_user_status_by_mail(user_mail_addr=user_email) == 514 or ad_get_user_status_by_mail(
+ user_mail_addr=user_email) == 66050:
+ context = {
+ 'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ try:
+ result = ad_reset_user_pwd_by_mail(user_mail_addr=user_email, new_password=new_password)
+ if result:
+ # 重置密码并执行一次解锁,防止重置后账号还是锁定状态。
+ ad_unlock_user_by_mail(user_email)
+ context = {
+ 'msg': "密码己重置成功,请妥善保管。你可以点击返回主页或直接关闭此页面!",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ context = {
+ 'msg': "密码未重置成功,确认密码是否满足AD的复杂性要求。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except IndexError:
+ context = {
+ 'msg': "请确认邮箱账号[%s]是否正确?未能在AD中检索到相关信息。" % user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except Exception as e:
+ context = {
+ 'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ context = {
+ 'msg': "请从主页开始进行操作。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+
+def resetpwd_unlock(request):
+ if request.method == 'GET':
+ unionid_crypto = request.COOKIES.get('tmpid')
+ if not unionid_crypto:
+ context = {
+ 'msg': "会话己超时,请重新扫码验证用户信息。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ crypto = Crypto(CRYPTO_KEY)
+ unionid = crypto.decrypt(unionid_crypto)
+ user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
+ context = {
+ 'user_email': user_email,
+ }
+ return render(request, 'resetpwd.html', context)
+
+ elif request.method == 'POST':
+ unionid_crypto = request.COOKIES.get('tmpid')
+ if not unionid_crypto:
+ context = {
+ 'msg': "会话己超时,请重新扫码验证用户信息。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ crypto = Crypto(CRYPTO_KEY)
+ unionid = crypto.decrypt(unionid_crypto)
+ user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
+ if ad_ensure_user_by_mail(user_mail_addr=user_email) is False:
+ context = {
+ 'msg': "账号[%s]在AD中未能正确检索到,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该邮箱账号己被禁用!\n猜测:您的邮箱是否是带有数字或其它字母区分?" %
+ user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ try:
+ result = ad_unlock_user_by_mail(user_email)
+ if result:
+ context = {
+ 'msg': "账号己解锁成功。你可以点击返回主页或直接关闭此页面!",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ context = {
+ 'msg': "账号未能解锁,请联系管理员确认该账号在AD的是否己禁用。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except IndexError:
+ context = {
+ 'msg': "请确认邮箱账号[%s]是否正确?未能在AD中检索到相关信息。" % user_email,
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ except Exception as e:
+ context = {
+ 'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+ else:
+ context = {
+ 'msg': "请从主页开始进行操作。",
+ 'button_click': "window.location.href='%s'" % home_url,
+ 'button_display': "返回主页"
+ }
+ return render(request, msg_template, context)
+
+
+def reset_msg(request):
+ msg = request.GET.get('msg')
+ button_click = request.GET.get('button_click')
+ button_display = request.GET.get('button_display')
+ context = {
+ 'msg': msg,
+ 'button_click': button_click,
+ 'button_display': button_display
+ }
+ return render(request, msg_template, context)
diff --git a/screenshot/Snipaste_2019-07-15_20-05-49.jpg b/screenshot/Snipaste_2019-07-15_20-05-49.jpg
new file mode 100644
index 0000000..965d7f6
Binary files /dev/null and b/screenshot/Snipaste_2019-07-15_20-05-49.jpg differ
diff --git a/screenshot/Snipaste_2019-07-15_20-06-14.jpg b/screenshot/Snipaste_2019-07-15_20-06-14.jpg
new file mode 100644
index 0000000..35f4bc1
Binary files /dev/null and b/screenshot/Snipaste_2019-07-15_20-06-14.jpg differ
diff --git a/static/css/load.css b/static/css/load.css
new file mode 100644
index 0000000..6dab43d
--- /dev/null
+++ b/static/css/load.css
@@ -0,0 +1,135 @@
+.sk-fading-circle {
+ margin: 100px auto;
+ width: 40px;
+ height: 40px;
+ position: relative;
+}
+
+.sk-fading-circle .sk-circle {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0;
+ top: 0;
+}
+
+.sk-fading-circle .sk-circle:before {
+ content: '';
+ display: block;
+ margin: 0 auto;
+ width: 15%;
+ height: 15%;
+ background-color: #333;
+ border-radius: 100%;
+ -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
+ animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
+}
+.sk-fading-circle .sk-circle2 {
+ -webkit-transform: rotate(30deg);
+ -ms-transform: rotate(30deg);
+ transform: rotate(30deg);
+}
+.sk-fading-circle .sk-circle3 {
+ -webkit-transform: rotate(60deg);
+ -ms-transform: rotate(60deg);
+ transform: rotate(60deg);
+}
+.sk-fading-circle .sk-circle4 {
+ -webkit-transform: rotate(90deg);
+ -ms-transform: rotate(90deg);
+ transform: rotate(90deg);
+}
+.sk-fading-circle .sk-circle5 {
+ -webkit-transform: rotate(120deg);
+ -ms-transform: rotate(120deg);
+ transform: rotate(120deg);
+}
+.sk-fading-circle .sk-circle6 {
+ -webkit-transform: rotate(150deg);
+ -ms-transform: rotate(150deg);
+ transform: rotate(150deg);
+}
+.sk-fading-circle .sk-circle7 {
+ -webkit-transform: rotate(180deg);
+ -ms-transform: rotate(180deg);
+ transform: rotate(180deg);
+}
+.sk-fading-circle .sk-circle8 {
+ -webkit-transform: rotate(210deg);
+ -ms-transform: rotate(210deg);
+ transform: rotate(210deg);
+}
+.sk-fading-circle .sk-circle9 {
+ -webkit-transform: rotate(240deg);
+ -ms-transform: rotate(240deg);
+ transform: rotate(240deg);
+}
+.sk-fading-circle .sk-circle10 {
+ -webkit-transform: rotate(270deg);
+ -ms-transform: rotate(270deg);
+ transform: rotate(270deg);
+}
+.sk-fading-circle .sk-circle11 {
+ -webkit-transform: rotate(300deg);
+ -ms-transform: rotate(300deg);
+ transform: rotate(300deg);
+}
+.sk-fading-circle .sk-circle12 {
+ -webkit-transform: rotate(330deg);
+ -ms-transform: rotate(330deg);
+ transform: rotate(330deg);
+}
+.sk-fading-circle .sk-circle2:before {
+ -webkit-animation-delay: -1.1s;
+ animation-delay: -1.1s;
+}
+.sk-fading-circle .sk-circle3:before {
+ -webkit-animation-delay: -1s;
+ animation-delay: -1s;
+}
+.sk-fading-circle .sk-circle4:before {
+ -webkit-animation-delay: -0.9s;
+ animation-delay: -0.9s;
+}
+.sk-fading-circle .sk-circle5:before {
+ -webkit-animation-delay: -0.8s;
+ animation-delay: -0.8s;
+}
+.sk-fading-circle .sk-circle6:before {
+ -webkit-animation-delay: -0.7s;
+ animation-delay: -0.7s;
+}
+.sk-fading-circle .sk-circle7:before {
+ -webkit-animation-delay: -0.6s;
+ animation-delay: -0.6s;
+}
+.sk-fading-circle .sk-circle8:before {
+ -webkit-animation-delay: -0.5s;
+ animation-delay: -0.5s;
+}
+.sk-fading-circle .sk-circle9:before {
+ -webkit-animation-delay: -0.4s;
+ animation-delay: -0.4s;
+}
+.sk-fading-circle .sk-circle10:before {
+ -webkit-animation-delay: -0.3s;
+ animation-delay: -0.3s;
+}
+.sk-fading-circle .sk-circle11:before {
+ -webkit-animation-delay: -0.2s;
+ animation-delay: -0.2s;
+}
+.sk-fading-circle .sk-circle12:before {
+ -webkit-animation-delay: -0.1s;
+ animation-delay: -0.1s;
+}
+
+@-webkit-keyframes sk-circleFadeDelay {
+ 0%, 39%, 100% { opacity: 0; }
+ 40% { opacity: 1; }
+}
+
+@keyframes sk-circleFadeDelay {
+ 0%, 39%, 100% { opacity: 0; }
+ 40% { opacity: 1; }
+}
\ No newline at end of file
diff --git a/static/css/login.css b/static/css/login.css
new file mode 100644
index 0000000..1693c81
--- /dev/null
+++ b/static/css/login.css
@@ -0,0 +1,119 @@
+a, body, button, dd, div, dl, dt, h1, h2, h3, h4, h5, h6, input, li, ol, p, td, textarea, ul { margin: 0; padding: 0; }
+body, button, input, select, textarea { font: 9pt/1.5 tahoma,arial,Hiragino Sans GB,\5b8b\4f53,sans-serif; }
+button, h1, h2, h3, h4, h5, h6, input, select, textarea { font-size: 100%; }
+ /*background-image: linear-gradient(160deg, #2f548e 20%,#043559 80%);*/
+html{height: 100%; background-image: linear-gradient(160deg, #2f548e 20%,#043559 80%);}
+ol, ul { list-style: none;}
+a { color: #666; text-decoration: none; }
+a:hover { color: #043559; text-decoration: underline; }
+body { font-size: 9pt; height: 100%;
+ font-family: 'microsoft yahei', sans-serif; min-width: 750pt; margin: 0; overflow: hidden}
+img { border: 0; vertical-align: top; }
+textarea { resize: none; }
+a, button, input, select, textarea { outline: 0; }
+a, button { cursor: pointer; }
+button { border: none; }
+.errorlist {font-size: 16px; color: #333333}
+.pagewrap {height: 100% }
+.main { position: relative; margin-top:0; width: 100%; height: 100%}
+.header {height: 100px;margin-bottom: 5%;margin-left: 50px; background: url(/static/img/logo.png) left center no-repeat; }
+.header h1 a { display: block; }
+.content { overflow: hidden; margin-left: 10% }
+.content .con_left { float: left; height: 450px; width: 50%; margin-top: 65px}
+/*.content .con_left .box {position: absolute; width: 400px; height:400px; left: 50%; right: 50%; margin-left: -100px; margin-right: -100px;}*/
+.content .con_left p { padding: 0 0 3px; width: 10pc; color: #040000; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
+.content .con_left a { padding: 0 0 0 2pc; color: #2f548e; text-decoration: underline; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right { float: left; margin: 65px 0 0; width: 28pc; height: 450px; border: 1px solid #dedede; background: #fff; }
+.content .con_right .con_r_top { padding: 0 0 0 39px; width: 409px; height: 110px; border-top: 8px solid #2e558e; }
+.content .con_right .con_r_top .left, .content .con_right .con_r_top .right { float: left; padding: 35px 0 0; width: 186px; height: 35px; text-align: center; text-decoration: none; font-size: 18px; font-family: "微软雅黑"; }
+.content .con_right .con_r_top .left { border-bottom: 2px solid #dedede; color: #999; }
+.content .con_right ul .con_r_left .erweima { text-align: center; }
+.content .con_right ul .con_r_left p {color: #2f548e; font-size: 25px; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right ul .con_r_left .user input { margin: 0 0 21px -1px; padding-left: 7px; width: 324px; height: 33px; border: 1px solid #dedede; color: #999; font-size: 14px; font-family: "微软雅黑"; line-height: 2pc; }
+.content .con_right ul .con_r_left .user { padding: 0 0 0 39px; }
+.content .con_right ul .con_r_left .user ul{font-size: 16px; color: #333333}
+.content .con_right ul .con_r_left .user li{font-size: 16px; color: #333333}
+.content .con_right ul .con_r_left .user .user-icon { float: left; width: 36px; height: 35px; background: url(../img/user-icon.jpg) left top no-repeat; }
+.content .con_right ul .con_r_left .user .mima-icon { float: left; width: 36px; height: 35px; background: url(../img/mima-icon.jpg) left top no-repeat; }
+.content .con_right ul .con_r_left .user .unlock-icon { float: left; width: 36px; height: 35px; background: url(../img/unlock.jpg) left top no-repeat; }
+.content .con_right ul .con_r_left p { overflow: hidden; padding: 0 39px 37px; color: #666; font-size: 13px; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right ul .con_r_left p .mima { float: left; padding-left: 5px; text-decoration: none; }
+.content .con_right ul .con_r_left p .zhuce { float: right; text-decoration: none; }
+.content .con_right ul .con_r_left button { margin: 0 0 0 75pt; width: 250px; height: 44px; background: #2e558e; color: #fff; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right .con_r_top .right { border-bottom: 2px solid #2e558e; color: #333; }
+.content .con_right ul .con_r_right .user input { margin: 0 0 21px -1px; padding-left: 7px; width: 324px; height: 33px; border: 1px solid #dedede; color: #999; font-size: 14px; font-family: "微软雅黑"; line-height: 2pc; }
+.content .con_right ul .con_r_right .user { padding: 0 0 0 39px; }
+.content .con_right ul .con_r_right .user ul{font-size: 16px; color: #333333}
+.content .con_right ul .con_r_right .user li{font-size: 16px; color: #333333}
+.content .con_right ul .con_r_right .user .user-icon { float: left; width: 36px; height: 35px; background: url(../img/user-icon.jpg) left top no-repeat; }
+.content .con_right ul .con_r_right .user .mima-icon { float: left; width: 36px; height: 35px; background: url(../img/mima-icon.jpg) left top no-repeat; }
+.content .con_right ul .con_r_right .user .unlock-icon { float: left; width: 36px; height: 35px; background: url(../img/unlock.jpg) left top no-repeat; }
+.content .con_right ul .con_r_right p { overflow: hidden; padding: 0 39px 37px; color: #666; font-size: 13px; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right ul .con_r_right p .mima { float: left; padding-left: 5px; text-decoration: none; }
+.content .con_right ul .con_r_right p .zhuce { float: right; text-decoration: none; }
+.content .con_right ul .con_r_right button { margin: 0 0 0 75pt; width: 250px; height: 44px; background: #2e558e; color: #fff; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
+.content .con_right ul .con_r_left { display: none; }
+.con_right ul .con_r_left .erweima { position: relative; margin: 0 auto; width: 365px; height: 330px; }
+.qrcode { position: absolute; top: 0; left: 0; width: 174px; height: 11pc; }
+.divimg { position: absolute; top: 50%; left: 50%; z-index: 100; overflow: hidden; margin-top: -15px; margin-left: -30px; padding: 1px; width: 60px; height: 30px; border: 1px solid #eee; border-radius: .5rem; background: #fff; opacity: .9; filter: alpha(opacity=90); -moz-opacity: .9; }
+.content .con_right ul .con_r_right .user .yanzheng { width: 150px; margin: 0 5px 10px 1px; padding-left: 5px; }
+.content .con_right ul .con_r_right .user .next { font-size: 12px; width: 40px; height: 33px; float: right; margin-right: 40px; }
+.content .con_right .con_r_top { *height: 90px; }
+
+.autoWidth{margin:0 auto;min-width:1000px;max-width:1200px}
+.auto{margin:0 auto;min-width:1000px;max-width:1200px}
+@media screen and (max-width:1233px){.auto{padding-left:10px}
+}
+.clearfix:after,.clearfix:before{display:table;line-height:0;content:""}
+.clearfix:after{clear:both}
+.clear-float{clear:both}
+
+.footer{background-color:#009fd9;font-family: 'microsoft yahei', sans-serif; }
+.footer-floor1{width:100%;padding:36px 0 60px}
+.footer-list{width:69%;height:100%;float:left}
+.footer-list ul{float:left;margin-right:13%}
+.footer-list .flist-4{margin-right:0}
+.footer-list li{line-height:32px}
+.footer-list li a{color:#b6e2f2;font-size:12px;text-decoration:none}
+.footer-list li a:hover{text-decoration:underline;color:#fff}
+.footer-list .flist-title{font-size:16px;color:#fff;margin-bottom:15px}
+.footer-floor2{width:100%;border-top:1px solid #4cc3ed;padding:20px 0;text-align:center}
+.footer-floor2 p{text-align:center;color:#b6e2f2;font-size:12px;line-height:30px}
+.footer-floor2 p span{font-family:PingFangSC-Light,'helvetica neue','hiragino sans gb',tahoma,'microsoft yahei ui','microsoft yahei',sans-serif}
+.footer-floor2 a{color:#b6e2f2}
+.footer-floor2 a:hover{color:#a8d0e0;text-decoration:underline}
+.foot-link{margin:0 15px;text-decoration:none;color:#b6e2f2}
+.foot-link:hover{text-decoration:underline}
+.footer-right{width:300px;float:right}
+.telephone{width:100%;height:32px;line-height:32px;color:#fff}
+.telephone .tel-number{font-size:30px;font-weight:400;text-align:right}
+.official-plat{width:100%;height:100%;margin-top:20px;position:relative}
+.official-plat ul{float:right;margin-top:7px}
+.official-plat ul li{height:45px}
+.official-plat ul a{display:inline-block;height:32px;width:100%;line-height:32px;color:#fff;text-decoration:none;font-size:12px}
+.official-plat>p{display:inline-block;width:132px;height:132px;border:1px solid #ddd;background-color:#fff}
+#wx-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:12px;right:-20px;z-index:10}
+#wb-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:58px;right:-20px;z-index:10}
+.five-superiority{width:100%;border-bottom:1px solid #27aede;padding:10px 0 20px}
+.five-superiority-list li{float:left;width:20%;height:36px;text-align:center;border-left:1px solid #27aede}
+.five-superiority-list li:first-child{border-left:none}
+.five-superiority-list li a{display:inline-block;position:relative;width:100%;height:36px;line-height:36px;background:no-repeat 2% center;text-indent:2em;color:#fff;font-size:16px}
+.five-superiority-list li a:hover{color:#bfe7f5}
+.five-superiority-list li a.superiority-text{text-indent:4em}
+.compensate_ico .superiority-icon{background-position:0 0}
+.compensate_ico:hover .superiority-icon{background-position:0 -50px}
+.retreat_ico .superiority-icon{background-position:0 -100px}
+.retreat_ico:hover .superiority-icon{background-position:0 -150px}
+.technology_ico .superiority-icon{background-position:0 -200px}
+.technology_ico:hover .superiority-icon{background-position:0 -250px}
+.prepare_ico .superiority-icon{background-position:0 -300px}
+.prepare_ico:hover .superiority-icon{background-position:0 -350px}
+.service_ico .superiority-icon{background-position:0 -400px}
+.service_ico:hover .superiority-icon{background-position:0 -450px}
+.marquee-box{overflow:hidden;width:100%;position:absolute;left:0;top:0}
+.marquee{width:8000%;height:60px}
+.wave-list-box{float:left}
+.wave-list-box ul{float:left;height:60px;overflow:hidden;zoom:1}
+.wave-list-box ul li{height:60px;width:100%;float:left;line-height:30px;list-style:none}
+.wave-box{position:relative;height:60px;background:#fff}
+
diff --git a/static/css/style.css b/static/css/style.css
new file mode 100644
index 0000000..01f0f7c
--- /dev/null
+++ b/static/css/style.css
@@ -0,0 +1,66 @@
+*{margin:0;padding:0;box-sizing:border-box;list-style:none}
+html{height: 100%; width:100%}
+body{font-family:"Microsoft Yahei";min-width:1000px}
+a{outline:0;text-decoration:none}
+strong{font-weight:400}
+.strong{font-weight:700}
+::selection{background:#1EACDF;color:#fff}
+img{border:0}
+::-moz-selection{background:#1EACDF;color:#fff}
+::-webkit-selection{background:#1EACDF;color:#fff}
+.autoWidth{margin:0 auto;min-width:1000px;max-width:1200px}
+.auto{margin:0 auto;min-width:1000px;max-width:1200px}
+@media screen and (max-width:1233px){.auto{padding-left:10px}
+}
+.clearfix:after,.clearfix:before{display:table;line-height:0;content:""}
+.clearfix:after{clear:both}
+.clear-float{clear:both}
+
+
+
+.footer{background-color:#009fd9;font-family:"Microsoft Yahei"}
+.footer-floor1{width:100%;padding:36px 0 60px}
+.footer-list{width:69%;height:100%;float:left}
+.footer-list ul{float:left;margin-right:13%}
+.footer-list .flist-4{margin-right:0}
+.footer-list li{line-height:32px}
+.footer-list li a{color:#b6e2f2;font-size:12px;text-decoration:none}
+.footer-list li a:hover{text-decoration:underline;color:#fff}
+.footer-list .flist-title{font-size:16px;color:#fff;margin-bottom:15px}
+.footer-floor2{width:100%;border-top:1px solid #4cc3ed;padding:20px 0;text-align:center}
+.footer-floor2 p{text-align:center;color:#b6e2f2;font-size:12px;line-height:30px}
+.footer-floor2 p span{font-family:PingFangSC-Light,'helvetica neue','hiragino sans gb',tahoma,'microsoft yahei ui','microsoft yahei',simsun,sans-serif}
+.footer-floor2 a{color:#b6e2f2}
+.footer-floor2 a:hover{color:#a8d0e0;text-decoration:underline}
+.foot-link{margin:0 15px;text-decoration:none;color:#b6e2f2}
+.foot-link:hover{text-decoration:underline}
+.footer-right{width:300px;float:right}
+.official-plat{width:100%;height:100%;margin-top:20px;position:relative}
+.official-plat ul{float:right;margin-top:7px}
+.official-plat ul li{height:45px}
+.official-plat ul a{display:inline-block;height:32px;width:100%;line-height:32px;color:#fff;text-decoration:none;font-size:12px}
+.official-plat>p{display:inline-block;width:132px;height:132px;border:1px solid #ddd;background-color:#fff}
+#wx-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:12px;right:-20px;z-index:10}
+#wb-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:58px;right:-20px;z-index:10}
+.five-superiority{width:100%;border-bottom:1px solid #27aede;padding:10px 0 20px}
+.five-superiority-list li{float:left;width:20%;height:36px;text-align:center;border-left:1px solid #27aede}
+.five-superiority-list li:first-child{border-left:none}
+.five-superiority-list li a{display:inline-block;position:relative;width:100%;height:36px;line-height:36px;background:no-repeat 2% center;text-indent:2em;color:#fff;font-size:16px}
+.five-superiority-list li a:hover{color:#bfe7f5}
+.five-superiority-list li a.superiority-text{text-indent:4em}
+.compensate_ico .superiority-icon{background-position:0 0}
+.compensate_ico:hover .superiority-icon{background-position:0 -50px}
+.retreat_ico .superiority-icon{background-position:0 -100px}
+.retreat_ico:hover .superiority-icon{background-position:0 -150px}
+.technology_ico .superiority-icon{background-position:0 -200px}
+.technology_ico:hover .superiority-icon{background-position:0 -250px}
+.prepare_ico .superiority-icon{background-position:0 -300px}
+.prepare_ico:hover .superiority-icon{background-position:0 -350px}
+.service_ico .superiority-icon{background-position:0 -400px}
+.service_ico:hover .superiority-icon{background-position:0 -450px}
+.marquee-box{overflow:hidden;width:100%;position:absolute;left:0;top:0}
+.marquee{width:8000%;height:60px}
+.wave-list-box{float:left}
+.wave-list-box ul{float:left;height:60px;overflow:hidden;zoom:1}
+.wave-list-box ul li{height:60px;width:100%;float:left;line-height:30px;list-style:none}
+.wave-box{position:relative;height:60px;background:#fff}
diff --git a/static/img/favicon.ico b/static/img/favicon.ico
new file mode 100644
index 0000000..c09b46f
Binary files /dev/null and b/static/img/favicon.ico differ
diff --git a/static/img/icon.jpg b/static/img/icon.jpg
new file mode 100644
index 0000000..e9b263c
Binary files /dev/null and b/static/img/icon.jpg differ
diff --git a/static/img/logo.jpg b/static/img/logo.jpg
new file mode 100644
index 0000000..46e17ea
Binary files /dev/null and b/static/img/logo.jpg differ
diff --git a/static/img/mima-icon.jpg b/static/img/mima-icon.jpg
new file mode 100644
index 0000000..b390cbd
Binary files /dev/null and b/static/img/mima-icon.jpg differ
diff --git a/static/img/unlock.jpg b/static/img/unlock.jpg
new file mode 100644
index 0000000..791043a
Binary files /dev/null and b/static/img/unlock.jpg differ
diff --git a/static/img/user-icon.jpg b/static/img/user-icon.jpg
new file mode 100644
index 0000000..2214068
Binary files /dev/null and b/static/img/user-icon.jpg differ
diff --git a/static/js/bubbly-bg.js b/static/js/bubbly-bg.js
new file mode 100644
index 0000000..b7a7527
--- /dev/null
+++ b/static/js/bubbly-bg.js
@@ -0,0 +1 @@
+"use strict";window.bubbly=function(t){var n=t||{},o=function(){return Math.random()},r=n.canvas||document.createElement("canvas"),e=r.width,a=r.height;null===r.parentNode&&(r.setAttribute("style","position:fixed;z-index:-1;left:0;top:0;min-width:100vw;min-height:100vh;"),e=r.width=window.innerWidth,a=r.height=window.innerHeight,document.body.appendChild(r));var i=r.getContext("2d");i.shadowColor=n.shadowColor||"#fff",i.shadowBlur=n.blur||4;var l=i.createLinearGradient(0,0,e,a);l.addColorStop(0,n.colorStart||"#2AE"),l.addColorStop(1,n.colorStop||"#17B");for(var c=n.bubbles||Math.floor(.02*(e+a)),u=[],d=0;de&&(t.x=-t.r),t.x+t.r<0&&(t.x=e+t.r),t.y-t.r>a&&(t.y=-t.r),t.y+t.r<0&&(t.y=a+t.r)})}()};
\ No newline at end of file
diff --git a/static/js/check.js b/static/js/check.js
new file mode 100644
index 0000000..6ce2361
--- /dev/null
+++ b/static/js/check.js
@@ -0,0 +1,85 @@
+$(function () {
+ $(".content .con_right .left").click(function (e) {
+ $(this).css({ "color": "#333333", "border-bottom": "2px solid #2e558e" });
+ $(".content .con_right .right").css({ "color": "#999999", "border-bottom": "2px solid #dedede" });
+ $(".content .con_right ul .con_r_left").css("display", "block");
+ $(".content .con_right ul .con_r_right").css("display", "none");
+ });
+
+ $(".content .con_right .right").click(function (e) {
+ $(this).css({ "color": "#333333", "border-bottom": "2px solid #2e558e" });
+ $(".content .con_right .left").css({ "color": "#999999", "border-bottom": "2px solid #dedede" });
+ $(".content .con_right ul .con_r_right").css("display", "block");
+ $(".content .con_right ul .con_r_left").css("display", "none");
+ });
+
+
+ $('#btn_modify').click(function () {
+ // ^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\%\^\&\*\(\)])[0-9a-zA-Z!@#$\%\^\&\*\(\)]{8,32}$ 要求密码了里面包含字母、数字、特殊字符。
+ // (?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30} 密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位
+ // (?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[!#@*&.])[a-zA-Z\d!#@*&.]*{8,30}$
+ // 判断密码满足大写字母,小写字母,数字和特殊字符,其中四种组合都需要包含
+ // (?=.*[0-9])(?=.*[a-zA-Z]).{8,30} 大小写字母+数字
+ regex_mail = new RegExp('^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$')
+ regex_pwd = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}');
+ if ($.trim($('#user_email').val()) === '') {
+ alert('请输入邮箱账号');
+ return false;
+ } else if (!regex_mail.test($.trim($('#user_email').val()))) {
+ alert('请输入正确的邮箱账号。\n');
+ return false;
+ } else if ($.trim($('#old_password').val()) === '') {
+ alert('请输入旧密码');
+ return false;
+ } else if ($.trim($('#new_password').val()) === '') {
+ alert('请输入新密码');
+ return false;
+ } else if ($.trim($('#new_password').val()) === '1qaz@WSX') {
+ alert('密码1qaz@WSX为初始密码,禁止使用,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
+ return false;
+ } else if (!regex_pwd.test($.trim($('#new_password').val()))) {
+ alert('密码不符合复杂度规则,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
+ return false;
+ } else if ($.trim($('#ensure_password').val()) === '') {
+ alert('请再次输入新密码');
+ return false;
+ } else if ($.trim($('#new_password').val()) === $.trim($('#old_password').val())) {
+ alert('新旧密码不能一样');
+ return false;
+ } else if ($.trim($('#ensure_password').val()) !== $.trim($('#new_password').val())) {
+ alert('两次输入的新密码不一致');
+ return false;
+ } else {
+ return true;
+ }
+ });
+
+ $('#btn_reset').click(function () {
+ let regex_mail = new RegExp('^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$')
+ let regex_pwd = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}');
+ if ($.trim($('#user_email').val()) === '') {
+ alert('请输入邮箱账号');
+ return false;
+ } else if (!regex_mail.test($.trim($('#user_email').val()))) {
+ alert('请输入正确的邮箱账号。\n');
+ return false;
+ } else if ($.trim($('#new_password').val()) === '') {
+ alert('请输入密码');
+ return false;
+ } else if ($.trim($('#ensure_password').val()) === '') {
+ alert('请再次输入新密码');
+ return false;
+ } else if ($.trim($('#new_password').val()) === '1qaz@WSX') {
+ alert('密码1qaz@WSX为初始密码,禁止使用,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
+ return false;
+ } else if (!regex_pwd.test($.trim($('#new_password').val()))) {
+ alert('密码不符合复杂度规则,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。\n例如:1qaz@WSX');
+ return false;
+ } else if ($.trim($('#ensure_password').val()) !== $.trim($('#new_password').val())) {
+ alert('两次输入的新密码不一致');
+ return false;
+ } else {
+ return true;
+ }
+ });
+})
diff --git a/static/js/ddLogin.js b/static/js/ddLogin.js
new file mode 100644
index 0000000..41abd9a
--- /dev/null
+++ b/static/js/ddLogin.js
@@ -0,0 +1,18 @@
+!function (window, document) {
+ function d(a) {
+ var e, c = document.createElement("iframe"),
+ d = "https://login.dingtalk.com/login/qrcode.htm?goto=" + a.goto ;
+ d += a.style ? "&style=" + encodeURIComponent(a.style) : "",
+ d += a.href ? "&href=" + a.href : "",
+ c.src = d,
+ c.frameBorder = "0",
+ c.allowTransparency = "true",
+ c.scrolling = "no",
+ c.width = a.width ? a.width + 'px' : "365px",
+ c.height = a.height ? a.height + 'px' : "400px",
+ e = document.getElementById(a.id),
+ e.innerHTML = "",
+ e.appendChild(c)
+ }
+ window.DDLogin = d
+}(window, document);
diff --git a/static/js/jquery-1.8.3.min.js b/static/js/jquery-1.8.3.min.js
new file mode 100644
index 0000000..3883779
--- /dev/null
+++ b/static/js/jquery-1.8.3.min.js
@@ -0,0 +1,2 @@
+/*! jQuery v1.8.3 jquery.com | jquery.org/license */
+(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="