[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: fix base32 encoder to match
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: fix base32 encoder to match totp standard |
Date: |
Sun, 26 Sep 2021 20:20:35 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 3e09498 fix base32 encoder to match totp standard
3e09498 is described below
commit 3e09498c42246a23632f0e3a30507612667f322c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 26 20:20:33 2021 +0200
fix base32 encoder to match totp standard
---
contrib/anastasis_gtk_auth_add_totp.glade | 4 +--
contrib/anastasis_gtk_main_window.glade | 16 ++++++------
src/anastasis/anastasis-gtk_action.c | 31 ++++++++++++++++++++----
src/anastasis/anastasis-gtk_handle-method-totp.c | 16 ++++++------
4 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/contrib/anastasis_gtk_auth_add_totp.glade
b/contrib/anastasis_gtk_auth_add_totp.glade
index 83aea5d..0f8a30f 100644
--- a/contrib/anastasis_gtk_auth_add_totp.glade
+++ b/contrib/anastasis_gtk_auth_add_totp.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2
+<!-- Generated with glade 3.38.2
Copyright (C) 2019-2021 Anastasis SARL
@@ -60,7 +60,7 @@ Author: Belen Pena, Christian Grothoff, Dennis Neufeld
<object class="GtkButton"
id="anastasis_gtk_b_email_dialog_btn_ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
- <property name="sensitive">False</property>
+ <property name="sensitive">True</property>
<property name="can-focus">False</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
diff --git a/contrib/anastasis_gtk_main_window.glade
b/contrib/anastasis_gtk_main_window.glade
index ddc546d..53ee01c 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -365,6 +365,13 @@ Author: Christian Grothoff, Dennis Neufeld
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkImage" id="video_image">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-right">5</property>
+ <property name="margin-end">5</property>
+ <property
name="pixbuf">outline_video_camera_front_black_24dp.png</property>
+ </object>
<object class="GtkWindow" id="anastasis_gtk_main_window">
<property name="can-focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK |
GDK_STRUCTURE_MASK</property>
@@ -2220,7 +2227,7 @@ You can also use "back" to add additional authentication
methods.</property>
</child>
</object>
<packing>
- <property
name="expand">False</property>
+ <property
name="expand">True</property>
<property
name="fill">True</property>
<property
name="position">1</property>
</packing>
@@ -3940,11 +3947,4 @@ select a different provider or backup version.</property>
</object>
</child>
</object>
- <object class="GtkImage" id="video_image">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-right">5</property>
- <property name="margin-end">5</property>
- <property
name="pixbuf">outline_video_camera_front_black_24dp.png</property>
- </object>
</interface>
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index 4f754b2..f36fa6e 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -2560,6 +2560,7 @@ render_feedback (GtkBuilder *builder,
const char *taler_pay_uri = NULL;
uint32_t ec = 0;
uint32_t http_status = 0;
+ bool hide = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("state",
&state),
@@ -2655,7 +2656,20 @@ render_feedback (GtkBuilder *builder,
else
{
const char *ihint;
+ const char *type = "Error";
+ switch (code)
+ {
+ case TALER_EC_ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED:
+ hide = true;
+ type = "Hint";
+ break;
+ case TALER_EC_ANASTASIS_TRUTH_CHALLENGE_ACTIVE:
+ type = "Hint";
+ break;
+ default:
+ break;
+ }
ihint = TALER_ErrorCode_get_hint (code);
if ( (NULL != hint) &&
( (NULL == ihint) ||
@@ -2667,11 +2681,13 @@ render_feedback (GtkBuilder *builder,
{
if (NULL == ihint)
GNUNET_asprintf (&msg,
- "Error #%u",
+ "%s #%u",
+ type,
(unsigned int) code);
else
GNUNET_asprintf (&msg,
- "Error #%u: %s",
+ "%s #%u: %s",
+ type,
(unsigned int) code,
ihint);
}
@@ -2679,12 +2695,14 @@ render_feedback (GtkBuilder *builder,
{
if (NULL == ihint)
GNUNET_asprintf (&msg,
- "Error #%u (%s)",
+ "%s #%u (%s)",
+ type,
(unsigned int) code,
detail);
else
GNUNET_asprintf (&msg,
- "Error #%u: %s (%s)",
+ "%s #%u: %s (%s)",
+ type,
(unsigned int) code,
ihint,
detail);
@@ -2701,7 +2719,10 @@ render_feedback (GtkBuilder *builder,
gtk_label_set_text (elabel,
msg);
GNUNET_free (msg);
- gtk_widget_show (GTK_WIDGET (elabel));
+ if (hide)
+ gtk_widget_hide (GTK_WIDGET (elabel));
+ else
+ gtk_widget_show (GTK_WIDGET (elabel));
GNUNET_JSON_parse_free (spec);
}
diff --git a/src/anastasis/anastasis-gtk_handle-method-totp.c
b/src/anastasis/anastasis-gtk_handle-method-totp.c
index c4faa5c..0863f0b 100644
--- a/src/anastasis/anastasis-gtk_handle-method-totp.c
+++ b/src/anastasis/anastasis-gtk_handle-method-totp.c
@@ -38,7 +38,7 @@ static char totp[32];
/**
- * Compute RFC 4648 base32 encoding of @a val and write
+ * Compute RFC 3548 base32 encoding of @a val and write
* result to @a enc.
*
* @param val value to encode
@@ -51,9 +51,9 @@ base32enc (const void *val,
char *enc)
{
/**
- * 32 characters for encoding, using RFC 4648.
+ * 32 characters for encoding, using RFC 3548.
*/
- static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTV";
+ static char *encTable__ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
unsigned int wpos;
unsigned int rpos;
unsigned int bits;
@@ -130,10 +130,10 @@ refresh_totp (GtkBuilder *builder)
gtk_image_set_from_pixbuf (img,
pb);
g_object_unref (pb);
- gtk_widget_set_sensitive (
- GTK_WIDGET (gtk_builder_get_object (builder,
-
"anastasis_gtk_b_totp_dialog_btn_ok")),
- true);
+ gtk_widget_set_sensitive (
+ GTK_WIDGET (gtk_builder_get_object (builder,
+
"anastasis_gtk_b_totp_dialog_btn_ok")),
+ true);
}
}
@@ -206,7 +206,7 @@ anastasis_gtk_b_totp_dialog_name_entry_changed_cb (GtkEntry
*entry,
*/
void
anastasis_gtk_btn_add_auth_totp_clicked_cb (GObject *object,
- gpointer user_data)
+ gpointer user_data)
{
GtkWidget *ad;
GtkBuilder *builder;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: fix base32 encoder to match totp standard,
gnunet <=