xref: /haiku/src/apps/haikudepot/model/UserCredentials.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2019, Andrew Lindesay <apl@lindesay.co.nz>.
3  *
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef USER_CREDENTIALS_H
7 #define USER_CREDENTIALS_H
8 
9 
10 #include <Archivable.h>
11 #include <String.h>
12 
13 
14 /*!	This object represents the tuple of the user's nickname (username) and
15 	password.  It also carries a boolean that indicates if an authentication
16 	with these credentials was successful or failed.
17 */
18 
19 class UserCredentials : public BArchivable {
20 public:
21 								UserCredentials(BMessage* from);
22 								UserCredentials(const BString& nickname,
23 									const BString& passwordClear);
24 								UserCredentials(const UserCredentials& other);
25 								UserCredentials();
26 	virtual						~UserCredentials();
27 
28 	const	BString&			Nickname() const;
29 	const	BString&			PasswordClear() const;
30 	const	bool				IsSuccessful() const;
31 	const	bool				IsValid() const;
32 
33 			void				SetNickname(const BString& value);
34 			void				SetPasswordClear(const BString& value);
35 			void				SetIsSuccessful(bool value);
36 
37 			UserCredentials&	operator=(const UserCredentials& other);
38 
39 			status_t			Archive(BMessage* into, bool deep = true) const;
40 private:
41 			BString				fNickname;
42 			BString				fPasswordClear;
43 			bool				fIsSuccessful;
44 };
45 
46 
47 #endif // USER_CREDENTIALS_H
48