-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deriv_auth): fix 2fa for social login (#418)
* fix(deriv_auth): fix 2fa for social login * docs: update layout documentation * chore(deriv_auth): sort imports
- Loading branch information
1 parent
1f6eb85
commit 5a1001c
Showing
3 changed files
with
178 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
## Deriv Auth Layouts | ||
|
||
### - Get Started Flow | ||
- **Get Started Layout** | ||
``` dart | ||
DerivGetStartedLayout( | ||
slides: [ | ||
// List of instances of DerivGetStartedSlideModel | ||
], | ||
appLogoIconPath: appLogoIconPath, | ||
backgroundImagePath: backgroundImagePath, | ||
onLoginTapped: () {}, | ||
onSignupTapped: () {}, | ||
); | ||
``` | ||
### - Login Flow | ||
- **Login Layout** | ||
``` dart | ||
DerivLoginLayout( | ||
welcomeLabel: 'Welcome back!', | ||
greetingLabel: | ||
'Log in to your Deriv account to start trading and investing.', | ||
onResetPassTapped: () { | ||
// Navigate to reset password page | ||
}, | ||
onSignupTapped: () { | ||
// Navigate to signup page | ||
}, | ||
onLoginError: (DerivAuthErrorState error) { | ||
// Show error message | ||
}, | ||
onLoggedIn: (DerivAuthLoggedInState state) { | ||
// Navigate to home page | ||
}, | ||
onSocialAuthButtonPressed: (SocialAuthProvider provider) { | ||
// Handle social auth | ||
}, | ||
); | ||
``` | ||
- **2FA Layout** | ||
``` dart | ||
// For 2FA with email and password | ||
Deriv2FALayout.systemLogin( | ||
email: email, | ||
password: password, | ||
); | ||
// For 2FA with social auth | ||
Deriv2FALayout.socialLogin( | ||
socialAuthDto: socialAuthDto, | ||
); | ||
// For 2FA with oneAll social login | ||
Deriv2FALayout.oneAll( | ||
oneAllConnectionToken: oneAllConnectionToken, | ||
); | ||
``` | ||
### - Signup Flow | ||
- **Signup Layout** | ||
``` dart | ||
DerivSignupLayout( | ||
signupPageLabel: 'Start trading with Deriv', | ||
signupPageDescription: | ||
'Join over 1 million traders worldwide who loves trading at Deriv.', | ||
onSocialAuthButtonPressed: (SocialAuthProvider provider) {}, | ||
onSingupError: (DerivSignupErrorState error) {}, | ||
onSingupEmailSent: (String email) {}, | ||
onSignupPressed: () {}, | ||
onLoginTapped: () {}, | ||
); | ||
``` | ||
- **Verify Email Layout** | ||
``` dart | ||
DerivVerifyEmailLayout( | ||
email: email, | ||
onEmailNotReceivedPressed: () {}, | ||
); | ||
``` | ||
- **Email not received layout** | ||
``` dart | ||
DerivEmailNotReceivedLayout( | ||
onReEnterEmailPressed: () {}, | ||
); | ||
``` | ||
- **Verification Done Layout** | ||
``` dart | ||
DerivVerificationDoneLayout( | ||
verificationCode: '123456', | ||
onContinuePressed: () {}, | ||
); | ||
``` | ||
- **Country Selection Layout** | ||
``` dart | ||
DerivCountrySelectionLayout( | ||
onNextPressed: () {}, | ||
verificationCode: '123456', | ||
residences: residences, | ||
); | ||
``` | ||
- **Set Password Layout** | ||
``` dart | ||
DerivSetPasswordLayout( | ||
onDerivAuthState: (BuildContext, DerivAuthState) {}, | ||
onDerivSignupState: (BuildContext, DerivSignupState) {}, | ||
onPreviousPressed: () {}, | ||
verificationCode: '123456', | ||
residence: 'residence', | ||
); | ||
``` | ||
### - Reset Password Flow | ||
- **Reset Password Layout** | ||
``` dart | ||
DerivResetPassLayout( | ||
onResetPassError: (String? error) {}, | ||
), | ||
``` | ||
- **Choose New Password Layout** | ||
``` dart | ||
DerivChooseNewPassLayout( | ||
onResetPassError: (String? error) {}, | ||
onResetPassSucceed: () {}, | ||
token: token, | ||
), | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters