Beispiel #1
0
def setSecret(wallet_id, password=None):
    settings = Config()
    client = SFLvaultClient(str(settings.fileName()))

    # Disable wallet
    if wallet_id == '0':
        client.cfg.wallet_set(wallet_id, None)
        return True
    # Check if sflvault item exists
    if getSecret() != False:
        question = QtGui.QMessageBox(
            QtGui.QMessageBox.Question,
            "Save password in your wallet",
            "This password already exists."
            "Do you want to replace it ?",
        )
        question.addButton(QtGui.QMessageBox.Save)
        question.addButton(QtGui.QMessageBox.Cancel)
        # Ask to user if he wants to replace old password
        ret = question.exec_()
        if ret == QtGui.QMessageBox.Cancel:
            # Do nothing
            return False
        # Simplify code or keep it simple to understand ?
        else:
            # Replace password
            try:
                return client.cfg.wallet_set(wallet_id, password)
            except Exception, e:
                ErrorMessage(e)
                return False
Beispiel #2
0
def setSecret(wallet_id, password=None):
    settings = Config()
    client = SFLvaultClient(str(settings.fileName()))

    # Disable wallet
    if wallet_id == "0":
        client.cfg.wallet_set(wallet_id, None)
        return True
    #  Check if sflvault item exists
    if getSecret() != False:
        question = QtGui.QMessageBox(
            QtGui.QMessageBox.Question,
            "Save password in your wallet",
            "This password already exists." "Do you want to replace it ?",
        )
        question.addButton(QtGui.QMessageBox.Save)
        question.addButton(QtGui.QMessageBox.Cancel)
        #  Ask to user if he wants to replace old password
        ret = question.exec_()
        if ret == QtGui.QMessageBox.Cancel:
            # Do nothing
            return False
        # Simplify code or keep it simple to understand ?
        else:
            # Replace password
            try:
                return client.cfg.wallet_set(wallet_id, password)
            except Exception, e:
                ErrorMessage(e)
                return False
Beispiel #3
0
from PyQt4 import QtCore, QtGui
from Crypto.PublicKey import ElGamal

from sflvault.client import SFLvaultClient
from sflvault.clientqt.gui.config.config import Config
from error import *

try:
    import keyring
except:
    print "No keyring system supported"

client = None
error_message = QtCore.QObject()

settings = Config()
client_alias = SFLvaultClient(str(settings.fileName()))


def manual_auth():
    password, ok = QtGui.QInputDialog.getText(
        None,
        "SFLvault password",
        "Type your SFLvault password",
        QtGui.QLineEdit.Password,
    )
    return str(password)


def getSecret():
    wallet_setting = str(settings.value("SFLvault/wallet").toString())
Beispiel #4
0
from PyQt4 import QtCore, QtGui
from Crypto.PublicKey import ElGamal

from sflvault.client import SFLvaultClient
from sflvault.clientqt.gui.config.config import Config
from error import *

try:
    import keyring
except:
    print "No keyring system supported"

client = None
error_message = QtCore.QObject()

settings = Config()
client_alias = SFLvaultClient(str(settings.fileName()))


def manual_auth():
    password, ok = QtGui.QInputDialog.getText(
        None, "SFLvault password", "Type your SFLvault password", QtGui.QLineEdit.Password
    )
    return str(password)


def getSecret():
    wallet_setting = str(settings.value("SFLvault/wallet").toString())
    if hasattr(keyring.backend, wallet_setting):
        keyring_backend = getattr(keyring.backend, wallet_setting)()
        secret = keyring_backend.get_password("sflvault", str(settings.fileName()))