Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean changePasswordForAdmin(String pass) {
- Properties props = new Properties();
- InputStream is = Login.class.getResourceAsStream("/config.properties");
- try {
- props.load(is);
- is.close();
- } catch (IOException e) {
- System.out.println("password change failed");
- e.printStackTrace();
- return false;
- }
- FileOutputStream out;
- try {
- out = new FileOutputStream("/config.properties");
- props.setProperty(passwordProperyKey, pass);
- props.store(out, null);
- out.close();
- System.out.println("password changed");
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("password change failed");
- return false;
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("password change failed");
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement