Skip to content

Commit

Permalink
Rest of revert
Browse files Browse the repository at this point in the history
  • Loading branch information
who-biz committed Jan 8, 2020
1 parent af5db9c commit 36ce3e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 1 addition & 3 deletions build_snap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ fi
# build libwallet
${SNAPCRAFT_PART_SRC}/get_libwallet_api.sh $BUILD_TYPE

if [ "$DISABLE_PASS_STRENGTH_METER" != true ]; then
$MAKE -C ${SNAPCRACFT_PART_SRC}/src/zxcvbn-c || exit
fi
make -C '${SNAPCRACFT_PART_SRC}/src/zxcvbn-c'

if [ ! -d build ]; then mkdir build; fi

Expand Down
18 changes: 18 additions & 0 deletions src/libwalletqt/WalletManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "WalletManager.h"
#include "Wallet.h"
#include "wallet/api/wallet2_api.h"
#include "zxcvbn-c/zxcvbn.h"
#include "QRCodeImageProvider.h"
#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -301,6 +302,23 @@ QUrl WalletManager::localPathToUrl(const QString &path) const
return QUrl::fromLocalFile(path);
}

#ifndef DISABLE_PASS_STRENGTH_METER
double WalletManager::getPasswordStrength(const QString &password) const
{
static const char *local_dict[] = {
"monero", "fluffypony", NULL
};

if (!ZxcvbnInit("zxcvbn.dict")) {
fprintf(stderr, "Failed to open zxcvbn.dict\n");
return 0.0;
}
double e = ZxcvbnMatch(password.toStdString().c_str(), local_dict, NULL);
ZxcvbnUnInit();
return e;
}
#endif

bool WalletManager::saveQrCode(const QString &code, const QString &path) const
{
QSize size;
Expand Down

0 comments on commit 36ce3e4

Please sign in to comment.