join: migrate registration form to Forgejo backend #22
7 changed files with 103 additions and 21 deletions
|
@ -46,6 +46,7 @@ add_plugins:
|
|||
- typography
|
||||
- sidebar2
|
||||
- po
|
||||
- inline
|
||||
# plugins to disable
|
||||
disable_plugins:
|
||||
- htmlscrubber
|
||||
|
|
BIN
join.fr.mo
BIN
join.fr.mo
Binary file not shown.
14
join.fr.po
14
join.fr.po
|
@ -7,19 +7,20 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ilot.io\n"
|
||||
"POT-Creation-Date: 2024-10-08 11:35-0400\n"
|
||||
"PO-Revision-Date: 2024-10-08 11:29-0400\n"
|
||||
"POT-Creation-Date: 2025-04-03 18:26-0400\n"
|
||||
"PO-Revision-Date: 2025-04-03 18:36-0400\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: dev@ayakael.net\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.4.3\n"
|
||||
"X-Generator: Poedit 3.5\n"
|
||||
|
||||
#. type: Content of: outside any tag (error?)
|
||||
msgid "[[!meta title=\"Join\"]]"
|
||||
msgstr "[[!meta title=\"Se joindre\"]]"
|
||||
msgid "[[!meta title=\"Join\"]] [[!inline pages=\"join/join-en\" raw=\"yes\"]]"
|
||||
msgstr ""
|
||||
"[[!meta title=\"Se joindre\"]] [[!inline pages=\"join/join-fr\" raw=\"yes\"]]"
|
||||
|
||||
#. type: Content of: <header><h1>
|
||||
msgid "Registration Form"
|
||||
|
@ -220,6 +221,9 @@ msgstr ""
|
|||
"maxlength=\"50\"></p> <input type=\"button\" value=\"Soumettre\" id = "
|
||||
"\"submit\" onClick = \"createIssue()\"> </form>"
|
||||
|
||||
#~ msgid "[[!meta title=\"Join\"]]"
|
||||
#~ msgstr "[[!meta title=\"Se joindre\"]]"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "async function checkDuplicate() { var url='https://lab.ilot.io/api/v4/"
|
||||
#~ "projects/99/issues'; var email = document.getElementById(\"email\")."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[[!meta title="Join"]]
|
||||
|
||||
<script src="../js/join.js"></script>
|
||||
[[!inline pages="join/join-en" raw="yes"]]
|
||||
|
||||
<header class="text-center">
|
||||
<h1 class="post-title">Registration Form</h1>
|
||||
|
|
4
join.pot
4
join.pot
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-10-08 11:35-0400\n"
|
||||
"POT-Creation-Date: 2025-04-03 18:27-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. type: Content of: outside any tag (error?)
|
||||
msgid "[[!meta title=\"Join\"]]"
|
||||
msgid "[[!meta title=\"Join\"]] [[!inline pages=\"join/join-en\" raw=\"yes\"]]"
|
||||
msgstr ""
|
||||
|
||||
#. type: Content of: <header><h1>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<script>
|
||||
async function checkDuplicate() {
|
||||
var url='https://lab.ilot.io/api/v4/projects/99/issues';
|
||||
var url='https://forge.ilot.io/api/v1/repos/ilot/registration/issues';
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
|
@ -20,28 +21,28 @@
|
|||
}
|
||||
|
||||
async function createIssue() {
|
||||
var baseurl = 'https://lab.ilot.io/api/v4/projects/99/issues?&labels=Request';
|
||||
var url = 'https://forge.ilot.io/api/v1/repos/ilot/registration/issues';
|
||||
var mathspamtrap = document.getElementById("math-spam-trap").value;
|
||||
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
if(!agreetoterms) {
|
||||
alert("Registration requires agreement of Code of Conduct");
|
||||
alert("Registration requires agreement of Code of Conduct.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!email) {
|
||||
alert("Email cannot be empty");
|
||||
alert("Email cannot be empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mathspamtrap != "9") {
|
||||
alert("Wrong math answer");
|
||||
alert("Wrong math answer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(await checkDuplicate(email) === true) {
|
||||
alert("This email address has already requested an account");
|
||||
alert("This email address has already requested an account.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -49,29 +50,28 @@
|
|||
var name = name.replace (/^/,'Name: ');
|
||||
var aboutme = document.getElementById("about-me").value;
|
||||
var aboutme = aboutme.replace (/^/,'About me: ');
|
||||
var aboutme = aboutme.replace(/\r?\n/g, "%0A%0A");
|
||||
var howfound = document.getElementById("how-found").value;
|
||||
var howfound = howfound.replace (/^/,'How I found ilot: ');
|
||||
var howfound = howfound.replace(/\r?\n/g, "%0A%0A");
|
||||
var ocuser = document.getElementById("oc-user").value;
|
||||
var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
||||
var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound + "%0A%0A" + ocuser;
|
||||
var url = baseurl.concat("&title=", email, "&description=", description);
|
||||
var description = name + "\n\n" + aboutme + "\n\n" + howfound + "\n\n" + ocuser;
|
||||
console.log('Description:', description);
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
||||
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ title: email, body: description }),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
console.log('Success:', result);
|
||||
alert("Request submitted. A working group member will process your registration shortly. If you receive no contact within seven days of registration, please send an email to support@ilot.io");
|
||||
alert("Request submitted. A working group member will process your registration shortly. If you receive no contact within seven days of registration, please send an email to support@ilot.io.");
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error)
|
||||
});
|
||||
}
|
||||
</script>
|
77
join/join-fr.html
Normal file
77
join/join-fr.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<script>
|
||||
async function checkDuplicate() {
|
||||
var url='https://forge.ilot.io/api/v1/repos/ilot/registration/issues';
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
const result = await response.json();
|
||||
let index = result
|
||||
.findIndex(item => item.title === email);
|
||||
|
||||
if (index !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function createIssue() {
|
||||
var url = 'https://forge.ilot.io/api/v1/repos/ilot/registration/issues';
|
||||
var mathspamtrap = document.getElementById("math-spam-trap").value;
|
||||
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
||||
var email = document.getElementById("email").value;
|
||||
|
||||
if(!agreetoterms) {
|
||||
alert("Vous devez être en accord avec notre code de conduite.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!email) {
|
||||
alert("Le courriel ne peut pas être vide.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mathspamtrap != "9") {
|
||||
alert("Ceci n'est pas la bonne réponse à l'exercise mathématique.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(await checkDuplicate(email) === true) {
|
||||
alert("Ce courriel a déjà fait l'objet d'une demande de compte.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var name = document.getElementById("name").value;
|
||||
var name = name.replace (/^/,'Name: ');
|
||||
var aboutme = document.getElementById("about-me").value;
|
||||
var aboutme = aboutme.replace (/^/,'About me: ');
|
||||
var howfound = document.getElementById("how-found").value;
|
||||
var howfound = howfound.replace (/^/,'How I found ilot: ');
|
||||
var ocuser = document.getElementById("oc-user").value;
|
||||
var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
||||
var description = name + "\n\n" + aboutme + "\n\n" + howfound + "\n\n" + ocuser;
|
||||
console.log('Description:', description);
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ title: email, body: description }),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
console.log('Success:', result);
|
||||
alert("Votre demande a été soumise. Un membre d'un groupe de travail va traiter votre demande sous peu. Si vous ne recevez pas de nouvelle d'ici sept jours, contactez-vous via support@ilot.io.");
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error)
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Add table
Reference in a new issue