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,