private void btnRegistarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistarActionPerformed

        String nome = txtNome.getText();
        String email = txtEmail.getText();
        char[] pass1 = pwPass1.getPassword();
        char[] pass2 = pwPass2.getPassword();
        
        
        if(nome.isEmpty() || email.isEmpty() || pass1==null ||pass2==null){
        
            JOptionPane.showMessageDialog(this, "All the fields are mandatory", "Error!", JOptionPane.ERROR_MESSAGE);
        }
        else{
        
            if(nameValidation(nome) && emailValidation(email) && passwordValidation(pass1, pass2)){
                
                CodificarMD5 md5= new CodificarMD5();
                String passEncrypt = CodificarMD5.cryptWithMD5(String.valueOf(pass2));
                
                pagPrincipal.getApp().addUser(new User(nome, email, passEncrypt));
                pagPrincipal.getApp().guardaFoUsers();
                this.dispose();
            }
            else{
            
                JOptionPane.showMessageDialog(this, "Something is wrong, please check the red fields.", "Error!", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_btnRegistarActionPerformed