Implementation
Future<void> onTapSendConfirmationCode(BuildContext context) async {
final String username = usernameController.text.trim();
if (username.isEmpty) {
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "오류", "content": "아이디를 입력하세요."},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
}));
return;
}
try {
// SignUpResult result = await Amplify.Auth.confirmSignUp(username: username, confirmationCode: code);
ResetPasswordResult result = await Amplify.Auth.resetPassword(
username: username,
);
isPasswordReset = result.isPasswordReset;
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "인증코드 발송", "content": "휴대폰으로 발송된 인증코드를 확인해주세요."},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
}));
} on AuthException catch (e) {
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "오류", "content": e.message},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
}));
}
}