join: migrate registration form to Forgejo backend
All checks were successful
/ preview (pull_request) Successful in 38s
All checks were successful
/ preview (pull_request) Successful in 38s
This commit is contained in:
parent
aec1460de9
commit
4f748e6fff
1 changed files with 6 additions and 8 deletions
14
js/join.js
14
js/join.js
|
@ -1,10 +1,10 @@
|
||||||
async function checkDuplicate() {
|
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;
|
var email = document.getElementById("email").value;
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createIssue() {
|
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 mathspamtrap = document.getElementById("math-spam-trap").value;
|
||||||
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
var agreetoterms = document.getElementById("agree-to-terms").checked;
|
||||||
var email = document.getElementById("email").value;
|
var email = document.getElementById("email").value;
|
||||||
|
@ -49,22 +49,20 @@
|
||||||
var name = name.replace (/^/,'Name: ');
|
var name = name.replace (/^/,'Name: ');
|
||||||
var aboutme = document.getElementById("about-me").value;
|
var aboutme = document.getElementById("about-me").value;
|
||||||
var aboutme = aboutme.replace (/^/,'About me: ');
|
var aboutme = aboutme.replace (/^/,'About me: ');
|
||||||
var aboutme = aboutme.replace(/\r?\n/g, "%0A%0A");
|
|
||||||
var howfound = document.getElementById("how-found").value;
|
var howfound = document.getElementById("how-found").value;
|
||||||
var howfound = howfound.replace (/^/,'How I found ilot: ');
|
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 = document.getElementById("oc-user").value;
|
||||||
var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
var ocuser = ocuser.replace (/^/,'OpenCollective Profile: ');
|
||||||
var description = name + "%0A%0A" + aboutme + "%0A%0A" + howfound + "%0A%0A" + ocuser;
|
var description = name + "\n\n" + aboutme + "\n\n" + howfound + "\n\n" + ocuser;
|
||||||
var url = baseurl.concat("&title=", email, "&description=", description);
|
|
||||||
console.log('Description:', description);
|
console.log('Description:', description);
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'PRIVATE-TOKEN': 'glpat-RaoZSW_3XMhkGr19k6Wv',
|
'authorization': 'token b8d8617bb6049c0e47b7bba5cd0931799f54609c',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
body: JSON.stringify({ title: email, body: description }),
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue