diff --git a/consumerWebsite/database/mySQL.js b/consumerWebsite/database/mySQL.js index cb3d6fc..275674f 100644 --- a/consumerWebsite/database/mySQL.js +++ b/consumerWebsite/database/mySQL.js @@ -6,8 +6,8 @@ const fs = require('fs'); const sequelize = new Sequelize( "eco_saver", - "DB_USER='mpuser", - "DB_PASS='majorprojectpassword1234!", + process.env.DB_USER, + process.env.DB_PASS, { host: "mpsqldatabasean.mysql.database.azure.com", dialect: 'mysql', @@ -15,7 +15,7 @@ const sequelize = new Sequelize( attributeBehavior: 'escape', dialectOptions: { ssl: { - ca: fs.readFileSync(path.resolve(__dirname, '../cert/DigiCertGlobalRootCA.crt_3.pem')), + ca: fs.readFileSync(path.resolve(__dirname, '../cert/DigiCertGlobalRootCA.crt.pem')), }, }, diff --git a/consumerWebsite/public/js/apikey.js b/consumerWebsite/public/js/apikey.js deleted file mode 100644 index fe1d021..0000000 --- a/consumerWebsite/public/js/apikey.js +++ /dev/null @@ -1,98 +0,0 @@ -function generateKey() { - // Create the overlay dynamically - var overlay = document.createElement('div'); - overlay.className = 'overlay'; - - // Create the small screen dynamically - var generateKeyScreen = document.createElement('div'); - generateKeyScreen.className = 'generate-key-screen'; - - // Generate random public and private keys - var publicKey = generateRandomKey(); - var privateKey = generateRandomKey(); - - // Add input fields for Name, Public Key, Private Key, Key Type, and Created - generateKeyScreen.innerHTML = ` - -
- - - -
- - - -
- - -
- - - - `; - - // Append the overlay and small screen to the body - document.body.appendChild(overlay); - document.body.appendChild(generateKeyScreen); - - // Display the overlay and small screen - overlay.style.display = 'block'; - generateKeyScreen.style.display = 'block'; -} - -function generateRandomKey() { - // Generate a random string as a key (you might want to use a more robust key generation method) - return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); -} - -function getCurrentDate() { - // Get the current date and format it as 'YYYY-MM-DD' - return new Date().toISOString().split('T')[0]; -} - -function copyToClipboard(elementId) { - // Copy the text from the specified input field to the clipboard - var element = document.getElementById(elementId); - element.select(); - document.execCommand('copy'); - - // Optionally, you can provide feedback to the user (e.g., display a tooltip) - alert('Copied to clipboard: ' + element.value); -} - - -function saveKey() { - // Retrieve values from input fields - var name = document.getElementById('name').value; - var publicKey = document.getElementById('publicKey').value; - var privateKey = document.getElementById('privateKey').value; - var created = document.getElementById('created').value; - - // Create a new table row with the key information - var newRow = document.createElement('tr'); - newRow.innerHTML = ` - ${name} - ${publicKey} - ${privateKey} - ${created} - `; - - // Append the new row to the table body - var tableBody = document.querySelector('#content-get-api tbody'); - tableBody.appendChild(newRow); - - // Optionally, you can close the small screen - closeGenerateKey(); -} - - -function closeGenerateKey() { - var overlay = document.querySelector('.overlay'); - var generateKeyScreen = document.querySelector('.generate-key-screen'); - - // Hide and remove the overlay and small screen from the DOM - overlay.style.display = 'none'; - generateKeyScreen.style.display = 'none'; - document.body.removeChild(overlay); - document.body.removeChild(generateKeyScreen); -}