';
@@ -162,6 +165,7 @@ function do2fa($data, $user)
{
$mailmode = '';
$err = '';
+ $msg = '';
$setup = getparam('Setup', false);
if ($setup === 'Setup')
{
@@ -248,7 +252,10 @@ function do2fa($data, $user)
$tfa = null;
else
$tfa = $ans['2fa_status'];
- $pg = set_2fa($data, $user, $tfa, $ans, $err);
+ if (isset($ans['2fa_msg']))
+ $msg = $ans['2fa_msg'];
+
+ $pg = set_2fa($data, $user, $tfa, $ans, $err, $msg);
return $pg;
}
#
diff --git a/src/ckdb.h b/src/ckdb.h
index fcb313c3..af0ff79e 100644
--- a/src/ckdb.h
+++ b/src/ckdb.h
@@ -55,7 +55,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "1.0.2"
-#define CKDB_VERSION DB_VERSION"-1.240"
+#define CKDB_VERSION DB_VERSION"-1.241"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c
index 7ad2e25b..f4911289 100644
--- a/src/ckdb_cmd.c
+++ b/src/ckdb_cmd.c
@@ -213,7 +213,7 @@ static char *cmd_2fa(__maybe_unused PGconn *conn, char *cmd, char *id,
int32_t entropy, value;
USERS *users;
char *action, *buf = NULL, *st = NULL;
- char *sfa_status = EMPTY, *sfa_error = EMPTY;
+ char *sfa_status = EMPTY, *sfa_error = EMPTY, *sfa_msg = EMPTY;
bool ok = false, key = false;
LOGDEBUG("%s(): cmd '%s'", __func__, cmd);
@@ -301,7 +301,7 @@ static char *cmd_2fa(__maybe_unused PGconn *conn, char *cmd, char *id,
else {
key = false;
sfa_status = "ok";
- sfa_error = "2FA Enabled";
+ sfa_msg = "2FA Enabled";
}
// Report sfa_error to web
ok = true;
@@ -317,7 +317,7 @@ static char *cmd_2fa(__maybe_unused PGconn *conn, char *cmd, char *id,
ok = true;
sfa_status = EMPTY;
key = false;
- sfa_error = "2FA Cancelled";
+ sfa_msg = "2FA Cancelled";
}
} else if (strcmp(action, "new") == 0) {
// Can't new if 2FA isn't already present -> setup
@@ -359,7 +359,7 @@ static char *cmd_2fa(__maybe_unused PGconn *conn, char *cmd, char *id,
ok = true;
sfa_status = EMPTY;
key = false;
- sfa_error = "2FA Removed";
+ sfa_msg = "2FA Removed";
}
}
}
@@ -430,8 +430,9 @@ dame:
return strdup("failed.");
}
- snprintf(tmp, sizeof(tmp), "2fa_status=%s%c2fa_error=%s",
- sfa_status, FLDSEP, sfa_error);
+ snprintf(tmp, sizeof(tmp), "2fa_status=%s%c2fa_error=%s%c2fa_msg=%s",
+ sfa_status, FLDSEP, sfa_error, FLDSEP,
+ sfa_msg);
APPEND_REALLOC(buf, off, len, tmp);
LOGDEBUG("%s.%s-%s.%s", id, transfer_data(i_username), action, buf);
return buf;
|