Compare commits

..

No commits in common. "78ea5f0c10554dab2f057b7a864caf4903916134" and "daef20db661507b5884b4afd9d4655bb8671720b" have entirely different histories.

2 changed files with 3 additions and 15 deletions

View File

@ -8,8 +8,7 @@ import '../pages/LoginDemo.dart';
class AuthService { class AuthService {
// Login with username and password // Login with username and password
Future<bool> login(String username, String password, Future<bool> login(String username, String password) async {
{bool rememberMe = false}) async {
final url = Uri.parse("${globals.api}/token"); final url = Uri.parse("${globals.api}/token");
try { try {
@ -22,7 +21,6 @@ class AuthService {
body: { body: {
"username": username, "username": username,
"password": password, "password": password,
"remember_me": rememberMe.toString()
}, },
); );

View File

@ -18,7 +18,6 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
TextEditingController inputPseudo = TextEditingController(); TextEditingController inputPseudo = TextEditingController();
TextEditingController inputPassword = TextEditingController(); TextEditingController inputPassword = TextEditingController();
final AuthService _authService = AuthService(); final AuthService _authService = AuthService();
bool _rememberMe = false;
Future<void> _login(BuildContext context) async { Future<void> _login(BuildContext context) async {
final pseudo = inputPseudo.text; final pseudo = inputPseudo.text;
@ -29,8 +28,7 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
return; return;
} }
bool success = bool success = await _authService.login(pseudo, password);
await _authService.login(pseudo, password, rememberMe: _rememberMe);
if (success) { if (success) {
Navigator.push( Navigator.push(
@ -55,6 +53,7 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
Future<void> _checkLoginStatus() async { Future<void> _checkLoginStatus() async {
bool loggedIn = await _authService.isLoggedIn(); bool loggedIn = await _authService.isLoggedIn();
print("logged status : ${loggedIn}");
if (loggedIn) { if (loggedIn) {
Navigator.push( Navigator.push(
context, MaterialPageRoute(builder: (_) => ListItemMenu())); context, MaterialPageRoute(builder: (_) => ListItemMenu()));
@ -110,15 +109,6 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
), ),
), ),
), ),
CheckboxListTile(
title: Text("Se souvenir de moi"),
value: _rememberMe,
onChanged: (newValue) {
setState(() {
_rememberMe = newValue ?? false;
});
},
),
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.push(context, Navigator.push(context,