Electroneum
Loading...
Searching...
No Matches
tools::login Struct Reference

#include <password.h>

Collaboration diagram for tools::login:

Public Member Functions

 login ()=default
 login (const login &)=delete
 login (login &&)=default
 ~login ()=default
loginoperator= (const login &)=delete
loginoperator= (login &&)=default

Static Public Member Functions

static boost::optional< loginparse (std::string &&userpass, bool verify, const std::function< boost::optional< password_container >(bool)> &prompt)

Public Attributes

std::string username
password_container password

Detailed Description

Definition at line 72 of file password.h.

Constructor & Destructor Documentation

◆ login() [1/3]

tools::login::login ( )
default
Here is the caller graph for this function:

◆ login() [2/3]

tools::login::login ( const login & )
delete
Here is the call graph for this function:

◆ login() [3/3]

tools::login::login ( login && )
default
Here is the call graph for this function:

◆ ~login()

tools::login::~login ( )
default

Member Function Documentation

◆ operator=() [1/2]

login & tools::login::operator= ( const login & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

login & tools::login::operator= ( login && )
default
Here is the call graph for this function:

◆ 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
userpassIs "consumed", and the memory contents are wiped.
verifyis passed to password_container::prompt if necessary.
messageis passed to password_container::prompt if necessary.
Returns
The username and password, or boost::none if password_container::prompt fails.

Definition at line 268 of file password.cpp.

269 {
270 login out{};
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 }
login()=default
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ password

password_container tools::login::password

Definition at line 98 of file password.h.

◆ username

std::string tools::login::username

Definition at line 97 of file password.h.


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