Implementation
void onTapResetPassword(BuildContext context) async {
final String username = usernameController.text.trim();
final String newPassword = newPasswordController.text.trim();
final String confirmationCode = confirmationCodeController.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 {
await Amplify.Auth.confirmResetPassword(username: username, newPassword: newPassword, confirmationCode: confirmationCode);
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "성공", "content": "비밀번호 재설정에 성공했습니다."},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => route.settings.name == SplashScreen.routeName);
Navigator.of(context, rootNavigator: true).pushNamed(SignInScreen.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));
}));
}
}