From a52698279628150a51497b43a4ca01ac57159033 Mon Sep 17 00:00:00 2001 From: "audric.sabatier" Date: Wed, 30 Nov 2022 15:07:29 +0100 Subject: [PATCH] FIX : Log in work again --- .../lib/controller/controller.dart | 10 ++++++++-- .../lib/views/pages/sign_in/p_sign_in.dart | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart index 5afd378..2a8843a 100644 --- a/Sources/dafl_project_flutter/lib/controller/controller.dart +++ b/Sources/dafl_project_flutter/lib/controller/controller.dart @@ -101,8 +101,14 @@ class Controller { _dataBaseService.save(userToSave); } - load(String username, String password) async { - //TODO : call database methode + create user + Future load(String username, String password) async { + User? newUser = await _dataBaseService.load(username, password); + + if(newUser == null) + return false; + else + _currentUser = newUser; + return true; } changeUsername(String newName) { diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart index c2a9e23..bb14212 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart @@ -258,7 +258,7 @@ class _SignInPageState extends State { } else if (password == "") { notify(4, context); } else if(await MyApp.controller - .load(userNameTextField.text, passwordTextField.text) != null) { + .load(userNameTextField.text, passwordTextField.text)) { Navigator.of(context).push( PageTransition( type: PageTransitionType.fade,