Skip to content

Commit

Permalink
password fix and overview's effect fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xNeorem committed Jan 15, 2020
1 parent bd0e7bd commit c5b085e
Show file tree
Hide file tree
Showing 22 changed files with 134 additions and 133 deletions.
3 changes: 1 addition & 2 deletions src/main/java/storage/dao/UtenteDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public synchronized boolean doCheckLogin(String email, String password) throws S
ResultSet rs = preparedStatement.executeQuery();

while (rs.next()) {
if (rs.getString("password").equals(password) || PasswordManager
.validatePassword(password, rs.getString("password"))) {
if (PasswordManager.validatePassword(password, rs.getString("password"))) {
result = true;
} else {
result = false;
Expand Down
17 changes: 7 additions & 10 deletions src/main/webapp/js/script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
$(function () {


//toggle sidebar
$("#toggle-sidebar").click(function () {
$(".page-wrapper").toggleClass("toggled");
$(".page-wrapper").toggleClass("toggled").trigger('pageToggled');
$("#toggle-sidebar").toggleClass("toggled");
});

Expand All @@ -13,22 +12,21 @@ $(function () {
$("#toggle-sidebar").toggleClass("toggled");
});


restyleBadge();

checkForLogin();

});

function restyleBadge(){
function restyleBadge() {
$(".addbadge").each(function () {
var html = $(this).html();

if (html == "Non completo") {
$(this).addClass("badge-info");
} else if (html == "Accettata") {
$(this).addClass("badge-success");
} else if (html =="Rifiutata"){
} else if (html == "Rifiutata") {
$(this).addClass("badge-danger");
} else {
$(this).addClass("badge-warning");
Expand All @@ -42,7 +40,6 @@ function percentageToDegrees(percentage) {

}


function checkForLogin() {
$.ajax({
url: 'SessionServlet',
Expand All @@ -52,15 +49,15 @@ function checkForLogin() {
},
success: (response) => {
response = JSON.parse(response);
if (response!=null) {
if (response != null) {
if (!response.tipo.localeCompare("studente")) {
let nome = response.nome;
let cognome = response.cognome;
let matricola = response.matricola;

$("#numeroMatricola").html(matricola);
$("#nomeUtente").html(`${nome} ${cognome}`);
}else if (!response.tipo.localeCompare("azienda")){
} else if (!response.tipo.localeCompare("azienda")) {
let nome = response.nome;
let partitaIva = response.partitaIva;

Expand Down Expand Up @@ -99,7 +96,7 @@ function timeConvert(n) {
let rhours = Math.floor(hours);
let minutes = (hours - rhours) * 60;
let rminutes = Math.round(minutes);
return rhours +":"+ rminutes;
return rhours + ":" + rminutes;
}

function updateValueSpinner() {
Expand All @@ -110,7 +107,7 @@ function updateValueSpinner() {
let right = $(this).find('.progress-right .progress-bar');
$("#percentoTotale").html(value);

if(value > 100){
if (value > 100) {
value = 100;
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/webapp/js/studente.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ $(() => {

chargeAvailabilityRequest();

$('.page-wrapper').on('pageToggled', function () {
updateValueSpinner()
});

$("#caricaScaricaPDFModal").on('show.bs.modal', (e) => {
var tirocinio = $(e.relatedTarget).data('idtirocinio');
$("#linkPDF").attr("href", "PdfServlet?tirocinio=" + tirocinio);
Expand Down Expand Up @@ -100,7 +104,7 @@ function checkIfExistTirocinio() {
let oreSvolte = x.oreSvolte;
let percentage = parseInt(oreSvolte / oreTotali * 100);
$("#percentoOreSvolte").attr("data-value", percentage);
updateValueSpinner();
//updateValueSpinner();
$("#oreFatte").html(timeConvert(oreSvolte));
$("#oreTotali").html(timeConvert(oreTotali));
let email = x.azienda.email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public class RichiestaDServletTest extends Mockito {
@BeforeAll
static void setUtente() {
try {
utente = new Utente("[email protected]", "Frank", PasswordManager.createHash("password"), "studente");
utente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "studente");
TestingUtility.createUtente(utente);

Date d = Date.valueOf("1998-06-01");
Studente studente = new Studente("[email protected]", "Frank", PasswordManager.createHash("password"),
Studente studente = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(studente);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ public class RichiestaDServletWhiteBoxTest extends Mockito {
public void load() {

try {
Utente aziendaData = new Utente("[email protected]", "Prova", "password", "azienda");
Utente aziendaData = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(aziendaData);

azienda = new Azienda("[email protected]", "Prova", "password", "03944080652",
azienda = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(azienda);

Utente studenteData = new Utente("[email protected]", "Frank", "password",
Utente studenteData = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"studente");
TestingUtility.createUtente(studenteData);

Date d = Date.valueOf("1998-06-01");
studente = new Studente("[email protected]", "Frank", "password",
studente = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(studente);

ufficioCarriere = new Utente("[email protected]", "Ufficio Carriere", "password",
ufficioCarriere = new Utente("[email protected]", "Ufficio Carriere", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"ufficio_carriere");
TestingUtility.createUtente(ufficioCarriere);

admin = new Utente("[email protected]", "Admin", "password",
admin = new Utente("[email protected]", "Admin", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"admin");
TestingUtility.createUtente(admin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,29 @@ public class PdfServletTest extends Mockito {
static void setUp() {

try {
azienda = new Utente("[email protected]", "Prova", PasswordManager.createHash("password"), "azienda");
azienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(azienda);

Azienda az = new Azienda("[email protected]", "Prova", PasswordManager.createHash("password"), "03944080652", "via prova 2",
Azienda az = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652", "via prova 2",
"pippo", "5485", 55);
TestingUtility.createAzienda(az);

studente = new Utente("[email protected]", "Frank", PasswordManager.createHash("password"), "studente");
studente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "studente");
TestingUtility.createUtente(studente);

Date d = Date.valueOf("1998-06-01");
Studente st = new Studente("[email protected]", "Frank", PasswordManager.createHash("password"),
Studente st = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(st);

tirocinio = new Tirocinio(999, Tirocinio.NON_COMPLETO, 7000, "pippo", 500, "not extis", st,
az, "not extist");
TestingUtility.createTirocinio(tirocinio);

secondAzienda = new Utente("[email protected]", "Prova", PasswordManager.createHash("password"), "azienda");
secondAzienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(secondAzienda);

Azienda azi = new Azienda("[email protected]", "Prova", PasswordManager.createHash("password"), "03944080650",
Azienda azi = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080650",
"via prova 2",
"pippo", "5485", 55);
TestingUtility.createAzienda(azi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ public class PdfServletWhiteBoxTest extends Mockito {
public void load() {

try {
Utente aziendaData = new Utente("[email protected]", "Prova", "password", "azienda");
Utente aziendaData = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(aziendaData);

azienda = new Azienda("[email protected]", "Prova", "password", "03944080652",
azienda = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(azienda);

Utente studenteData = new Utente("[email protected]", "Frank", "password",
Utente studenteData = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"studente");
TestingUtility.createUtente(studenteData);

Date d = Date.valueOf("1998-06-01");
studente = new Studente("[email protected]", "Frank", "password",
studente = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(studente);

ufficioCarriere = new Utente("[email protected]", "Ufficio Carriere", "password",
ufficioCarriere = new Utente("[email protected]", "Ufficio Carriere", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"ufficio_carriere");
TestingUtility.createUtente(ufficioCarriere);

admin = new Utente("[email protected]", "Admin", "password",
admin = new Utente("[email protected]", "Admin", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"admin");
TestingUtility.createUtente(admin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ class RegistroServletTest extends Mockito {
static void setUp() {

try {
azienda = new Utente("[email protected]", "Prova", PasswordManager.createHash("password"), "azienda");
azienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(azienda);

Azienda prova = new Azienda("[email protected]", "Prova", PasswordManager.createHash("password"), "03944080652",
Azienda prova = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(prova);

studente = new Utente("[email protected]", "Frank", PasswordManager.createHash("password"), "studente");
studente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "studente");
TestingUtility.createUtente(studente);

Date d = Date.valueOf("1998-06-01");
Studente ruocco = new Studente("[email protected]", "Frank", PasswordManager.createHash("password"),
Studente ruocco = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(ruocco);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,36 @@ public class RegistroServletWhiteBoxTest extends Mockito {
public void load() {

try {
azienda = new Utente("[email protected]", "Prova", "password", "azienda");
azienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(azienda);

realAzienda = new Azienda("[email protected]", "Prova", "password", "03944080652",
realAzienda = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(realAzienda);


fakeAzienda = new Utente("[email protected]", "Prova", "password", "azienda");
fakeAzienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(fakeAzienda);

Azienda secondAzienda = new Azienda("[email protected]", "Prova", "password", "03944080680",
Azienda secondAzienda = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080680",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(secondAzienda);

studente = new Utente("[email protected]", "Frank", "password",
studente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"studente");
TestingUtility.createUtente(studente);

Date d = Date.valueOf("1998-06-01");
realStudente = new Studente("[email protected]", "Frank", "password",
realStudente = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(realStudente);

fakeStudente = new Utente("[email protected]", "Frank", "password",
fakeStudente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"studente");
TestingUtility.createUtente(fakeStudente);

d = Date.valueOf("1998-06-01");
Studente secondStudente = new Studente("[email protected]", "Frank", "password",
Studente secondStudente = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501R", "1234567890", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(secondStudente);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@ public class TirocinioServletTest extends Mockito {
static void setUp() {

try {
firstAzienda = new Utente("[email protected]", "Prova", PasswordManager.createHash("password"), "azienda");
firstAzienda = new Utente("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "azienda");
TestingUtility.createUtente(firstAzienda);

Azienda prova = new Azienda("[email protected]", "Prova", PasswordManager.createHash("password"), "03944080652",
Azienda prova = new Azienda("[email protected]", "Prova", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "03944080652",
"via prova 2", "pippo", "5485", 55);
TestingUtility.createAzienda(prova);

firstStudente = new Utente("[email protected]", "Frank", PasswordManager.createHash("password"), "studente");
firstStudente = new Utente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "studente");
TestingUtility.createUtente(firstStudente);

Date d = Date.valueOf("1998-06-01");
Studente ruocco = new Studente("[email protected]", "Frank", PasswordManager.createHash("password"),
Studente ruocco = new Studente("[email protected]", "Frank", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"RCCFNC98H01H501E", "1234567891", d, "Italia", "Vallo", "3485813158", "Ruocco");
TestingUtility.createStudente(ruocco);

secondStudente = new Utente("[email protected]", "Mario", PasswordManager.createHash("password"), "studente");
secondStudente = new Utente("[email protected]", "Mario", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184", "studente");
TestingUtility.createUtente(secondStudente);

d = Date.valueOf("1998-01-05");
Studente rossi = new Studente("[email protected]", "Mario", PasswordManager.createHash("password"),
Studente rossi = new Studente("[email protected]", "Mario", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"MRORSS98A05H703Q", "1234567891", d, "Italia", "Rofrano", "3485813158", "Rossi");
TestingUtility.createStudente(rossi);

Expand All @@ -73,7 +73,7 @@ static void setUp() {
prova, "not extist");
TestingUtility.createTirocinio(secondTirocinio);

carrierOffice = new Utente("[email protected]", "Ufficio Carriere", PasswordManager.createHash("password"),
carrierOffice = new Utente("[email protected]", "Ufficio Carriere", "2:02:44e9f86136f9b41ce62a1d2605e79ac4be5d5793dac00302553500d1dff4af65d2baa89503990c2114a9b95184",
"ufficio_carriere");
TestingUtility.createUtente(carrierOffice);

Expand Down
Loading

0 comments on commit c5b085e

Please sign in to comment.