✨ Handle risk detection
This commit is contained in:
parent
bef3221e2f
commit
9fa666d0b8
@ -3,9 +3,11 @@
|
|||||||
"explore": "Explore",
|
"explore": "Explore",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"account": "Account",
|
"account": "Account",
|
||||||
|
"riskDetection": "Risk Detection",
|
||||||
"signIn": "Sign In",
|
"signIn": "Sign In",
|
||||||
"signInCaption": "Sign in to create post, start a realm, message your friend and more!",
|
"signInCaption": "Sign in to create post, start a realm, message your friend and more!",
|
||||||
"signInRequired": "Sign in required",
|
"signInRequired": "Sign in required",
|
||||||
|
"signInRiskDetected": "Risk detected, click Next to open a webpage and signin through it to pass security check.",
|
||||||
"signUp": "Sign Up",
|
"signUp": "Sign Up",
|
||||||
"signUpCaption": "Create an account on Solarpass and then get the access of entire Solar Networks!",
|
"signUpCaption": "Create an account on Solarpass and then get the access of entire Solar Networks!",
|
||||||
"poweredBy": "Powered by Project Hydrogen",
|
"poweredBy": "Powered by Project Hydrogen",
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
"explore": "探索",
|
"explore": "探索",
|
||||||
"chat": "聊天",
|
"chat": "聊天",
|
||||||
"account": "账号",
|
"account": "账号",
|
||||||
|
"riskDetection": "风险监测",
|
||||||
"signIn": "登陆",
|
"signIn": "登陆",
|
||||||
"signInCaption": "登陆以发表帖子、文章、创建领域、和你的朋友聊天,以及获取更多功能!",
|
"signInCaption": "登陆以发表帖子、文章、创建领域、和你的朋友聊天,以及获取更多功能!",
|
||||||
"signInRequired": "请先登陆",
|
"signInRequired": "请先登陆",
|
||||||
|
"signInRiskDetected": "检测到风险,点击下一步按钮来打开一个网页,并通过在其上面登陆来通过安全检查。",
|
||||||
"signUp": "注册",
|
"signUp": "注册",
|
||||||
"signUpCaption": "在 Solarpass 注册一个账号以获得整个 Solar Networks 的存取权!",
|
"signUpCaption": "在 Solarpass 注册一个账号以获得整个 Solar Networks 的存取权!",
|
||||||
"poweredBy": "由 Project Hydrogen 强力驱动",
|
"poweredBy": "由 Project Hydrogen 强力驱动",
|
||||||
|
@ -3,7 +3,9 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
|
import 'package:solian/utils/service_url.dart';
|
||||||
import 'package:solian/widgets/indent_wrapper.dart';
|
import 'package:solian/widgets/indent_wrapper.dart';
|
||||||
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class SignInScreen extends StatelessWidget {
|
class SignInScreen extends StatelessWidget {
|
||||||
final _usernameController = TextEditingController();
|
final _usernameController = TextEditingController();
|
||||||
@ -59,9 +61,33 @@ class SignInScreen extends StatelessWidget {
|
|||||||
auth.signin(context, username, password).then((_) {
|
auth.signin(context, username, password).then((_) {
|
||||||
router.pop(true);
|
router.pop(true);
|
||||||
}).catchError((e) {
|
}).catchError((e) {
|
||||||
|
List<String> messages = e.toString().split('\n');
|
||||||
|
if (messages.last.contains("risk")) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context)!.riskDetection),
|
||||||
|
content: Text(AppLocalizations.of(context)!.signInRiskDetected),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(AppLocalizations.of(context)!.next),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(getRequestUri('passport', '/sign-in').toString());
|
||||||
|
if (Navigator.canPop(context)) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
content: Text(e.toString()),
|
content: Text(messages.last),
|
||||||
));
|
));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user