mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
修改域名输错之后无法登录的bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
|
* 支持修改用户名密码(仅限使用用户名密码登录用户)
|
||||||
* 支持脚本的编辑删除
|
* 支持脚本的编辑删除
|
||||||
* 支持client_id登录之后只启用部分模块
|
* 支持client_id登录之后只启用部分模块
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ class Http {
|
|||||||
_dio = Dio(
|
_dio = Dio(
|
||||||
BaseOptions(
|
BaseOptions(
|
||||||
baseUrl: host,
|
baseUrl: host,
|
||||||
connectTimeout: 5000,
|
connectTimeout: 50000,
|
||||||
receiveTimeout: 5000,
|
receiveTimeout: 50000,
|
||||||
sendTimeout: 5000,
|
sendTimeout: 50000,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -38,6 +38,10 @@ class Http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear() {
|
||||||
|
_dio = null;
|
||||||
|
}
|
||||||
|
|
||||||
static Future<HttpResponse<T>> get<T>(
|
static Future<HttpResponse<T>> get<T>(
|
||||||
String uri,
|
String uri,
|
||||||
Map<String, String?>? json, {
|
Map<String, String?>? json, {
|
||||||
@@ -124,8 +128,9 @@ class Http {
|
|||||||
static HttpResponse<T> exceptionHandler<T>(DioError e) {
|
static HttpResponse<T> exceptionHandler<T>(DioError e) {
|
||||||
if (e.response?.statusCode == 401 && !getIt<UserInfoViewModel>().useSecretLogined) {
|
if (e.response?.statusCode == 401 && !getIt<UserInfoViewModel>().useSecretLogined) {
|
||||||
exitLogin();
|
exitLogin();
|
||||||
}
|
|
||||||
return HttpResponse(success: false, message: "没有该模块的访问权限", code: 0);
|
return HttpResponse(success: false, message: "没有该模块的访问权限", code: 0);
|
||||||
|
}
|
||||||
|
return HttpResponse(success: false, message: e.message, code: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpResponse<T> decodeResponse<T>(
|
static HttpResponse<T> decodeResponse<T>(
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class LoginPage extends ConsumerStatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _LoginPageState extends ConsumerState<LoginPage> {
|
class _LoginPageState extends ConsumerState<LoginPage> {
|
||||||
final TextEditingController _hostController =
|
final TextEditingController _hostController = TextEditingController(text: getIt<UserInfoViewModel>().host);
|
||||||
TextEditingController(text: getIt<UserInfoViewModel>().host);
|
|
||||||
final TextEditingController _userNameController = TextEditingController();
|
final TextEditingController _userNameController = TextEditingController();
|
||||||
final TextEditingController _passwordController = TextEditingController();
|
final TextEditingController _passwordController = TextEditingController();
|
||||||
final TextEditingController _cIdController = TextEditingController();
|
final TextEditingController _cIdController = TextEditingController();
|
||||||
@@ -39,8 +38,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
useSecretLogin = getIt<UserInfoViewModel>().useSecretLogined;
|
useSecretLogin = getIt<UserInfoViewModel>().useSecretLogined;
|
||||||
|
|
||||||
if (getIt<UserInfoViewModel>().userName != null &&
|
if (getIt<UserInfoViewModel>().userName != null && getIt<UserInfoViewModel>().userName!.isNotEmpty) {
|
||||||
getIt<UserInfoViewModel>().userName!.isNotEmpty) {
|
|
||||||
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
||||||
_cIdController.text = getIt<UserInfoViewModel>().userName!;
|
_cIdController.text = getIt<UserInfoViewModel>().userName!;
|
||||||
} else {
|
} else {
|
||||||
@@ -50,8 +48,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
} else {
|
} else {
|
||||||
rememberPassword = false;
|
rememberPassword = false;
|
||||||
}
|
}
|
||||||
if (getIt<UserInfoViewModel>().passWord != null &&
|
if (getIt<UserInfoViewModel>().passWord != null && getIt<UserInfoViewModel>().passWord!.isNotEmpty) {
|
||||||
getIt<UserInfoViewModel>().passWord!.isNotEmpty) {
|
|
||||||
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
||||||
_cSecretController.text = getIt<UserInfoViewModel>().passWord!;
|
_cSecretController.text = getIt<UserInfoViewModel>().passWord!;
|
||||||
} else {
|
} else {
|
||||||
@@ -181,8 +178,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
},
|
},
|
||||||
controller: _userNameController,
|
controller: _userNameController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入用户名",
|
hintText: "请输入用户名",
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
@@ -204,8 +200,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入密码",
|
hintText: "请输入密码",
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
@@ -239,8 +234,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
},
|
},
|
||||||
controller: _cIdController,
|
controller: _cIdController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入client_id",
|
hintText: "请输入client_id",
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
@@ -262,8 +256,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
controller: _cSecretController,
|
controller: _cSecretController,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入client_secret",
|
hintText: "请输入client_secret",
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
@@ -294,8 +287,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
cardKey.currentState?.toggleCard();
|
cardKey.currentState?.toggleCard();
|
||||||
WidgetsBinding.instance
|
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||||
?.addPostFrameCallback((timeStamp) {
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -319,14 +311,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
),
|
),
|
||||||
color: canClickLoginBtn()
|
color: canClickLoginBtn() ? ref.watch(themeProvider).themeColor.buttonBgColor() : Theme.of(context).primaryColor.withOpacity(0.4),
|
||||||
? ref
|
|
||||||
.watch(themeProvider)
|
|
||||||
.themeColor
|
|
||||||
.buttonBgColor()
|
|
||||||
: Theme.of(context)
|
|
||||||
.primaryColor
|
|
||||||
.withOpacity(0.4),
|
|
||||||
child: isLoading
|
child: isLoading
|
||||||
? const CupertinoActivityIndicator()
|
? const CupertinoActivityIndicator()
|
||||||
: const Text(
|
: const Text(
|
||||||
@@ -338,14 +323,12 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
Http.pushedLoginPage = false;
|
Http.pushedLoginPage = false;
|
||||||
Utils.hideKeyBoard(context);
|
Utils.hideKeyBoard(context);
|
||||||
getIt<UserInfoViewModel>()
|
getIt<UserInfoViewModel>().updateHost(_hostController.text);
|
||||||
.updateHost(_hostController.text);
|
Http.clear();
|
||||||
if (loginByUserName()) {
|
if (loginByUserName()) {
|
||||||
login(_userNameController.text,
|
login(_userNameController.text, _passwordController.text);
|
||||||
_passwordController.text);
|
|
||||||
} else {
|
} else {
|
||||||
login(_cIdController.text,
|
login(_cIdController.text, _cSecretController.text);
|
||||||
_cSecretController.text);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -390,9 +373,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
} else {
|
} else {
|
||||||
HttpResponse<UserBean> userResponse = await Api.user();
|
HttpResponse<UserBean> userResponse = await Api.user();
|
||||||
if (userResponse.success) {
|
if (userResponse.success) {
|
||||||
if (userResponse.bean != null &&
|
if (userResponse.bean != null && userResponse.bean!.twoFactorActivated != null && userResponse.bean!.twoFactorActivated!) {
|
||||||
userResponse.bean!.twoFactorActivated != null &&
|
|
||||||
userResponse.bean!.twoFactorActivated!) {
|
|
||||||
("你已开启两步验证,App暂不支持").toast();
|
("你已开启两步验证,App暂不支持").toast();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@@ -417,11 +398,9 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
|
|
||||||
if (_hostController.text.isEmpty) return false;
|
if (_hostController.text.isEmpty) return false;
|
||||||
if (!loginByUserName()) {
|
if (!loginByUserName()) {
|
||||||
return _cIdController.text.isNotEmpty &&
|
return _cIdController.text.isNotEmpty && _cSecretController.text.isNotEmpty;
|
||||||
_cSecretController.text.isNotEmpty;
|
|
||||||
} else {
|
} else {
|
||||||
return _userNameController.text.isNotEmpty &&
|
return _userNameController.text.isNotEmpty && _passwordController.text.isNotEmpty;
|
||||||
_passwordController.text.isNotEmpty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: qinglong_app
|
name: qinglong_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 1.0.1+2
|
version: 1.0.2+3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.15.1 <3.0.0"
|
sdk: ">=2.15.1 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user