1 /* 2 * Copyright 2023, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef PASSWORD_REQUIREMENTS_H 6 #define PASSWORD_REQUIREMENTS_H 7 8 9 #include <Archivable.h> 10 #include <String.h> 11 12 13 /*! When a user enters their password there are requirements around that 14 password such as the length of the password in characters as well as 15 how many digits it must contain. This class models those 16 requirements so that they can be conveyed to the user in the UI. 17 */ 18 19 class PasswordRequirements : public BArchivable { 20 public: 21 PasswordRequirements(BMessage* from); 22 PasswordRequirements(); 23 virtual ~PasswordRequirements(); 24 25 const uint32 MinPasswordLength() const 26 { return fMinPasswordLength; } 27 const uint32 MinPasswordUppercaseChar() const 28 { return fMinPasswordUppercaseChar; } 29 const uint32 MinPasswordDigitsChar() const 30 { return fMinPasswordDigitsChar; } 31 32 void SetMinPasswordLength(uint32 value); 33 void SetMinPasswordUppercaseChar(uint32 value); 34 void SetMinPasswordDigitsChar(uint32 value); 35 36 status_t Archive(BMessage* into, bool deep = true) const; 37 private: 38 uint32 fMinPasswordLength; 39 uint32 fMinPasswordUppercaseChar; 40 uint32 fMinPasswordDigitsChar; 41 }; 42 43 #endif // PASSWORD_REQUIREMENTS_H 44