Created
August 26, 2022 15:15
-
-
Save salihgueler/cf5aa8876339b686c18f0af5bdf063cf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Future<void> _confirmEmailAddress() async { | |
try { | |
await Amplify.Auth.confirmUserAttribute( | |
userAttributeKey: CognitoUserAttributeKey.email, | |
confirmationCode: _confirmationCodeController.text, | |
); | |
setState(() { | |
_isLoading = false; | |
}); | |
if(mounted) { | |
context.go('/home'); | |
} | |
} on CodeMismatchException { | |
setState(() { | |
_isLoading = false; | |
_errorMessage = 'The confirmation code is wrong. Please enter it again.'; | |
}); | |
} on Exception catch(error) { | |
setState(() { | |
_isLoading = false; | |
_errorMessage = 'An unexpected error has happened. Check the logs for detail'; | |
}); | |
logger.error(error.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment