Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Marmiuton
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Lasri
Marmiuton
Commits
2a73ccf2
Commit
2a73ccf2
authored
Jan 3, 2022
by
Sofiane Lasri
Browse files
Options
Downloads
Patches
Plain Diff
moved back to recaptcha 2
parent
5ec31d05
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/controller/backTasks.php
+98
-104
98 additions, 104 deletions
core/controller/backTasks.php
pages/client/login.php
+3
-10
3 additions, 10 deletions
pages/client/login.php
pages/client/register.php
+4
-3
4 additions, 3 deletions
pages/client/register.php
with
105 additions
and
117 deletions
core/controller/backTasks.php
+
98
−
104
View file @
2a73ccf2
...
...
@@ -15,18 +15,16 @@ if(isset($_GET["checkUsernameEmail"]) && !empty($_GET["checkUsernameEmail"])){
$return
=
null
;
if
(
!
empty
(
$_POST
)){
// On va s'assurer qu'il ne s'agisse pas d'un bot
if
(
isset
(
$_POST
[
'recaptcha
_
response'
])){
if
(
isset
(
$_POST
[
'
g-
recaptcha
-
response'
])){
// Build POST request:
$recaptcha_url
=
'https://www.google.com/recaptcha/api/siteverify'
;
$recaptcha_secret
=
'6LfuDOYdAAAAABZDsplfnL8C5xGaE1-5MyyobuEF'
;
$recaptcha_response
=
$_POST
[
'recaptcha
_
response'
];
$recaptcha_response
=
$_POST
[
'
g-
recaptcha
-
response'
];
// Make and decode POST request:
$recaptcha
=
file_get_contents
(
$recaptcha_url
.
'?secret='
.
$recaptcha_secret
.
'&response='
.
$recaptcha_response
);
$recaptcha
=
json_decode
(
$recaptcha
);
if
(
$recaptcha
->
success
==
1
){
// Take action based on the score returned:
if
(
$recaptcha
->
score
>=
0.5
){
// On va regarder de quel type de formulaire il s'agit
if
(
isset
(
$_POST
[
'registerUsername'
]))
{
// Il s'agit d'une inscription
...
...
@@ -160,10 +158,6 @@ if(isset($_GET["checkUsernameEmail"]) && !empty($_GET["checkUsernameEmail"])){
}
else
{
$return
[
"error"
]
=
'Type de formulaire inconnu'
;
}
}
else
{
$return
[
"error"
]
=
"Le reCAPTCHA t'as identifié comme un robot. Re-essaie plus-tard."
;
}
}
else
{
$return
[
"error"
]
=
"Nous rencontrons un problème avec le reCAPTCHA:"
;
foreach
(
$recaptcha
->
{
'error-codes'
}
as
$return
[
"error"
]){
...
...
This diff is collapsed.
Click to expand it.
pages/client/login.php
+
3
−
10
View file @
2a73ccf2
...
...
@@ -17,15 +17,7 @@
<link
rel=
"stylesheet"
href=
"pages/assets/css/connexion.css"
>
<!-- Recaptcha -->
<script
src=
"https://www.google.com/recaptcha/api.js?render=6LfuDOYdAAAAAEf8Ii1uzBXHVoUfeI2CK38US1-N"
></script>
<script>
grecaptcha
.
ready
(
function
()
{
grecaptcha
.
execute
(
'
6LfuDOYdAAAAAEf8Ii1uzBXHVoUfeI2CK38US1-N
'
,
{
action
:
'
contact
'
}).
then
(
function
(
token
)
{
var
recaptchaResponse
=
document
.
getElementById
(
'
recaptchaResponse
'
);
recaptchaResponse
.
value
=
token
;
});
});
</script>
<script
src=
"https://www.google.com/recaptcha/api.js"
async
defer
></script>
</head>
<body>
<div
class=
"container h-100"
>
...
...
@@ -61,8 +53,9 @@
</div>
</div>
<div
class=
"g-recaptcha"
data-sitekey=
"6Ld3jukdAAAAAFLO9t2Uyc3c9bru4kTcwffcG3mE"
></div>
<br/>
<button
type=
"button"
name=
"submit"
id=
"loginBtn"
class=
"btn btn-orange"
>
Se connecter
</button>
<input
type=
"hidden"
name=
"recaptcha_response"
id=
"recaptchaResponse"
>
<a
href=
"/register"
class=
"text-orange"
>
Pas encore inscrit? 😢
</a>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
pages/client/register.php
+
4
−
3
View file @
2a73ccf2
...
...
@@ -15,10 +15,10 @@
<meta
content=
"#ed8930"
data-react-helmet=
"true"
name=
"theme-color"
/>
<!-- Recaptcha -->
<script
src=
"https://www.google.com/recaptcha/api.js
?render=6LfuDOYdAAAAAEf8Ii1uzBXHVoUfeI2CK38US1-N"
></script>
<script
src=
"https://www.google.com/recaptcha/api.js
"
async
defer
></script>
<script>
grecaptcha
.
ready
(
function
()
{
grecaptcha
.
execute
(
'
6L
fuDOY
dAAAAA
Ef8Ii1uzBXHVoUfeI2CK38US1-N
'
,
{
action
:
'
contact
'
}).
then
(
function
(
token
)
{
grecaptcha
.
execute
(
'
6L
d3juk
dAAAAA
FLO9t2Uyc3c9bru4kTcwffcG3mE
'
,
{
action
:
'
contact
'
}).
then
(
function
(
token
)
{
var
recaptchaResponse
=
document
.
getElementById
(
'
recaptchaResponse
'
);
recaptchaResponse
.
value
=
token
;
});
...
...
@@ -92,8 +92,9 @@
</div>
</div>
<div
class=
"g-recaptcha"
data-sitekey=
"6Ld3jukdAAAAAFLO9t2Uyc3c9bru4kTcwffcG3mE"
></div>
<br/>
<button
type=
"button"
id=
"registerBtn"
class=
"btn btn-orange"
>
S'inscrire
</button>
<input
type=
"hidden"
name=
"recaptcha_response"
id=
"recaptchaResponse"
>
<a
href=
"/login"
class=
"text-orange"
>
Déjà inscrit? 🌈
</a>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment