En cours de hachage

pull/12/head
Leni BEAULATON 2 months ago
parent bb712a0e86
commit 657da2d024

@ -50,7 +50,7 @@ android {
} }
dependencies { dependencies {
implementation(libs.bcrypt) // pour hacher les mdp
implementation(libs.androidx.core.ktx) implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
@ -68,6 +68,6 @@ dependencies {
androidTestImplementation(libs.androidx.ui.test.junit4) androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest) debugImplementation(libs.androidx.ui.test.manifest)
implementation(libs.coil.compose) implementation(libs.coil.compose) //gére les url des image
} }

@ -157,7 +157,7 @@ fun TitlePage(titleResId : Int, size : Int, color : Color){
fun ConnexionButtonLogin(userStub : List<User>, id : String, passwd : String, titleResId : Int, size : Int, colorButton : Color, colorText : Color, navController: NavController){ fun ConnexionButtonLogin(userStub : List<User>, id : String, passwd : String, titleResId : Int, size : Int, colorButton : Color, colorText : Color, navController: NavController){
val title = stringResource(id = titleResId) val title = stringResource(id = titleResId)
Button( Button(
onClick = { ValidLogin(id, passwd, userStub, navController) }, onClick = { validLogin(id, passwd, userStub, navController) },
colors = ButtonDefaults.buttonColors(containerColor = colorButton), colors = ButtonDefaults.buttonColors(containerColor = colorButton),
modifier = Modifier modifier = Modifier
.fillMaxWidth(), .fillMaxWidth(),
@ -166,14 +166,17 @@ fun ConnexionButtonLogin(userStub : List<User>, id : String, passwd : String, ti
} }
} }
fun ValidLogin(identifiant : String, passwd : String, users : List<User>, navController: NavController){
fun validLogin(identifiant : String, passwd : String, users : List<User>, navController: NavController){
users.forEach { user -> users.forEach { user ->
if (user.username == identifiant && user.password == passwd){ if (user.username == identifiant && user.password == passwd){
navController.navigate("profile") navController.navigate("profile")
//navController.navigate(ProfilPage(navController))
} }
} }
} }
@Composable @Composable
fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: NavController){ fun CreateAccountButton(titleResId : Int, size : Int, color : Color, navController: NavController){
val title = stringResource(id = titleResId) val title = stringResource(id = titleResId)

@ -2,6 +2,7 @@ package com.example.what_the_fantasy.ui.screens
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.util.Patterns
import android.widget.ImageView import android.widget.ImageView
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
@ -151,8 +152,6 @@ fun ImageProfil(imgProfil : String, size :Int, sizeBorber : Int, colorBorder : C
} }
@Composable @Composable
fun EditEmail(userEmail : String){ fun EditEmail(userEmail : String){
var email by remember { mutableStateOf(userEmail) } var email by remember { mutableStateOf(userEmail) }
@ -164,7 +163,7 @@ fun EditEmail(userEmail : String){
value = email, value = email,
onValueChange = { onValueChange = {
email = it email = it
emailError = !android.util.Patterns.EMAIL_ADDRESS.matcher(it).matches() emailError = !Patterns.EMAIL_ADDRESS.matcher(it).matches()
}, },
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp), textStyle = TextStyle(color = Color.White, fontSize = 18.sp),

@ -1,6 +1,8 @@
[versions] [versions]
agp = "8.6.0" agp = "8.6.0"
bcrypt = "2.2.0"
coilCompose = "2.2.1" coilCompose = "2.2.1"
coilComposeVersion = "3.1.0"
kotlin = "1.9.0" kotlin = "1.9.0"
coreKtx = "1.10.1" coreKtx = "1.10.1"
junit = "4.13.2" junit = "4.13.2"
@ -14,7 +16,10 @@ navigationCommonAndroid = "2.9.0-alpha05"
[libraries] [libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } 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-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" } junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }

Loading…
Cancel
Save