Skip to content

Commit

Permalink
2.1.25
Browse files Browse the repository at this point in the history
Fixes for #1149, #1152
  • Loading branch information
nilsteampassnet committed Jan 11, 2016
1 parent f8479a7 commit ee90115
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
1 change: 1 addition & 0 deletions includes/language/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
global $LANG;
$LANG = array (
'error_bad_credentials' => 'Login credentials do not correspond!',
'user_ga_code' => 'Send GoogleAuthenticator to user by email',
'send_ga_code' => 'Google Authenticator for user',
'error_no_email' => 'This user has no email set!',
Expand Down
7 changes: 3 additions & 4 deletions load.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ function(data) {
$("#connection_error").html("' . $LANG['psk_required'] . '");
$("#connection_error, #connect_psk_confirm").show();
} else if (data[0].value == "user_not_exists") {
$("#connection_error").html("'.$LANG['user_not_exists'].'").show();
console.log("'.$LANG['user_not_exists'].'");
$("#connection_error").html("'.$LANG['error_bad_credentials'].'").show();
} else if (!isNaN(parseFloat(data[0].value)) && isFinite(data[0].value)) {
$("#connection_error").html(data + "'.$LANG['login_attempts_on'].(@$_SESSION['settings']['nb_bad_authentication'] + 1).'").show();
} else if (data[0].value == "error") {
Expand All @@ -248,11 +247,11 @@ function(data) {
} else if (data[0].value == "false_onetimepw") {
$("#connection_error").html("'.$LANG['bad_onetime_password'].'").show();
} else if (data[0].error == "bad_credentials") {
$("#connection_error").html("'.$LANG['index_bas_pw'].'").show();
$("#connection_error").html("'.$LANG['error_bad_credentials'].'").show();
} else if (data[0].error == "ga_code_wrong") {
$("#connection_error").html("'.$LANG['ga_bad_code'].'").show();
} else {
$("#connection_error").html("'.$LANG['index_bas_pw'].'").show();
$("#connection_error").html("'.$LANG['error_bad_credentials'].'").show();
}
$("#ajax_loader_connexion").hide();
},
Expand Down
50 changes: 27 additions & 23 deletions sources/admin.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,29 +1141,33 @@
$_SESSION['settings']['2factors_authentication'] = htmlspecialchars_decode($dataReceived['2factors_authentication']);

// ga_website_name
DB::query("SELECT * FROM ".prefix_table("misc")." WHERE type = %s AND intitule = %s", "admin", "ga_website_name");
$counter = DB::count();
if ($counter == 0) {
DB::insert(
prefix_table("misc"),
array(
'type' => "admin",
"intitule" => "ga_website_name",
'valeur' => htmlspecialchars_decode($dataReceived['ga_website_name'])
)
);
} else {
DB::update(
prefix_table("misc"),
array(
'valeur' => htmlspecialchars_decode($dataReceived['ga_website_name'])
),
"type = %s AND intitule = %s",
"admin",
"ga_website_name"
);
}
$_SESSION['settings']['ga_website_name'] = htmlspecialchars_decode($dataReceived['ga_website_name']);
if (!is_null($dataReceived['ga_website_name'])) {
DB::query("SELECT * FROM ".prefix_table("misc")." WHERE type = %s AND intitule = %s", "admin", "ga_website_name");
$counter = DB::count();
if ($counter == 0) {
DB::insert(
prefix_table("misc"),
array(
'type' => "admin",
"intitule" => "ga_website_name",
'valeur' => htmlspecialchars_decode($dataReceived['ga_website_name'])
)
);
} else {
DB::update(
prefix_table("misc"),
array(
'valeur' => htmlspecialchars_decode($dataReceived['ga_website_name'])
),
"type = %s AND intitule = %s",
"admin",
"ga_website_name"
);
}
$_SESSION['settings']['ga_website_name'] = htmlspecialchars_decode($dataReceived['ga_website_name']);
} else {
$_SESSION['settings']['ga_website_name'] = "";
}

// send data
echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
Expand Down

0 comments on commit ee90115

Please sign in to comment.