#include <password.h>
|
| static boost::optional< login > | parse (std::string &&userpass, bool verify, const std::function< boost::optional< password_container >(bool)> &prompt) |
Definition at line 72 of file password.h.
◆ login() [1/3]
◆ login() [2/3]
| tools::login::login |
( |
const login & | | ) |
|
|
delete |
◆ login() [3/3]
| tools::login::login |
( |
login && | | ) |
|
|
default |
◆ ~login()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ parse()
| boost::optional< login > tools::login::parse |
( |
std::string && | userpass, |
|
|
bool | verify, |
|
|
const std::function< boost::optional< password_container >(bool)> & | prompt ) |
|
static |
Extracts username and password from the format username:password. A blank username or password is allowed. If the : character is not present, password_container::prompt will be called by forwarding the verify and message arguments.
- Parameters
-
- Returns
- The username and password, or boost::none if password_container::prompt fails.
Definition at line 268 of file password.cpp.
269 {
271
272 const auto loc = userpass.find(':');
273 if (loc == std::string::npos)
274 {
275 auto result = prompt(verify);
276 if (!result)
277 return boost::none;
278
279 out.password = std::move(*result);
280 }
281 else
282 {
283 out.password = password_container{userpass.substr(loc + 1)};
284 }
285
286 out.username = userpass.substr(0, loc);
287 password_container wipe{std::move(userpass)};
288 return {std::move(out)};
289 }
◆ password
◆ username
| std::string tools::login::username |
The documentation for this struct was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/password.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/password.cpp