Semi Final 7th Aug 2024
This commit is contained in:
@ -489,7 +489,23 @@ class IndexController extends GetxController with WidgetsBindingObserver {
|
||||
//
|
||||
void register(String email, String password, String password2, BuildContext context) {
|
||||
AuthService.register(email, password,password2).then((value) {
|
||||
if (value.isNotEmpty) {
|
||||
if (value is Map && value.containsKey("error")) {
|
||||
String err_message = value["error"];
|
||||
debugPrint("ユーザー登録失敗:${email}, ${password},${err_message}");
|
||||
logManager.addOperationLog("User failed to register new account : ${email} , ${password} ,${err_message}.");
|
||||
isLoading.value = false;
|
||||
Get.snackbar(
|
||||
'user_registration_failed_please_try_again'.tr, // ユーザー登録に失敗しました。
|
||||
err_message,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(seconds: 3),
|
||||
//backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}else{
|
||||
debugPrint("ユーザー登録成功:${email}, ${password}");
|
||||
logManager.addOperationLog("User tried to register new account : ${email} , ${password} .");
|
||||
|
||||
@ -508,22 +524,7 @@ class IndexController extends GetxController with WidgetsBindingObserver {
|
||||
);
|
||||
|
||||
//Navigator.pop(context);
|
||||
Get.toNamed(AppPages.INDEX);
|
||||
} else {
|
||||
debugPrint("ユーザー登録失敗:${email}, ${password}");
|
||||
logManager.addOperationLog("User failed to register new account : ${email} , ${password} .");
|
||||
isLoading.value = false;
|
||||
Get.snackbar(
|
||||
'failed'.tr, // 失敗
|
||||
'user_registration_failed_please_try_again'.tr, // ユーザー登録に失敗しました。
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(seconds: 3),
|
||||
//backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -36,24 +36,50 @@ class _IndexPageState extends State<IndexPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
//checkEntryAndShowHelper();
|
||||
//checkLoginAndShowDialog();
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
void checkEntryAndShowHelper() async {
|
||||
final hasEntry = await checkIfUserHasEntry(); // この関数は実装する必要があります
|
||||
if (!hasEntry) {
|
||||
showHelperDialog(
|
||||
context,
|
||||
'イベントに参加するには、チーム登録・メンバー登録及びエントリーが必要になります。',
|
||||
'entry_helper',
|
||||
showDoNotShowAgain: true,
|
||||
void checkLoginAndShowDialog() {
|
||||
if (indexController.currentUser.isEmpty) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('ログインが必要です'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('1) ログインされていません。ロゲに参加するにはログインが必要です。'),
|
||||
SizedBox(height: 10),
|
||||
Text('2) ログイン後、個人情報入力、チーム登録、エントリー登録を行なってください。'),
|
||||
SizedBox(height: 10),
|
||||
Text('3) エントリー登録は場所と日にちごとに行なってください。'),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text('キャンセル'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text('ログイン'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// class IndexPage extends GetView<IndexController> {
|
||||
// IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
Reference in New Issue
Block a user