diff --git a/README.md b/README.md index 3cb6d23..31aa7ec 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,12 @@ SamAuthenticator is a simple replace to Google Authenticator. The main feature o ### Who is SamAuthenticator for? It's for those who know how to manage their security but can't stand the annoyance of Google Authenticator, Authy, and similar services. + +### Requirements + + sudo pip3 install samauth + +should do it. You should have OpenSSL installed. On Ubuntu and Debian, this installs it: + + sudo apt-get install libssl-dev \ No newline at end of file diff --git a/SamAuthenticator/AuthenticatorWindow.py b/SamAuthenticator/AuthenticatorWindow.py index b1eeadf..51944c2 100644 --- a/SamAuthenticator/AuthenticatorWindow.py +++ b/SamAuthenticator/AuthenticatorWindow.py @@ -209,6 +209,7 @@ class AuthenticatorGUI(QMainWindow): self.keys_data_model_proxy = QSortFilterProxyModel() self.keys_data_model_proxy.setFilterCaseSensitivity(Qt.CaseInsensitive) self.keys_data_model = model.AuthenticatorKeysDataModel(keys) + self.keys_table_view.set_real_data_model(self.keys_data_model) self.keys_data_model_proxy.setSourceModel(self.keys_data_model) self.keys_table_view.setModel(self.keys_data_model_proxy) @@ -223,7 +224,9 @@ class AuthenticatorGUI(QMainWindow): def load_geometry(self): settings = QSettings("SamApps", "SamAuthenticator") - self.restoreGeometry(settings.value("geometry")) + geometry_values = settings.value("geometry") + if geometry_values is not None: + self.restoreGeometry(geometry_values) def closeEvent(self, event): settings = QSettings("SamApps", "SamAuthenticator") diff --git a/SamAuthenticator/KeyDataView.py b/SamAuthenticator/KeyDataView.py index 98cb803..edb7d5c 100644 --- a/SamAuthenticator/KeyDataView.py +++ b/SamAuthenticator/KeyDataView.py @@ -8,6 +8,8 @@ class KeyDataView(QTableView): def __init__(self): super().__init__() + self.data_model = None + self.add_key_dialog = AddKeyDialog() self.add_key_dialog.new_key_to_add_signal.connect(self.add_new_key) @@ -61,10 +63,13 @@ class KeyDataView(QTableView): def add_new_key(self, name, secret): try: - self.model().getKeysObject().test_secret_validity(secret) - self.model().getKeysObject().set_secret(name, secret) - self.model().refreshAll() + self.data_model.getKeysObject().test_secret_validity(secret) + self.data_model.getKeysObject().set_secret(name, secret) + self.data_model.refreshAll() except Exception as e: self.add_key_dialog.close() QMessageBox.warning(self, "Error", "Testing the secret you entered failed. " + str(e)) return + + def set_real_data_model(self, the_model): + self.data_model = the_model diff --git a/SamAuthenticator/Meta.py b/SamAuthenticator/Meta.py new file mode 100644 index 0000000..227f7b0 --- /dev/null +++ b/SamAuthenticator/Meta.py @@ -0,0 +1,2 @@ +SOFTWARE_VERSION = "1.0.6" +__version__ = SOFTWARE_VERSION diff --git a/SamAuthenticator/__init__.py b/SamAuthenticator/__init__.py index 5b985e1..1e3d0a6 100644 --- a/SamAuthenticator/__init__.py +++ b/SamAuthenticator/__init__.py @@ -1,2 +1,2 @@ -from SamAuthenticator.Authenticator import * -from SamAuthenticator.AuthenticatorGUIApp import * +# from SamAuthenticator.Authenticator import * +# from SamAuthenticator.AuthenticatorGUIApp import * diff --git a/main.py b/main.py index c29d3de..4b03284 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -import SamAuthenticator as auth +from SamAuthenticator.AuthenticatorGUIApp import * -auth.start() +start() diff --git a/pip-build.bat b/pip-build.bat new file mode 100644 index 0000000..e6ded22 --- /dev/null +++ b/pip-build.bat @@ -0,0 +1,13 @@ +@echo off +RMDIR /S /Q dist +RMDIR /S /Q build +CALL python setup.py bdist_wheel --universal +if NOT %ERRORLEVEL% == 0 goto errorHandling +cd .. +pause +exit 0 + +:errorHandling +echo "Error while building..." +pause +exit 1 diff --git a/pip-build.sh b/pip-build.sh new file mode 100755 index 0000000..9cf8dc2 --- /dev/null +++ b/pip-build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +#go to the directory of the script +reldir=`dirname $0` +cd $reldir +directory=`pwd` + +rm -rf build +rm -rf dist + +python3 setup.py sdist +if [ $? -ne 0 ]; then + echo 'Python packager source distribution tool failed.' + exit +fi diff --git a/pip-install.bat b/pip-install.bat new file mode 100644 index 0000000..3940d85 --- /dev/null +++ b/pip-install.bat @@ -0,0 +1,5 @@ +@echo off +python -c "import SamAuthenticator.Meta;print(SamAuthenticator.Meta.__version__)" > ver.txt +set /p VER=&2 + exit 1 +fi + +pip3 install dist/samauth* --upgrade +if [ $? -ne 0 ]; then + echo 'Package installation failed. Did you build the package? Do you have pip3 installed?' + exit +fi + diff --git a/pip-publish.bat b/pip-publish.bat new file mode 100644 index 0000000..8ffec6e --- /dev/null +++ b/pip-publish.bat @@ -0,0 +1 @@ +python setup.py register sdist upload diff --git a/pip-publish.sh b/pip-publish.sh new file mode 100755 index 0000000..43b3d20 --- /dev/null +++ b/pip-publish.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +#python3 setup.py register sdist upload +twine upload dist/*.tar.gz + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..02e2d78 --- /dev/null +++ b/setup.py @@ -0,0 +1,34 @@ +# from distutils.core import setup +import SamAuthenticator.Meta +import os +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +try: + del os.link +except: + pass + +include_files = ["SamAuthenticator/images/key.png"] + +setup( + name="samauth", + version = SamAuthenticator.Meta.__version__, + author="Samer Afach", + author_email="samer@afach.de", + packages=["SamAuthenticator"], + include_package_data=True, + url="https://git.afach.de/samerafach/SamAuthenticator", + description="A simple Google Authenticator replacement", + data_files=include_files, + install_requires=['pyqt5', 'onetimepass', 'cryptography', 'argon2'], + extras_requires=['pyqt5', 'onetimepass', 'cryptography', 'argon2'], + python_requires='>=3.4', + entry_points={ + 'console_scripts': [ + 'samauth = SamAuthenticator.AuthenticatorGUIApp:start', + 'samauthenticator = SamAuthenticator.AuthenticatorGUIApp:start' + ]} +)