Skip to content

Commit

Permalink
Remove spaces from secret in TOTP URI.
Browse files Browse the repository at this point in the history
As suggested by @yan12125 in PR #1001's discussion.
  • Loading branch information
adolfogc committed Nov 12, 2017
1 parent 66d1574 commit db5ca1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/totp/totp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ QUrl QTotp::generateOtpString(const QString& secret,
keyUri.setHost(type);
keyUri.setPath(QString("/%1:%2").arg(issuer).arg(username));
QUrlQuery parameters;
parameters.addQueryItem("secret", secret);
auto trimmedSecret(secret);
parameters.addQueryItem("secret", trimmedSecret.replace(" ", ""));
parameters.addQueryItem("issuer", issuer);
parameters.addQueryItem("algorithm", algorithm);
parameters.addQueryItem("digits", QString::number(digits));
Expand Down

0 comments on commit db5ca1d

Please sign in to comment.