Commit 1b084dc 1 parent 1d68115 commit 1b084dc Copy full SHA for 1b084dc
File tree 5 files changed +107
-5
lines changed
5 files changed +107
-5
lines changed Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ class Client {
247
247
if (res['success' ] == true ) {
248
248
return Client (res['authtoken' ]);
249
249
} else {
250
- throw Error ();
250
+ throw BadCredentialsException ();
251
251
}
252
252
}
253
253
@@ -260,6 +260,8 @@ class Client {
260
260
}
261
261
}
262
262
263
+ class BadCredentialsException implements Exception {}
264
+
263
265
enum HTTPRequestMethod { get , put, delete }
264
266
265
267
/// A subset of the different actions allowed by the API
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ void main() async {
17
17
stdout.writeln ('Database URL: ' + dbPath);
18
18
Global .storage = const FlutterSecureStorage ();
19
19
//Comment this out in production
20
- // await deleteDatabase(dbPath);
21
- // Global.storage!.deleteAll();
20
+ await deleteDatabase (dbPath);
21
+ Global .storage! .deleteAll ();
22
22
try {
23
23
Global .token = await Global .storage! .read (key: 'token' );
24
24
} on PlatformException catch (_) {
Original file line number Diff line number Diff line change @@ -47,9 +47,25 @@ class LoginState extends State<Login> {
47
47
Global .client =
48
48
await Client .login (_unameController.text, _pwdController.text);
49
49
widget.onLogin ();
50
- } catch (e ) {
50
+ } on BadCredentialsException catch (_ ) {
51
51
ScaffoldMessenger .of (context).showSnackBar (
52
52
const SnackBar (content: Text ('Mauvais identifiant/mot de passe' )));
53
+ } catch (e, st) {
54
+ Navigator .of (context).push (MaterialPageRoute (builder: (ctx) {
55
+ return Scaffold (
56
+ appBar: AppBar (
57
+ title: Text ('Erreur' ),
58
+ ),
59
+ body: SingleChildScrollView (
60
+ child: Column (
61
+ children: [
62
+ Text (e.toString ()),
63
+ Text (st.toString ()),
64
+ ],
65
+ ),
66
+ ),
67
+ );
68
+ }));
53
69
}
54
70
}
55
71
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
15
15
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16
16
# Read more about iOS versioning at
17
17
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18
- version : 1.0.0+ 1
18
+ version : 0.1. 1
19
19
20
20
environment :
21
21
sdk : " >=2.12.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments