Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.1 kB
1
Indexable
Never
//pass.js

const taskForm2 = document.querySelector('#taskForm2')
const Username1 = document.querySelector('#Username1')
const Password = document.querySelector('#Password')
const Password1 = document.querySelector('#Password1')
const Email = document.querySelector('#Email')
const CPassword = document.querySelector('#CPassword1')
const { ipcRenderer } = require('electron')
let users=[];

taskForm2.addEventListener("submit",async e=>{
    e.preventDefault();
    const user={
      email:Email.value,
  name:Username1.value,
  pass:Password.value ,
  newpass:Password1.value
    }
    if(CPassword.value!==Password1.value){
      ipcRenderer.invoke('not-new', user).then(()=> console.log('new user entered')).catch((err)=> console.error('Error'))
    }else{
      ipcRenderer.invoke('update-user', user).then(()=> console.log('new user entered')).catch((err)=> console.error('Error'))
     
    }
    taskForm2.reset()
  })

//pass.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self';">
   
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="ui/style.css" />
  
  <title>ChangePassword</title>
</head>
<body>
  <h1>Change Password</h1>
    
    <form id="taskForm2">
     
      <br>
      
      <input type="text" id="Email" placeholder="Email" autofocus />
      <br>
     
      <input id="Username1" placeholder="Username" autofocus />
      <br>
      <input type="text" id="Password" placeholder="Old Password" autofocus/>
      <br>
   
      <input type="text" id="Password1" placeholder="New Password" autofocus/>
      <br>
     
      <input type="text" id="CPassword1" placeholder="Confirm New Password" autofocus />
      <br>
      <input type="Submit" placeholder="SAVE" /></button>
    </form>
    
  </div>
  <p class="para-2">
    <br>
    <a href="index.html">Login here</a>
    <script  src="pass.js"></script>
  </p>
</body>
</html>