fix: a new server could not be given its password
The form only rendered the password field when editing a saved server
(!_editNew). Adding a password-protected instance therefore failed with
"需要密码或已保存的凭据" and offered nowhere to type it. The field is now
always shown ("密码(如果需要)", empty for a passwordless server); a failed
connect that asks for a password focuses it, and a rejected password reads
as "密码错误,请重试".
Adds test/servers_form_test.dart. 0.3.18 (318).
This commit is contained in:
1 parent
e646130d1f
commit
d9d5424318
6 files changed
+70
-13
No files matched your search
+7
-1
@@ -239,7 +239,13 @@ class AppState extends ChangeNotifier {
|
||||
|
||||
/// A short, actionable message for a failed connect.
|
||||
String friendlyConnectError(Object e) {
|
||||
if (e is ApiError) return e.message;
|
||||
if (e is ApiError) {
|
||||
if (e.status == 401 &&
|
||||
e.message.toLowerCase().contains('invalid credentials')) {
|
||||
return '密码错误,请重试';
|
||||
}
|
||||
return e.message;
|
||||
}
|
||||
if (e is ArgumentError) return e.message?.toString() ?? e.toString();
|
||||
if (e is TimeoutException) return '连接超时:检查服务器与代理地址';
|
||||
final s = e.toString();
|
||||
|
||||
Reference in new issue
Block a user