Skip to content

Commit

Permalink
Completed javadoc, added check for user type in every page
Browse files Browse the repository at this point in the history
  • Loading branch information
r-monti committed Jan 20, 2024
1 parent cbefd51 commit 8b27d51
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/main/java/model/DAO/DAOConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

/**
* Inizializza il data source caricando i driver class del database e creando il data source object.
* @throws ClassNotFoundException se il driver class del database non viene trovato.
*/
public class DAOConnection {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(DAOConnection.class);
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/model/service/email/EmailManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ private void sendEmail(Session session, MimeMessage message) throws MessagingExc
}

/**
* This method generates a MimeMessage, filling it with the necessary information.
* @param message the MimeMessage object to fill with information
* @param toAddress the destination address of the email
* @param subject the subject of the email
* @param body the body of the email
* @throws MessagingException if the setting operation fails
* Questo metodo genera un MimeMessage, riempendolo con le informazioni necessarie.
* @param message l'oggetto MimeMessage da riempire con le informazioni.
* @param toAddress l'indirizzo del destinatario dell'email
* @param subject l'oggetto della mail
* @param body il corpo della mail
* @throws MessagingException se il settaggio delle informazioni fallisce
*/
private void generateMessage(MimeMessage message, String toAddress, String subject, String body) throws MessagingException {
message.setFrom(new InternetAddress(emailProps.getProperty("email.string")));
Expand All @@ -98,8 +98,8 @@ private void generateMessage(MimeMessage message, String toAddress, String subje
}

/**
* This method loads the email properties from a resource file named 'email.properties'.
* @return a Properties object, holding the email properties
* Questo metodo carica le proprietà delle email dal file chiamato 'email.properties'.
* @return un oggetto Properties, che mantiene le proprietà delle email.
*/
private Properties loadEmailProperties() {
Properties props = new Properties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public interface EmailManagerInterface {

/**
* Permette l'invio di un'email specificando l'indirizzo, il titolo ed il corpo.
* Permette l'invio di un'email specificando l'indirizzo, il titolo e il corpo.
*
* @param toAddress l'indirizzo email
* @param subject il titolo
Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/JSP/aiApprove.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<!DOCTYPE>
<html lang="it">
<body>

<% if(session.getAttribute("type")==null || session.getAttribute("type").equals("patient")){
response.sendRedirect("../errorPage/403.html");
}%>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2" crossorigin="anonymous"></script>
<script>
function hide(index){
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/JSP/changePassw.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@

</head>
<body>

<% if(session.getAttribute("type")==null){
response.sendRedirect("../errorPage/403.html");
}%>

<!--Qui c'è quello che vedi sin da subito -->
<div class="up">
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/JSP/homePagePatient.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!DOCTYPE html>
<html lang="it" style="background-color: #f7fcff; ">
<%
if(session.getAttribute("id") == null) {
if(session.getAttribute("id") == null || session.getAttribute("type").equals("therapist")) {
response.sendRedirect("../errorPage/403.html");
}
else {
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/JSP/homepageTherapist.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<title>Homepage</title>
</head>
<body>
<% if(session.getAttribute("type")==null || session.getAttribute("type").equals("patient")){
response.sendRedirect("../errorPage/403.html");
}%>

<div id="container">
<div id="navbar">
<div id="logoImg">
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/JSP/messageCenter.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!--chats -->
<div class="chat-list">
<%
if(session.getAttribute("id") == "null") {
if(session.getAttribute("id") == null) {
response.sendRedirect("../errorPage/403.html");
}
else {
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/JSP/navbar.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<!DOCTYPE html>
<html lang="it">
<body>
<% if(session.getAttribute("type")==null){
response.sendRedirect("../errorPage/403.html");
}%>
<div id="navbarDiv" >
<div id="home" class="divButtons">
<img id="homeIcon" class="navbarIcon" src="../images/home.svg" alt="homeIcon">
Expand Down

0 comments on commit 8b27d51

Please sign in to comment.