Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Adjust qr generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Lux committed Nov 4, 2020
1 parent c923647 commit bf8e7ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions privacyidea_pam.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def set_token_type(self):
pam_message_choice = self.pamh.Message(self.pamh.PAM_PROMPT_ECHO_ON,
"Please choose the token to generate:\n"
"[1] Email\n"
"[2] Push (Android Only)\n"
"[2] Push\n"
"[3] Google Authenticator\n")
response_choice = self.pamh.conversation(pam_message_choice)
syslog.syslog(syslog.LOG_DEBUG,
Expand Down Expand Up @@ -242,14 +242,14 @@ def enroll_user(self, user):
"You don't any have token yet.")
info = self.pamh.conversation(pam_message)
# Token type choosing
data = self.set_token_type()
enroll_data = self.set_token_type()
# Ask for pin
data["pin"] = self.set_pin()
enroll_data["pin"] = self.set_pin()

if self.realm:
data["realm"] = self.realm
enroll_data["realm"] = self.realm

json_response = self.make_request(data, endpoint="/token/init",
json_response = self.make_request(enroll_data, endpoint="/token/init",
api_token=self.api_token)

result = json_response.get("result")
Expand All @@ -266,9 +266,10 @@ def enroll_user(self, user):
otp_link = False
if "pushurl" in detail:
otp_link = detail["pushurl"]["value"]
# BUG: otpauth qr code generated does no work and is too big for terminals
if "googleurl" in detail:
otp_link = detail["googleurl"]["value"]
# BUG: otpauth qr code generated does no work and is too big for terminals
if enroll_data["type"] == "totp":
qr = generate_qr(otp_link)
self.pamh.conversation(self.pamh.Message(self.pamh.PAM_TEXT_INFO, qr))
if otp_link:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup

VERSION = "2.14.dev0"
VERSION = "2.15.dev0"

install_requires = [
'requests>=2.23',
Expand Down

0 comments on commit bf8e7ab

Please sign in to comment.