-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX , BUG , TEST ] [] AJOUTER QUELQUE UNITTEST ET L'AMELIORATION DE …
…QUELQUE FUNCTION'S
- Loading branch information
e.elhjoujy
committed
Oct 27, 2023
1 parent
7c30da0
commit 2cdbf25
Showing
8 changed files
with
208 additions
and
107 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/main/java/ma/yc/airafraik/dao/Impl/AccountDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
package ma.yc.airafraik.dao.Impl; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import ma.yc.airafraik.connection.HyperJpa; | ||
import ma.yc.airafraik.core.Util; | ||
import ma.yc.airafraik.dao.AccountDao; | ||
import ma.yc.airafraik.dto.Account; | ||
import ma.yc.airafraik.entities.AdministrateurEntity; | ||
|
||
public class AccountDaoImpl implements AccountDao { | ||
|
||
|
||
private EntityManager em = HyperJpa.getInstance().getEntityManager(); | ||
|
||
@Override | ||
public Account checkLoginAccount(String username, String password) { | ||
Account account = new Account(); | ||
AdministrateurEntity administrateurEntity = em.createQuery("SELECT a FROM AdministrateurEntity a WHERE a.email = :email ", AdministrateurEntity.class) | ||
.setParameter("email", username) | ||
.getSingleResult(); | ||
if (administrateurEntity != null) { | ||
if (administrateurEntity.getPassword().equals(password)) { | ||
account.setUsername(administrateurEntity.getEmail()); | ||
account.setPassword(administrateurEntity.getPassword()); | ||
return account; | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
return null; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.