SankethBK / diaryvault

A personal diary application written in Flutter
https://play.google.com/store/apps/details?id=me.sankethbk.dairyapp
MIT License
86 stars 59 forks source link

Implement PIN based authentication - 1 #71

Closed SankethBK closed 9 months ago

SankethBK commented 11 months ago

Currently, we support email+password and fingerprint login. PIN-based authentication will help in devices that don't support fingerprint login, as typing email+password every time would be tedious.

I have broken down this into two issues since this is a relatively big feature.

1. Add "Enable PIN-based login" SwitchListTile in security settings

We store all user-based settings in UserConfigModel, add a new field isPINLoginEnabled to store the value of SwtichListTile

When user enables this switch we need to check if userId (present in UserConfigCubit) is not equal to guest_user_id. Becuase if guest users forget their PIN, there is no way to recover the data (Same check is also added to "Enable Fingeprint Login" SwitchListTile).

2. Display a popup like this to collect 4-digit PIN

Keyboard should only display numbers, add validation to check if both PINs are matching, otherwise display error in a error message. Refer passwordResetPopup, most parts of this widget can be re-used.

3, Saving the PIN

Create a new repository PINAuthRepository in lib/features/auth/data/repositories and implement savePIN in PINAuthRepository and store it in flutter_secure_storage in the form of key:value pairs, Include userId in key (eg: _PIN) so that it PIN's of two user's don't clash.

abhinavs1920 commented 11 months ago

I am working on this issue, Please assign it to me.

SankethBK commented 11 months ago

Sure @abhinavs1920

LujainAlMansoori commented 9 months ago

Hello @SankethBK, could you please assign me to this, I have experience working with this feature!

SankethBK commented 9 months ago

Sure @LujainAlMansoori

LujainAlMansoori commented 9 months ago

Hey @SankethBK this has been resolved! Please check PR #161