mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
account: check if password is valid
Change-Id: Ice7459ba421c28f72c05bfda5283b733acef4695
This commit is contained in:
@ -251,6 +251,12 @@ sendRegister(const std::string& accountID, bool enable)
|
||||
jami::Manager::instance().sendRegister(accountID, enable);
|
||||
}
|
||||
|
||||
bool
|
||||
isPasswordValid(const std::string& accountID, const std::string& password)
|
||||
{
|
||||
return jami::Manager::instance().isPasswordValid(accountID, password);
|
||||
}
|
||||
|
||||
void
|
||||
registerAllAccounts()
|
||||
{
|
||||
|
@ -65,6 +65,7 @@ DRING_PUBLIC bool exportToFile(const std::string& accountID, const std::string&
|
||||
DRING_PUBLIC bool revokeDevice(const std::string& accountID, const std::string& password, const std::string& deviceID);
|
||||
DRING_PUBLIC std::map<std::string, std::string> getKnownRingDevices(const std::string& accountID);
|
||||
DRING_PUBLIC bool changeAccountPassword(const std::string& accountID, const std::string& password_old, const std::string& password_new);
|
||||
DRING_PUBLIC bool isPasswordValid(const std::string& accountID, const std::string& password);
|
||||
|
||||
DRING_PUBLIC bool lookupName(const std::string& account, const std::string& nameserver, const std::string& name);
|
||||
DRING_PUBLIC bool lookupAddress(const std::string& account, const std::string& nameserver, const std::string& address);
|
||||
|
@ -121,6 +121,8 @@ public:
|
||||
|
||||
virtual void syncDevices() = 0;
|
||||
|
||||
virtual bool isPasswordValid(const std::string& password) {};
|
||||
|
||||
dht::crypto::Identity loadIdentity(const std::string& crt_path, const std::string& key_path, const std::string& key_pwd) const;
|
||||
|
||||
const AccountInfo* useIdentity(
|
||||
|
@ -673,6 +673,17 @@ ArchiveAccountManager::exportArchive(const std::string& destinationPath, const s
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ArchiveAccountManager::isPasswordValid(const std::string& password)
|
||||
{
|
||||
try {
|
||||
readArchive(password);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_RINGNS
|
||||
void
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
void addDevice(const std::string& password, AddDeviceCallback) override;
|
||||
bool revokeDevice(const std::string& password, const std::string& device, RevokeDeviceCallback) override;
|
||||
bool exportArchive(const std::string& destinationPath, const std::string& password);
|
||||
bool isPasswordValid(const std::string& password) override;
|
||||
|
||||
#if HAVE_RINGNS
|
||||
/*void lookupName(const std::string& name, LookupCallback cb) override;
|
||||
@ -97,4 +98,4 @@ private:
|
||||
std::string archivePath_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -971,6 +971,12 @@ JamiAccount::changeArchivePassword(const std::string& password_old, const std::s
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
JamiAccount::isPasswordValid(const std::string& password)
|
||||
{
|
||||
return accountManager_->isPasswordValid(password);
|
||||
}
|
||||
|
||||
void
|
||||
JamiAccount::addDevice(const std::string& password)
|
||||
{
|
||||
|
@ -331,6 +331,8 @@ public:
|
||||
bool revokeDevice(const std::string& password, const std::string& device);
|
||||
std::map<std::string, std::string> getKnownDevices() const;
|
||||
|
||||
bool isPasswordValid(const std::string& password);
|
||||
|
||||
bool changeArchivePassword(const std::string& password_old, const std::string& password_new);
|
||||
|
||||
void connectivityChanged() override;
|
||||
|
@ -2933,6 +2933,15 @@ Manager::sendRegister(const std::string& accountID, bool enable)
|
||||
acc->doUnregister();
|
||||
}
|
||||
|
||||
bool
|
||||
Manager::isPasswordValid(const std::string& accountID, const std::string& password)
|
||||
{
|
||||
const auto acc = getAccount<JamiAccount>(accountID);
|
||||
if (!acc)
|
||||
return false;
|
||||
return acc->isPasswordValid(password);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
Manager::sendTextMessage(const std::string& accountID, const std::string& to,
|
||||
const std::map<std::string, std::string>& payloads)
|
||||
|
@ -388,6 +388,8 @@ class DRING_TESTABLE Manager {
|
||||
*/
|
||||
void sendRegister(const std::string& accountId, bool enable);
|
||||
|
||||
bool isPasswordValid(const std::string& accountID, const std::string& password);
|
||||
|
||||
uint64_t sendTextMessage(const std::string& accountID, const std::string& to,
|
||||
const std::map<std::string, std::string>& payloads);
|
||||
|
||||
|
Reference in New Issue
Block a user