-
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.
Completed be for invitation of patients
- Loading branch information
Showing
177 changed files
with
11,898 additions
and
246 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<application xmlns="https://jakarta.ee/xml/ns/jakartaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_9.xsd" | ||
version="9"> | ||
|
||
</application> |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE glassfish-application PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Java EE Application 6.0//EN" | ||
"http://glassfish.org/dtds/glassfish-application_6_0-1.dtd"> | ||
<glassfish-application> | ||
</glassfish-application> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,16 @@ | |
import model.DAO.DAOUser; | ||
import model.entity.User; | ||
import model.service.login.Authenticator; | ||
//import model.service.message.Conversation; | ||
import model.service.registration.Registration; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Encryption encryption = new Encryption(); | ||
DAOUser db = new DAOUser(); | ||
String plainTextPassword = "123456"; | ||
EmailManager message = new EmailManager(); | ||
Authenticator auth = new Authenticator(); | ||
Registration r = new Registration(); | ||
|
||
/* | ||
String hashedPassword = encryption.encryptPassword(plainTextPassword); | ||
// Use hashed password to create new user | ||
db.createUser("[email protected]", hashedPassword, 0); | ||
*/ | ||
|
||
/* | ||
User user = db.getUserByIdOrEmail("[email protected]"); | ||
System.out.println(encryption.verifyPassword(plainTextPassword, user.getPassword())); | ||
*/ | ||
|
||
|
||
//test email | ||
//message.sendEmail("[email protected]", "Email Test", "questo è una email di test"); | ||
|
||
//test email recupero password | ||
Authenticator authenticator = new Authenticator(); | ||
System.out.println(authenticator.authenticate("[email protected]", "123456")); | ||
System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
r.invitePatient(9, "[email protected]", "Raffaele", "Monti"); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package controller; | ||
|
||
import model.service.condition.ConditionManager; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
|
||
@WebServlet("/AddRemovePatientCondition") | ||
public class AddRemovePatientCondition extends HttpServlet { | ||
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
String referer = request.getHeader("Referer"); | ||
ConditionManager conditionService= new ConditionManager(); | ||
|
||
int idPatient = Integer.parseInt(request.getParameter("idPatient")); | ||
int idCondition = Integer.parseInt(request.getParameter("idCondition")); | ||
|
||
String operation= request.getParameter("operation"); | ||
if (operation.equals("Rimuovi")) //REMOVE | ||
{ | ||
conditionService.RemoveConditionPatient(idCondition,idPatient); | ||
} | ||
if (operation.equals("Aggiungi")) //ADD | ||
{ | ||
int severity= Integer.parseInt(request.getParameter("severity")); | ||
conditionService.AddConditionPatient(idCondition,idPatient,severity); | ||
} | ||
|
||
response.sendRedirect(referer); | ||
|
||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package controller; | ||
|
||
import model.service.login.Authenticator; | ||
import model.service.user.UserData; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
@WebServlet("/ChangePassword") | ||
public class ChangePassword extends HttpServlet | ||
{ | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException | ||
{ | ||
String password = request.getParameter("password"); | ||
String password_control = password.replaceAll("\\s", ""); | ||
int id = (int) request.getSession().getAttribute("id"); | ||
new Authenticator().resetPassword( new UserData().getUser(id).getEmail(), password_control); | ||
response.getWriter().write("true"); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package controller; | ||
|
||
import model.service.user.UserRegistry; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpSession; | ||
import java.io.IOException; | ||
|
||
@WebServlet("/changeDate") | ||
public class ChangeUserInfo extends HttpServlet | ||
{ | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
HttpSession session = request.getSession(); | ||
int userId = (int) session.getAttribute("id"); | ||
UserRegistry userRegistry = new UserRegistry(); | ||
String risultato = ""; | ||
if (updatePersonalInfo(request, userId, userRegistry)) { | ||
risultato = "Dati personali aggiornati con successo;"; | ||
} else { | ||
risultato = "Dati personali non aggiornati, email gia' utilizzata"; | ||
} | ||
response.sendRedirect("/TalkAID_war_exploded/JSP/Cambio_dati.jsp?risultato=" + risultato); | ||
} | ||
|
||
private boolean updatePersonalInfo(HttpServletRequest request, int userId, UserRegistry userRegistry) { | ||
String firstName = request.getParameter("firstname"); | ||
String lastName = request.getParameter("lastname"); | ||
String phoneNumber = request.getParameter("phonenumber"); | ||
String email = request.getParameter("email"); | ||
String address = request.getParameter("address"); | ||
if (!firstName.isEmpty() || !lastName.isEmpty() || !phoneNumber.isEmpty()) { | ||
return userRegistry.updatePersonaInfofromId(userId, firstName, lastName, phoneNumber,email,address); | ||
} | ||
return false; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package controller; | ||
|
||
import model.service.login.Authenticator; | ||
import model.service.user.UserData; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
@WebServlet("/ControllPassword") | ||
public class CheckCurrentPassword extends HttpServlet | ||
{ | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException | ||
{ | ||
String password = request.getParameter("password"); | ||
Authenticator authenticator = new Authenticator(); | ||
int id = (int) request.getSession().getAttribute("id"); | ||
String email = new UserData().getUser(id).getEmail(); | ||
response.getWriter().write(String.valueOf(authenticator.authenticate(email, password) > 0)); //true se deve abilitare, false altrimenti | ||
} | ||
} |
Oops, something went wrong.