Skip to content

Commit e6daab4

Browse files
authored
Merge pull request #39 from romeritoCL/google_fix
Updated with login again + disclaimer
2 parents f2929f2 + 8c0743a commit e6daab4

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

assets/js/security/login.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ $("#login-form").submit(function (event) {
44
event.preventDefault();
55
$("#g-recaptcha").effect("shake");
66
}
7-
});
7+
});
8+
9+
window.login = function ()
10+
{
11+
$('#login-form').submit();
12+
}

config/packages/framework.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ framework:
1010
handler_id: null
1111
cookie_secure: auto
1212
cookie_samesite: lax
13-
13+
cookie_lifetime: 0
14+
gc_maxlifetime: 300
1415
#esi: true
1516
#fragments: true
1617
php_errors:

config/packages/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ security:
3131
access_control:
3232
- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
3333
- { path: /favicon, roles: IS_AUTHENTICATED_ANONYMOUSLY }
34-
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } #change to ROLE_USER to authenticate the website
34+
- { path: ^/, roles: ROLE_USER } #change to IS_AUTHENTICATED_ANONYMOUSLY or ROLE_USER to authenticate the website
3535
enable_authenticator_manager: true

src/Controller/SecurityController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function login(AuthenticationUtils $authenticationUtils): Response
2727
}
2828

2929
$error = $authenticationUtils->getLastAuthenticationError();
30-
$lastUsername = $authenticationUtils->getLastUsername();
30+
$lastUsername = time() . '@paypal.com';
3131

3232
return $this->render(
3333
'security/login.html.twig',

templates/security/login.html.twig

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block body %}
44
<section class="jumbotron text-center">
55
<div class="container">
6-
<h1 class="jumbotron-heading">Please Login</h1>
6+
<h1 class="jumbotron-heading">Hello There!</h1>
77
<p class="lead text-muted">To prevent bots indexing this playground</p>
88
</div>
99
</section>
@@ -16,20 +16,15 @@
1616
You are logged in as {{ app.user.username }}, <a href="{{ path('app_logout') }}">Logout</a>
1717
</div>
1818
{% endif %}
19-
<h1 class="h4 mb-3 font-weight-normal">Use your creativity and type any email</h1>
19+
<h1 class="h4 mb-3 font-weight-normal">A human proof, must be accomplished</h1>
2020
<div class="row">
2121
<div class="col-4"></div>
2222
<div class="col-4">
2323
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
2424
<form id="login-form" action="{{ path('app_login') }}" method="post">
2525
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
26-
<div class="input-group mb-3">
27-
<input required autofocus type="email" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" placeholder="john@paypal.com" aria-label="john@paypal.com" aria-describedby="basic-addon2">
28-
<div class="input-group-append">
29-
<button class="btn btn-success" type="submit">GO</button>
30-
</div>
31-
</div>
32-
<div id="g-recaptcha" class="g-recaptcha" data-sitekey="{{ GOOGLE_RECAPTCHA_SITE_KEY }}"></div>
26+
<input required autofocus type="hidden" value="{{ last_username }}" name="email" id="inputEmail" class="form-control" placeholder="john@paypal.com" aria-label="john@paypal.com" aria-describedby="basic-addon2">
27+
<div id="g-recaptcha" class="g-recaptcha d-inline-block text-center" data-callback="login" data-sitekey="{{ GOOGLE_RECAPTCHA_SITE_KEY }}"></div>
3328
</form>
3429
</div>
3530
<div class="col-4"></div>

0 commit comments

Comments
 (0)