Skip to content

Commit

Permalink
Merge pull request #16 from ZihengSun/main
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
ZihengSun authored Jun 15, 2023
2 parents 3f1118a + 6c7bac1 commit d1238b6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
47 changes: 39 additions & 8 deletions pygeoweaver/sc_resetpassword.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
import getpass
from logging import getLogger
import subprocess
from pygeoweaver.utils import (
check_ipython,
download_geoweaver_jar,
get_geoweaver_jar_path,
get_java_bin_path,
get_root_dir,
)

logger = getLogger(__name__)

def get_password_twice():
while True:
password1 = getpass.getpass('Enter password: ')
password2 = getpass.getpass('Re-enter password: ')

if password1 == password2:
return password1
else:
print("Passwords don't match. Please try again.")


def reset_password():
"""
Usage: <main class> resetpassword
Reset password for localhost
"""
download_geoweaver_jar()
subprocess.run(
[
get_java_bin_path(),
"-jar",
get_geoweaver_jar_path(),
"resetpassword",
]
)

if check_ipython():
logger.debug("ipython is here")
password = get_password_twice()
subprocess.run(
[
get_java_bin_path(),
"-jar",
get_geoweaver_jar_path(),
"resetpassword",
"-p",
password
]
)
else:
logger.debug("not ipython")
subprocess.run(
[
get_java_bin_path(),
"-jar",
get_geoweaver_jar_path(),
"resetpassword",
]
)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pygeoweaver"
version = "0.6.17"
version = "0.6.19"
authors = [
{ name="Geoweaver team", email="[email protected]" },
]
Expand All @@ -22,7 +22,7 @@ classifiers = [

[tool.poetry]
name = "pygeoweaver"
version = "0.6.17"
version = "0.6.19"
description = "This is a wrapper package of the Geoweaver app."
authors = ["Geoweaver team <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit d1238b6

Please sign in to comment.