You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
54 lines
1.6 KiB
<?php
|
|
namespace App\modele;
|
|
class UtilisateurModele
|
|
{
|
|
/**
|
|
* @description Charger le flux d'activiter
|
|
* @return array flux
|
|
*/
|
|
public function LoadFeed() : array
|
|
{
|
|
// TO DO
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @description se connecter
|
|
* @param string email
|
|
* @param string hash
|
|
* @return \App\modele\Alumni
|
|
*/
|
|
public function Login(string $email,string $hash) : \App\modele\Alumni
|
|
{
|
|
// TO DO
|
|
return new \App\modele\Alumni(null,null,null);
|
|
}
|
|
|
|
/**
|
|
* @description s'inscrire
|
|
* @param string email
|
|
* @param string hash
|
|
* @param string $pseudo
|
|
* @return \Alumni chargé
|
|
*/
|
|
public function inscription(string $email, string $hashpassword): \App\modele\Alumni
|
|
{
|
|
$dsn = "mysql:host=localhost;dbname=dbAlica";
|
|
$username = "Dev";
|
|
$password = "Dev";
|
|
|
|
$role = "Utilisateur";
|
|
$con = new \App\gateway\Connection($dsn, $username, $password);
|
|
$gate = new \App\gateway\AlumniGateway($con);
|
|
// Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway
|
|
if ($gate->insert($email, $hashpassword, $role)) {
|
|
// L'insertion a réussi, retournez le nouvel utilisateur
|
|
$nouvelUtilisateur = new \App\modele\Alumni($email, $hashpassword, $role);
|
|
return $nouvelUtilisateur;
|
|
} else {
|
|
// L'insertion a échoué, renvoyez un utilisateur vide pour indiquer l'échec
|
|
return new \App\modele\Alumni(null, null, null);
|
|
}
|
|
}
|
|
}
|