-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSinglePass.java
More file actions
38 lines (32 loc) · 1.12 KB
/
SinglePass.java
File metadata and controls
38 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
public class SinglePass {
String Website;
String Email;
String Password;
public SinglePass(String website, String email, String password) {
Website = website;
Email = email;
Password = password;
}
void saveSinglePass(){
String fileContent = Website+","+Email+","+Password+"\n";
String appData = System.getenv("LOCALAPPDATA");
String passPath = appData+"\\savedpass.txt";
try{
FileWriter fw = new FileWriter(passPath, true);
fw.write(fileContent);
fw.close();
System.out.println("\n\nYour Password Has Been Saved!");
System.out.println("Website: " + Website + ", Email: " + Email + ", Password: " + Password);
}
catch (FileNotFoundException e){
System.out.println("Could Not Locate Saved Passwords File");
}
catch (IOException e){
System.out.println("Could Not Save Password.");
}
}
}