Final fixes for the first version

This commit is contained in:
Samer Afach 2018-03-28 23:44:03 +02:00
parent 849bd5a6ec
commit d3861235db
13 changed files with 117 additions and 8 deletions

View File

@ -12,4 +12,12 @@ SamAuthenticator is a simple replace to Google Authenticator. The main feature o
### Who is SamAuthenticator for? ### 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. 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

View File

@ -209,6 +209,7 @@ class AuthenticatorGUI(QMainWindow):
self.keys_data_model_proxy = QSortFilterProxyModel() self.keys_data_model_proxy = QSortFilterProxyModel()
self.keys_data_model_proxy.setFilterCaseSensitivity(Qt.CaseInsensitive) self.keys_data_model_proxy.setFilterCaseSensitivity(Qt.CaseInsensitive)
self.keys_data_model = model.AuthenticatorKeysDataModel(keys) 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_data_model_proxy.setSourceModel(self.keys_data_model)
self.keys_table_view.setModel(self.keys_data_model_proxy) self.keys_table_view.setModel(self.keys_data_model_proxy)
@ -223,7 +224,9 @@ class AuthenticatorGUI(QMainWindow):
def load_geometry(self): def load_geometry(self):
settings = QSettings("SamApps", "SamAuthenticator") 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): def closeEvent(self, event):
settings = QSettings("SamApps", "SamAuthenticator") settings = QSettings("SamApps", "SamAuthenticator")

View File

@ -8,6 +8,8 @@ class KeyDataView(QTableView):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.data_model = None
self.add_key_dialog = AddKeyDialog() self.add_key_dialog = AddKeyDialog()
self.add_key_dialog.new_key_to_add_signal.connect(self.add_new_key) 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): def add_new_key(self, name, secret):
try: try:
self.model().getKeysObject().test_secret_validity(secret) self.data_model.getKeysObject().test_secret_validity(secret)
self.model().getKeysObject().set_secret(name, secret) self.data_model.getKeysObject().set_secret(name, secret)
self.model().refreshAll() self.data_model.refreshAll()
except Exception as e: except Exception as e:
self.add_key_dialog.close() self.add_key_dialog.close()
QMessageBox.warning(self, "Error", "Testing the secret you entered failed. " + str(e)) QMessageBox.warning(self, "Error", "Testing the secret you entered failed. " + str(e))
return return
def set_real_data_model(self, the_model):
self.data_model = the_model

2
SamAuthenticator/Meta.py Normal file
View File

@ -0,0 +1,2 @@
SOFTWARE_VERSION = "1.0.6"
__version__ = SOFTWARE_VERSION

View File

@ -1,2 +1,2 @@
from SamAuthenticator.Authenticator import * # from SamAuthenticator.Authenticator import *
from SamAuthenticator.AuthenticatorGUIApp import * # from SamAuthenticator.AuthenticatorGUIApp import *

View File

@ -1,4 +1,4 @@
import SamAuthenticator as auth from SamAuthenticator.AuthenticatorGUIApp import *
auth.start() start()

13
pip-build.bat Normal file
View File

@ -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

15
pip-build.sh Executable file
View File

@ -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

5
pip-install.bat Normal file
View File

@ -0,0 +1,5 @@
@echo off
python -c "import SamAuthenticator.Meta;print(SamAuthenticator.Meta.__version__)" > ver.txt
set /p VER=<ver.txt
call pip install dist\samauth-%VER%-py2.py3-none-any.whl --upgrade --verbose
call rm ver.txt

18
pip-install.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
#go to the directory of the script
reldir=`dirname $0`
cd $reldir
directory=`pwd`
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&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

1
pip-publish.bat Normal file
View File

@ -0,0 +1 @@
python setup.py register sdist upload

5
pip-publish.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
#python3 setup.py register sdist upload
twine upload dist/*.tar.gz

34
setup.py Normal file
View File

@ -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'
]}
)