Skip to content

Commit

Permalink
some minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acioni authored and acioni committed Jun 14, 2016
1 parent eafa9b0 commit ab59620
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AsyncPostTask extends AsyncTask<String,Integer,Boolean> {

private static final String USER_AGENT = "Mozilla/5.0";


private AsyncPostResponse responseCallback = null;

public AsyncPostTask(AsyncPostResponse r) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class KeelinkDefs {

public static final String TARGET_SITE = "http://andysite.altervista.org/keepass";
public static final String TARGET_SITE = "https://keelink.cloud";

public static final String RECENT_PREFERENCES_ENTRY = "recentHistory";
public static final String FLAG_FAST_SEND= "fastSend";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
validSidReceived(content, passwordReceived);
} else {
Log.e(TAG, "Invalid code:" + content);
Toast.makeText(this, "Invalid QR code scanned!", Toast.LENGTH_SHORT).show();
new SweetAlertDialog(MainActivity.this, SweetAlertDialog.ERROR_TYPE)
.setTitleText("Error")
.setContentText("This is not a KeeLink QR code!").show();
}

}
Expand All @@ -350,15 +352,20 @@ private void validSidReceived(String sid, String password) {
keeLink.sendKey(sid, password, new AsyncPostResponse() {
@Override
public void response(boolean result) {
if (result)
Toast.makeText(getApplicationContext(), "Password correctly sent", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(), "Password NOT correctly sent. Try again...", Toast.LENGTH_SHORT).show();
if (result) {
new SweetAlertDialog(MainActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("OK")
.setContentText("Password was sent, wait the arriving on your page!").show();
}
else {
new SweetAlertDialog(MainActivity.this, SweetAlertDialog.ERROR_TYPE)
.setTitleText("Error")
.setContentText("There was an error comunicating with the server, try again.").show();
}

}
});
} else
Toast.makeText(this, "No network connection available!", Toast.LENGTH_SHORT).show();
}

}

Expand Down
7 changes: 6 additions & 1 deletion web/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#logo-container img {
height: 80px;
margin-bottom: 10px;
margin-top: 10px;
}

#qrcode {
transition-property: opacity;
Expand All @@ -22,7 +27,7 @@
}

#content{
margin-top: 100px;
margin-top: 10px;
z-index: 0;
position: absolute;
}
Expand Down
2 changes: 1 addition & 1 deletion web/css/sweetalert.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ body.stop-scrolling {
font-weight: 500;
-webkit-border-radius: 4px;
border-radius: 5px;
padding: 10px 32px;
/*padding: 10px 32px; conflict with skelethon*/
margin: 26px 5px 0 5px;
cursor: pointer; }
.sweet-alert button:focus {
Expand Down
19 changes: 13 additions & 6 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<nav class="navbar">
<div class="container">
<ul class="navbar-list">
<li class="navbar-item"><a class="navbar-link" href="#"> <img src="images/favicon.ico"/> KeeLink</a></li>
<li class="navbar-item"><a class="navbar-link" href="#"><u>KeeLink</u></a></li>
<li class="navbar-item"><a class="navbar-link" href="#howto"> How To</a></li>
<li class="navbar-item"><a class="navbar-link" href="#howworks"> How it works </a></li>
<li class="navbar-item"><a class="navbar-link" href="#credits">Credits</a></li>
Expand All @@ -62,11 +62,18 @@
<div id="content">

<div id="qrplaceholder" class="container">
<div style="height:10%"></div>
<div class="row"><div class="twelve columns">
<p class="content-font" align="center"><b>Use this QR code to share a password from Keepass to this device</b></p>
</div>
</div>

<div class="row">
<div align="center" class="twelve columns" id="logo-container">
<img src="images/logo.png">
</div>
</div>

<div class="row">
<div class="twelve columns">
<p class="content-font" align="center"><b>Use this QR code to share a password from Keepass to this device</b></p>
</div>
</div>

<div class="row"><div class="twelve columns">&nbsp;</div></div>

Expand Down
2 changes: 1 addition & 1 deletion web/keelink.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static public function initNewSession() {
$jresp['message'] = "Error(4): Chapta required";
} else {
$sqlInserUser = "INSERT INTO `USER`(`USER_ID`) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "') ON DUPLICATE KEY UPDATE USER.SID_CREATED=USER.SID_CREATED+1, USER.LAST_ACCESS=CURRENT_TIMESTAMP";
$sqlInsertSID = "INSERT IGNORE INTO `KEEPASS`(`SESSION_ID`,`USER_ID`) VALUES ('" . $sid . "','". $_SERVER['REMOTE_ADDR'] ."')";
$sqlInsertSID = "INSERT INTO `KEEPASS`(`SESSION_ID`,`USER_ID`) VALUES ('" . $sid . "','". $_SERVER['REMOTE_ADDR'] ."') ON DUPLICATE KEY UPDATE KEEPASS.CREATION_DATE=CURRENT_TIMESTAMP";

if ($conn->query($sqlInserUser) === TRUE) {
if ($conn->query($sqlInsertSID) === TRUE) {
Expand Down
21 changes: 20 additions & 1 deletion web/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ $(document).ready(
init();

function init() {

detectHttpProtocol();

if(_query_string && (_query_string.onlyinfo === true || _query_string.onlyinfo === 'true')) {
$("#qrplaceholder").hide();
} else {
Expand Down Expand Up @@ -46,6 +49,23 @@ $(document).ready(
});
}

function detectHttpProtocol() {
if (window.location.protocol != "https:") {
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonText: "Go safe!",
cancelButtonText: "Stay here...",
closeOnConfirm: false
},
function(){
window.location.href = "https:" + window.location.href.substring(window.location.protocol.length);
});
}
}

function parseWindowURL() {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
Expand Down Expand Up @@ -101,7 +121,6 @@ $(document).ready(
$("#copyBtn").attr("data-clipboard-text",password);

new Clipboard('#copyBtn');
new Clipboard('#moreBtn');
new Clipboard('#clearBtn');
}

Expand Down

0 comments on commit ab59620

Please sign in to comment.