| 1 | #ifndef CHKPASS_HH |
| 2 | #define CHKPASS_HH |
| 3 | |
| 4 | #include <FL/Fl_Button.H> |
| 5 | #include <FL/Fl_Radio_Button.H> |
| 6 | |
| 7 | #include "dialog.hh" |
| 8 | |
| 9 | #include <string> |
| 10 | |
| 11 | class Chkpass : public Dialog { |
| 12 | public: |
| 13 | Fl_Button *btn = nullptr; |
| 14 | Fl_Radio_Button *allChk = nullptr; |
| 15 | Fl_Radio_Button *lenChk = nullptr; |
| 16 | Fl_Radio_Button *charChk = nullptr; |
| 17 | Fl_Radio_Button *dupChk = nullptr; |
| 18 | bool isAll, isLen, isChar, isDup = false; |
| 19 | |
| 20 | static void dialog_cb(Fl_Widget *w, void *); |
| 21 | void showRes(); |
| 22 | void chk_cb(Fl_Widget *, void *); |
| 23 | bool exec(); |
| 24 | |
| 25 | private: |
| 26 | int vulncount = 0; |
| 27 | int weaklencount = 0; |
| 28 | int weakcharcount = 0; |
| 29 | int duppasscount = 0; |
| 30 | |
| 31 | std::size_t minimumlen = 12; |
| 32 | std::size_t recommendlen = 64; |
| 33 | |
| 34 | std::string spchar = "!@#$%^&*()-_=+[]{}|;:'\",.<>?/\\`~"; |
| 35 | |
| 36 | void lenPass(const std::string &path, const std::string &pass, |
| 37 | const std::string &lang); |
| 38 | void charPass(const std::string &path, const std::string &pass, |
| 39 | const std::string &lang); |
| 40 | void dupPass(const std::string &path, const std::string &pass, |
| 41 | const std::string &lang); |
| 42 | static void static_ok_cb(Fl_Widget *w, void *data); |
| 43 | static void static_cancel_cb(Fl_Widget *w, void *data); |
| 44 | }; |
| 45 | #endif |