diff --git a/What_The_Fantasy/app/build.gradle.kts b/What_The_Fantasy/app/build.gradle.kts index e884189..5c11806 100644 --- a/What_The_Fantasy/app/build.gradle.kts +++ b/What_The_Fantasy/app/build.gradle.kts @@ -50,7 +50,7 @@ android { } dependencies { - + implementation(libs.bcrypt) // pour hacher les mdp implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) @@ -68,6 +68,6 @@ dependencies { androidTestImplementation(libs.androidx.ui.test.junit4) debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) - implementation(libs.coil.compose) + implementation(libs.coil.compose) //gére les url des image } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt index cf17cd1..9f94e86 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/LoginPage.kt @@ -157,7 +157,7 @@ fun TitlePage(titleResId : Int, size : Int, color : Color){ fun ConnexionButtonLogin(userStub : List, id : String, passwd : String, titleResId : Int, size : Int, colorButton : Color, colorText : Color, navController: NavController){ val title = stringResource(id = titleResId) Button( - onClick = { ValidLogin(id, passwd, userStub, navController) }, + onClick = { validLogin(id, passwd, userStub, navController) }, colors = ButtonDefaults.buttonColors(containerColor = colorButton), modifier = Modifier .fillMaxWidth(), @@ -166,14 +166,17 @@ fun ConnexionButtonLogin(userStub : List, id : String, passwd : String, ti } } -fun ValidLogin(identifiant : String, passwd : String, users : List, navController: NavController){ + +fun validLogin(identifiant : String, passwd : String, users : List, navController: NavController){ users.forEach { user -> if (user.username == identifiant && user.password == passwd){ navController.navigate("profile") + //navController.navigate(ProfilPage(navController)) } } } + @Composable fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: NavController){ val title = stringResource(id = titleResId) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt index be9ef85..7d07b7e 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt @@ -2,6 +2,7 @@ package com.example.what_the_fantasy.ui.screens import android.content.Context import android.os.Bundle +import android.util.Patterns import android.widget.ImageView import androidx.activity.ComponentActivity import androidx.activity.compose.setContent @@ -151,8 +152,6 @@ fun ImageProfil(imgProfil : String, size :Int, sizeBorber : Int, colorBorder : C } - - @Composable fun EditEmail(userEmail : String){ var email by remember { mutableStateOf(userEmail) } @@ -164,7 +163,7 @@ fun EditEmail(userEmail : String){ value = email, onValueChange = { email = it - emailError = !android.util.Patterns.EMAIL_ADDRESS.matcher(it).matches() + emailError = !Patterns.EMAIL_ADDRESS.matcher(it).matches() }, modifier = Modifier.fillMaxWidth(), textStyle = TextStyle(color = Color.White, fontSize = 18.sp), diff --git a/What_The_Fantasy/gradle/libs.versions.toml b/What_The_Fantasy/gradle/libs.versions.toml index 251a75f..ae80aff 100644 --- a/What_The_Fantasy/gradle/libs.versions.toml +++ b/What_The_Fantasy/gradle/libs.versions.toml @@ -1,6 +1,8 @@ [versions] agp = "8.6.0" +bcrypt = "2.2.0" coilCompose = "2.2.1" +coilComposeVersion = "3.1.0" kotlin = "1.9.0" coreKtx = "1.10.1" junit = "4.13.2" @@ -14,7 +16,10 @@ navigationCommonAndroid = "2.9.0-alpha05" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +bcrypt = { module = "de.nycode:bcrypt", version.ref = "bcrypt" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" } +coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coilComposeVersion" } +coil3-coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilComposeVersion" } junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }