freeotp / freeotp-ios

Apache License 2.0
687 stars 174 forks source link

Fix missing issuer in QR URI causing duplicate tokens #380

Open falghamdi125 opened 5 days ago

falghamdi125 commented 5 days ago

Hello,

Resolves: #379

Issue analysis:

Assuming the issuer is missing in the URI. The issuer prompt view will be pushed into the secne. And when the user clicks next The below code will warn the user and process the form. image Here, we can see if the user clicks "use empty issuer" the app will process the form. image

The form is processed twice (Could be more if the user clicks cancel and repeat) according to the logic above.

The fix is simple:

Now submitForm is called only in two cases. One if the issuer is entered or if the user use empty issuer where submitForm is called inside the function.

image