Skip to content

Commit

Permalink
Fix credentials parsing
Browse files Browse the repository at this point in the history
Issue: #14
  • Loading branch information
fdw committed Jun 6, 2021
1 parent 8438a5d commit 32b065e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
23 changes: 13 additions & 10 deletions src/rofi_rbw/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ def __init__(self, data: str) -> None:
self.totp = ""

# Parse rbw output
self.password, *rest = data.split('\n')
self.password, *rest = data.strip().split('\n')
for line in rest:
key, value = line.rsplit(": ", 1)
if key == "Username":
self.username = value
elif key == "TOTP Secret":
try:
import pyotp
self.totp = pyotp.parse_uri(value).now()
except ModuleNotFoundError:
pass
try:
key, value = line.split(": ", 1)
if key == "Username":
self.username = value
elif key == "TOTP Secret":
try:
import pyotp
self.totp = pyotp.parse_uri(value).now()
except ModuleNotFoundError:
pass
except ValueError:
pass
2 changes: 1 addition & 1 deletion src/rofi_rbw/rofi_rbw.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from credentials import Credentials
from paths import *

__version__ = '0.4.0'
__version__ = '0.4.1'


class RofiRbw(object):
Expand Down
7 changes: 5 additions & 2 deletions src/rofi_rbw/selector.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from rofi_rbw.abstractionhelper import is_wayland, is_installed

from typing import List, Tuple
from subprocess import run

try:
from rofi_rbw.abstractionhelper import is_wayland, is_installed
except:
from abstractionhelper import is_wayland, is_installed


class Selector:
@staticmethod
Expand Down

2 comments on commit 32b065e

@slikie
Copy link
Contributor

@slikie slikie commented on 32b065e Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 0.4.0 is broken because lack of this patch. Please release a new version so downstream can actually use it.

@fdw
Copy link
Owner Author

@fdw fdw commented on 32b065e Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still an issue open (#14) where I was asking whether this patch is enough to fix it. I don't like to push out untested versions.

Please sign in to comment.