Merge pull request #298 from lbryio/recaptcha

recaptcha
This commit is contained in:
Liam Cardenas 2017-12-22 19:06:50 -08:00 committed by GitHub
commit 0b4fa43683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 4 deletions

View file

@ -123,6 +123,8 @@ class Controller
$router->any('/youtube/sub', 'AcquisitionActions::executeYouTubeSub');
$router->any('/youtube/{campaignId:c}?', 'AcquisitionActions::executeYouTube');
$router->any('/yt2', 'AcquisitionActions::executeYT2');
$router->get('/verify/{token}', 'AcquisitionActions::executeVerify');
$router->post('/set-culture', 'i18nActions::setCulture');

View file

@ -45,5 +45,10 @@ class AcquisitionActions extends Actions
return ['acquisition/yt2', ['_no_layout' => true]];
}
public static function executeVerify(string $token)
{
return ['acquisition/verify', ['token' => $token]];
}
}

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Verify Your Identity</title>
<link rel="icon" href="images/favicon.ico">
<script src='https://www.google.com/recaptcha/api.js'></script>
<script type="text/javascript">
var magicLink = "#";
var verifyCallback = function(response) {
let payload = btoa(JSON.stringify({
recaptcha: response,
token: "<?php echo $token ?>"
}));
magicLink = "lbry://?verify=" + payload;
document.getElementById("magic-link-text").textContent = payload;
document.getElementById("success").style.display = "block";
};
var expiredCallback = function() {
document.getElementById("success").style.display = "none";
}
</script>
</head>
<body>
<div style="display: flex; align-items: center; flex-direction: column;" class="text-center">
<img src="/img/lbry-dark-1600x528.png" style="max-height: 80px; margin-top: 50px;" alt="LBRY"/>
<h1>Almost Done!</h1>
<p>Click the captcha to continue...</p>
<div class="g-recaptcha" data-sitekey="6LcG_z0UAAAAAKBPDBhiJU_jI9cRNRiJwcUHq95u" data-callback="verifyCallback" data-expired-callback="expiredCallback"></div>
<div style="display: none; margin-top: 10px;" id="success">
<p>Now click the magic link below to verify your identity in app...</p>
<a class="btn-primary btn-large spacer1" onclick="location.href=magicLink">Magic Link</a>
<p><i>Does the magic link not work? Not on the same device as the app? Paste this text into the verification screen instead.</i></p>
<code class="multiline-code" id="magic-link-text"></code>
</div>
</div>
</body>
</html>

View file

@ -30,7 +30,7 @@ pre
overflow-x: auto;
}
.code-bash
.multiline-code
{
-webkit-user-select: text;
-moz-user-select: text;
@ -47,10 +47,14 @@ pre
display: block;
word-wrap: break-word;
font-size: 0.75em;
}
.code-bash
{
@extend .multiline-code;
background: #222;
color: #fff;
font-size: 0.75em;
}
.code-bash__response {
@ -65,4 +69,4 @@ pre
margin-right: 5px;
color: lighten($color-primary, 20%);
@include user-select(none);
}
}