Fix OTP errors

This commit is contained in:
J-Jamet
2019-11-10 14:31:21 +01:00
parent f63d6bdc1d
commit 59e5865318
2 changed files with 5 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ class SetOTPDialogFragment : DialogFragment() {
false false
} }
private var mSecretWellFormed = true private var mSecretWellFormed = false
private var mCounterWellFormed = true private var mCounterWellFormed = true
private var mPeriodWellFormed = true private var mPeriodWellFormed = true
private var mDigitsWellFormed = true private var mDigitsWellFormed = true

View File

@@ -148,7 +148,7 @@ object OtpEntryFields {
try { try {
otpElement.setBase32Secret(secretParam) otpElement.setBase32Secret(secretParam)
} catch (exception: Exception) { } catch (exception: Exception) {
otpElement.setBase32Secret("") Log.e(TAG, "Unable to retrieve OTP secret.", exception)
} }
} }
@@ -161,6 +161,7 @@ object OtpEntryFields {
otpElement.digits = try { otpElement.digits = try {
digitsParam.toIntOrNull() ?: OTP_DEFAULT_DIGITS digitsParam.toIntOrNull() ?: OTP_DEFAULT_DIGITS
} catch (exception: Exception) { } catch (exception: Exception) {
Log.e(TAG, "Unable to retrieve OTP digits.", exception)
OTP_DEFAULT_DIGITS OTP_DEFAULT_DIGITS
} }
@@ -169,6 +170,7 @@ object OtpEntryFields {
otpElement.counter = try { otpElement.counter = try {
counterParam.toLongOrNull() ?: HOTP_INITIAL_COUNTER counterParam.toLongOrNull() ?: HOTP_INITIAL_COUNTER
} catch (exception: Exception) { } catch (exception: Exception) {
Log.e(TAG, "Unable to retrieve HOTP counter.", exception)
HOTP_INITIAL_COUNTER HOTP_INITIAL_COUNTER
} }
@@ -177,6 +179,7 @@ object OtpEntryFields {
otpElement.period = try { otpElement.period = try {
stepParam.toIntOrNull() ?: TOTP_DEFAULT_PERIOD stepParam.toIntOrNull() ?: TOTP_DEFAULT_PERIOD
} catch (exception: Exception) { } catch (exception: Exception) {
Log.e(TAG, "Unable to retrieve TOTP period.", exception)
TOTP_DEFAULT_PERIOD TOTP_DEFAULT_PERIOD
} }