diff --git a/app/TwoFAccount.php b/app/TwoFAccount.php
index b995b097..1fbea365 100644
--- a/app/TwoFAccount.php
+++ b/app/TwoFAccount.php
@@ -291,7 +291,7 @@ public function populate(Array $attrib = [])
// The Type and Secret attributes are mandatory
// All other attributes have default value set by OTPHP
- if( strcasecmp($attrib['otpType'], 'totp') == 0 && strcasecmp($attrib['otpType'], 'hotp') == 0 ) {
+ if( $attrib['otpType'] !== 'totp' && $attrib['otpType'] !== 'hotp' ) {
throw \Illuminate\Validation\ValidationException::withMessages([
'otpType' => __('errors.not_a_supported_otp_type')
]);
@@ -307,7 +307,7 @@ public function populate(Array $attrib = [])
// Create an OTP object using our secret but with default parameters
$secret = $attrib['secretIsBase32Encoded'] === 1 ? $attrib['secret'] : Encoding::base32EncodeUpper($attrib['secret']);
- $this->otp = strtolower($attrib['otpType']) === 'totp' ? TOTP::create($secret) : HOTP::create($secret);
+ $this->otp = $attrib['otpType'] === 'totp' ? TOTP::create($secret) : HOTP::create($secret);
// and we change parameters if needed
if (array_key_exists('service', $attrib) && $attrib['service']) {
diff --git a/resources/js/components/TokenDisplayer.vue b/resources/js/components/TokenDisplayer.vue
index d4f78303..8d6201de 100644
--- a/resources/js/components/TokenDisplayer.vue
+++ b/resources/js/components/TokenDisplayer.vue
@@ -77,18 +77,11 @@
// - Trigger when user use the Advanced form and preview the account: We should have all OTP parameter
// to obtain a token, including Secret and otpType which are required
- try {
- this.internal_otpType = this.otpType.toLowerCase()
- }
- catch(e) {
- //do nothing
- }
- finally {
- this.internal_account = this.account
- this.internal_service = this.service
- this.internal_icon = this.icon
- this.internal_hotpCounter = this.hotpCounter
- }
+ this.internal_service = this.service
+ this.internal_account = this.account
+ this.internal_icon = this.icon
+ this.internal_otpType = this.otpType
+ this.internal_hotpCounter = this.hotpCounter
if( id ) {
diff --git a/resources/js/views/twofaccounts/Create.vue b/resources/js/views/twofaccounts/Create.vue
index bccdeac9..3961ce32 100644
--- a/resources/js/views/twofaccounts/Create.vue
+++ b/resources/js/views/twofaccounts/Create.vue
@@ -79,7 +79,7 @@