Passwords
This guide describes how to save, update, and manage passwords the user enters in a new form online.
Overview
Chromium has a built-in functionality that remembering the credentials when a user submits a new form with the username and password. It works as long as the web form autofill is enabled.
To access and manage all saved passwords, use Passwords
:
auto passwordStore = profile->passwords();
Managing Passwords
Each element in the password store is represented by PasswordRecord
. It contains the
user’s login and a URL of a web page where the form was submitted. It doesn’t store the password itself.
To read all saved records use:
std::vector<PasswordRecord> records = passwords->saved();
for (auto record : records) {
std::cout << record.url << std::endl;
std::cout << record.login << std::endl;
}
To read records that were marked as “never save”, use:
std::vector<PasswordRecord> records = passwords->neverSaved();
To remove records associated with a specific URL use:
passwords->removeByUrl("<url>");
To remove all records from the store use:
passwords->clear();
On this page