mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
Add Cloudflare Turnstile integration and update UI titles
- Program.cs: Added static fields for Turnstile keys, updated login HTML, added token validation in login and sign-up endpoints, and updated configuration loading. - admin.html, dash.html: Changed title to "dashboard". - login.html, signup.html: Added Turnstile script and widget, updated form submission, and added styles/JS for token handling. - user.html: Adjusted width of .pastes-wrapper. - Turnstile.cs: Added Turnstile class with VerifyTurnstileToken method for token verification via Cloudflare API.
This commit is contained in:
+52
-2
@@ -12,6 +12,8 @@ class Program
|
|||||||
{
|
{
|
||||||
private static string salt = string.Empty;
|
private static string salt = string.Empty;
|
||||||
private static string smallerSalt = string.Empty;
|
private static string smallerSalt = string.Empty;
|
||||||
|
private static string cfTurnstileSiteKey = string.Empty;
|
||||||
|
public static string cfTurnstileSecret = string.Empty;
|
||||||
|
|
||||||
public static Dictionary<int, string> accountType = new Dictionary<int, string>
|
public static Dictionary<int, string> accountType = new Dictionary<int, string>
|
||||||
{
|
{
|
||||||
@@ -156,6 +158,7 @@ class Program
|
|||||||
}
|
}
|
||||||
var html = File.ReadAllText("assets/login.html");
|
var html = File.ReadAllText("assets/login.html");
|
||||||
html = html.Replace("{html}", "<a href=\"/sign-up\">sign up</a>");
|
html = html.Replace("{html}", "<a href=\"/sign-up\">sign up</a>");
|
||||||
|
html = html.Replace("{sitekey}", cfTurnstileSiteKey);
|
||||||
context.Response.ContentType = "text/html";
|
context.Response.ContentType = "text/html";
|
||||||
await context.Response.WriteAsync(html);
|
await context.Response.WriteAsync(html);
|
||||||
return;
|
return;
|
||||||
@@ -169,6 +172,7 @@ class Program
|
|||||||
}
|
}
|
||||||
var html = File.ReadAllText("assets/signup.html");
|
var html = File.ReadAllText("assets/signup.html");
|
||||||
html = html.Replace("{html}", "<a href=\"/login\">login</a>");
|
html = html.Replace("{html}", "<a href=\"/login\">login</a>");
|
||||||
|
html = html.Replace("{sitekey}", cfTurnstileSiteKey);
|
||||||
context.Response.ContentType = "text/html";
|
context.Response.ContentType = "text/html";
|
||||||
await context.Response.WriteAsync(html);
|
await context.Response.WriteAsync(html);
|
||||||
return;
|
return;
|
||||||
@@ -1503,7 +1507,7 @@ class Program
|
|||||||
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "No content uploaded" }.ToString());
|
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "No content uploaded" }.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(user.UUID))
|
if (!string.IsNullOrEmpty(user.UUID))
|
||||||
{
|
{
|
||||||
using (var connection = new SqliteConnection("Data Source=pastes.sqlite"))
|
using (var connection = new SqliteConnection("Data Source=pastes.sqlite"))
|
||||||
{
|
{
|
||||||
@@ -1996,6 +2000,23 @@ class Program
|
|||||||
var data = JObject.Parse(requestBody);
|
var data = JObject.Parse(requestBody);
|
||||||
var username = SanitizeInput(data["username"]?.ToString() ?? "");
|
var username = SanitizeInput(data["username"]?.ToString() ?? "");
|
||||||
var password = SanitizeInput(data["password"]?.ToString() ?? "");
|
var password = SanitizeInput(data["password"]?.ToString() ?? "");
|
||||||
|
var cfToken = SanitizeInput(data["cf"]?.ToString() ?? "");
|
||||||
|
if (string.IsNullOrEmpty(cfToken) || string.IsNullOrEmpty(cfToken))
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 400;
|
||||||
|
context.Response.ContentType = "application/json";
|
||||||
|
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "Invalid Cloudflare Turnstile Token" }.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool cfValid = await Turnstile.VerifyTurnstileToken(cfToken);
|
||||||
|
if (!cfValid)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 400;
|
||||||
|
context.Response.ContentType = "application/json";
|
||||||
|
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "Invalid Cloudflare Turnstile Token" }.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (username.Length > 20 || username.Length < 3 || password.Length > 50 || password.Length < 8)
|
if (username.Length > 20 || username.Length < 3 || password.Length > 50 || password.Length < 8)
|
||||||
{
|
{
|
||||||
@@ -2118,7 +2139,22 @@ class Program
|
|||||||
var data = JObject.Parse(requestBody);
|
var data = JObject.Parse(requestBody);
|
||||||
var username = SanitizeInput(data["username"]?.ToString() ?? "");
|
var username = SanitizeInput(data["username"]?.ToString() ?? "");
|
||||||
var password = SanitizeInput(data["password"]?.ToString() ?? "");
|
var password = SanitizeInput(data["password"]?.ToString() ?? "");
|
||||||
|
var cfToken = SanitizeInput(data["cf"]?.ToString() ?? "");
|
||||||
|
if (string.IsNullOrEmpty(cfToken) || string.IsNullOrEmpty(cfToken))
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 400;
|
||||||
|
context.Response.ContentType = "application/json";
|
||||||
|
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "Invalid Cloudflare Turnstile Token" }.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool cfValid = await Turnstile.VerifyTurnstileToken(cfToken);
|
||||||
|
if (!cfValid)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = 400;
|
||||||
|
context.Response.ContentType = "application/json";
|
||||||
|
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "Invalid Cloudflare Turnstile Token" }.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
|
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = 400;
|
context.Response.StatusCode = 400;
|
||||||
@@ -2454,6 +2490,11 @@ class Program
|
|||||||
var config = JObject.Parse(File.ReadAllText("config.json"));
|
var config = JObject.Parse(File.ReadAllText("config.json"));
|
||||||
salt = config["Salt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(13);
|
salt = config["Salt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(13);
|
||||||
smallerSalt = config["SmallerSalt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(8);
|
smallerSalt = config["SmallerSalt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(8);
|
||||||
|
cfTurnstileSecret = config["CF_TurnstileSecret"]?.ToString() ?? "";
|
||||||
|
cfTurnstileSiteKey = config["CF_TurnstileSiteKey"]?.ToString() ?? "";
|
||||||
|
|
||||||
|
config["Salt"] = salt;
|
||||||
|
config["SmallerSalt"] = smallerSalt;
|
||||||
File.WriteAllText("config.json", config.ToString());
|
File.WriteAllText("config.json", config.ToString());
|
||||||
|
|
||||||
Logging.Api_CreateMessage = config["API_CreateMessage"]?.ToString() ?? "";
|
Logging.Api_CreateMessage = config["API_CreateMessage"]?.ToString() ?? "";
|
||||||
@@ -2467,6 +2508,15 @@ class Program
|
|||||||
smallerSalt = config["SmallerSalt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(8);
|
smallerSalt = config["SmallerSalt"]?.ToString() ?? BCrypt.Net.BCrypt.GenerateSalt(8);
|
||||||
File.WriteAllText("config.json", config.ToString());
|
File.WriteAllText("config.json", config.ToString());
|
||||||
}
|
}
|
||||||
|
if (cfTurnstileSiteKey == "" || cfTurnstileSecret == "")
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
Console.Write("error: ");
|
||||||
|
Console.ResetColor();
|
||||||
|
Console.WriteLine("Cloudflare Turnstile secret or site key is not set in config.json");
|
||||||
|
Console.ReadKey();
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
if (!Directory.Exists("pastes"))
|
if (!Directory.Exists("pastes"))
|
||||||
Directory.CreateDirectory("pastes");
|
Directory.CreateDirectory("pastes");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sharpbin
|
||||||
|
{
|
||||||
|
public class Turnstile
|
||||||
|
{
|
||||||
|
public static async Task<bool> VerifyTurnstileToken(string token)
|
||||||
|
{
|
||||||
|
var httpClient = new HttpClient();
|
||||||
|
JObject requestBody = new JObject
|
||||||
|
{
|
||||||
|
["secret"] = Program.cfTurnstileSecret,
|
||||||
|
["response"] = token
|
||||||
|
};
|
||||||
|
var request = new HttpRequestMessage
|
||||||
|
{
|
||||||
|
Method = HttpMethod.Post,
|
||||||
|
RequestUri = new Uri("https://challenges.cloudflare.com/turnstile/v0/siteverify"),
|
||||||
|
Content = new StringContent(requestBody.ToString(), Encoding.UTF8, "application/json")
|
||||||
|
};
|
||||||
|
using (var response = await httpClient.SendAsync(request))
|
||||||
|
{
|
||||||
|
var jsonresponse = JObject.Parse(await response.Content.ReadAsStringAsync());
|
||||||
|
Console.WriteLine(jsonresponse["success"]?.ToString());
|
||||||
|
if (jsonresponse["success"]?.ToString().ToLower() == "true")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
||||||
<title>create paste</title>
|
<title>dashboard</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
||||||
<title>create paste</title>
|
<title>dashboard</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+180
-153
@@ -1,11 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
||||||
<title>create paste</title>
|
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
||||||
|
<title>login</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="nav-div">
|
<div class="nav-div">
|
||||||
<a href="/">home</a>
|
<a href="/">home</a>
|
||||||
@@ -21,6 +24,7 @@
|
|||||||
<input type="text" id="usernameInput" class="textinput" name="pasteTitle" required maxlength="20">
|
<input type="text" id="usernameInput" class="textinput" name="pasteTitle" required maxlength="20">
|
||||||
<label for="passwordTitle" class="label">Password</label>
|
<label for="passwordTitle" class="label">Password</label>
|
||||||
<input type="password" id="passwordInput" class="textinput" name="pasteTitle" required maxlength="50">
|
<input type="password" id="passwordInput" class="textinput" name="pasteTitle" required maxlength="50">
|
||||||
|
<div id="cf-turnstile" class="cf-turnstile" data-sitekey="{sitekey}"></div>
|
||||||
<button type="submit" class="button">Login</button>
|
<button type="submit" class="button">Login</button>
|
||||||
</form>
|
</form>
|
||||||
<h3 id="error-message"></h3>
|
<h3 id="error-message"></h3>
|
||||||
@@ -36,13 +40,14 @@
|
|||||||
|
|
||||||
var usernameContent = document.getElementById("usernameInput").value;
|
var usernameContent = document.getElementById("usernameInput").value;
|
||||||
var passwordContent = document.getElementById("passwordInput").value;
|
var passwordContent = document.getElementById("passwordInput").value;
|
||||||
|
var cf = turnstile.getResponse();
|
||||||
|
|
||||||
|
|
||||||
if (isLoggingIn) {
|
if (isLoggingIn) {
|
||||||
createNotification("Please wait for the login to finish.");
|
createNotification("Please wait for the login to finish.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isLoggingIn = true;
|
isLoggingIn = true;
|
||||||
console.log(isLoggingIn);
|
|
||||||
var requestUrl = "/api/accounts/login";
|
var requestUrl = "/api/accounts/login";
|
||||||
fetch(requestUrl, {
|
fetch(requestUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -51,7 +56,8 @@
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
username: usernameContent,
|
username: usernameContent,
|
||||||
password: passwordContent
|
password: passwordContent,
|
||||||
|
cf: cf
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,6 +78,7 @@
|
|||||||
errorElement.style.opacity = 0;
|
errorElement.style.opacity = 0;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
isLoggingIn = false;
|
isLoggingIn = false;
|
||||||
|
turnstile.reset();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -101,161 +108,179 @@
|
|||||||
notificationDiv.remove();
|
notificationDiv.remove();
|
||||||
}, 4900);
|
}, 4900);
|
||||||
}
|
}
|
||||||
|
document.getElementById("cf-turnstile").addEventListener("expired-callback", function () {
|
||||||
|
createNotification("Please complete the captcha.");
|
||||||
|
turnstile.reset();
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #0d0d0d;
|
||||||
|
}
|
||||||
|
|
||||||
body{
|
.container-wrapper {
|
||||||
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
display: flex;
|
||||||
font-weight: bold;
|
flex-direction: column;
|
||||||
display: flex;
|
justify-content: center;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
justify-content: center;
|
width: 100%;
|
||||||
align-items: center;
|
height: 98.7vh;
|
||||||
background-color: #0d0d0d;
|
}
|
||||||
}
|
|
||||||
.container-wrapper{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 98.7vh;
|
|
||||||
}
|
|
||||||
.creation-container{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #181818;
|
|
||||||
color: white;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: fit-content;
|
|
||||||
max-height: 80vh;
|
|
||||||
min-height: 20%;
|
|
||||||
overflow-y: auto;
|
|
||||||
border: #222222 2px solid;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
#loginForm{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
#error-message{
|
|
||||||
color: red;
|
|
||||||
opacity: 0;
|
|
||||||
position: absolute;
|
|
||||||
bottom: -0.1px;
|
|
||||||
margin-bottom: -0.1px;
|
|
||||||
top: 88%;
|
|
||||||
transition: 300ms;
|
|
||||||
|
|
||||||
}
|
.creation-container {
|
||||||
.label{
|
display: flex;
|
||||||
font-size: 1.5em;
|
flex-direction: column;
|
||||||
}
|
align-items: center;
|
||||||
.textinput{
|
width: 80%;
|
||||||
transition: 300ms;
|
padding: 20px;
|
||||||
width: 100%;
|
background-color: #181818;
|
||||||
padding: 10px;
|
color: white;
|
||||||
margin: 10px 0;
|
border-radius: 5px;
|
||||||
border-radius: 5px;
|
height: fit-content;
|
||||||
border: none;
|
max-height: 80vh;
|
||||||
background-color: #282828;
|
min-height: 20%;
|
||||||
color: white;
|
overflow-y: auto;
|
||||||
border: #2a2a2a 2px solid;
|
border: #222222 2px solid;
|
||||||
box-sizing: border-box;
|
position: relative;
|
||||||
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
}
|
||||||
font-size: 1.1em;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.textinput:focus{
|
|
||||||
transition: 300ms;
|
|
||||||
background-color: #333333;
|
|
||||||
border: 2px solid #3a3a3a;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.textarea{
|
|
||||||
transition: 300ms;
|
|
||||||
width: 100%;
|
|
||||||
min-width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
min-height: auto;
|
|
||||||
padding: 10px;
|
|
||||||
margin: 10px 0;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: none;
|
|
||||||
background-color: #282828;
|
|
||||||
color: white;
|
|
||||||
border: #2a2a2a 2px solid;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
|
||||||
font-size: 1.08em;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.textarea:focus{
|
|
||||||
transition: 300ms;
|
|
||||||
background-color: #333333;
|
|
||||||
border: 2px solid #3a3a3a;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.button{
|
|
||||||
transition: 300ms;
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
margin: 10px 0;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: none;
|
|
||||||
background-color: #222222;
|
|
||||||
color: white;
|
|
||||||
border: #2a2a2a00 2px solid;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 1.2em;
|
|
||||||
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.button:hover{
|
|
||||||
transition: 300ms;
|
|
||||||
background-color: #333333;
|
|
||||||
border: 2px solid #3a3a3a;
|
|
||||||
}
|
|
||||||
.nav-div{
|
|
||||||
top: 0;
|
|
||||||
margin-top: 10px;
|
|
||||||
position: absolute;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: fit-content;
|
|
||||||
background-color: #181818;
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
color: white;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: fit-content;
|
|
||||||
overflow-y: auto;
|
|
||||||
border: #222222 2px solid;
|
|
||||||
}
|
|
||||||
.nav-div a{
|
|
||||||
text-decoration: none;
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
margin: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #222222;
|
|
||||||
transition: 300ms;
|
|
||||||
border: #2a2a2a00 2px solid;
|
|
||||||
}
|
|
||||||
.nav-div a:hover{
|
|
||||||
transition: 300ms;
|
|
||||||
background-color: #333333;
|
|
||||||
border: #3a3a3a 2px solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes hoverup {
|
#loginForm {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error-message {
|
||||||
|
color: red;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -0.1px;
|
||||||
|
margin-bottom: -0.1px;
|
||||||
|
top: 88%;
|
||||||
|
transition: 300ms;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textinput {
|
||||||
|
transition: 300ms;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
background-color: #282828;
|
||||||
|
color: white;
|
||||||
|
border: #2a2a2a 2px solid;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
||||||
|
font-size: 1.1em;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textinput:focus {
|
||||||
|
transition: 300ms;
|
||||||
|
background-color: #333333;
|
||||||
|
border: 2px solid #3a3a3a;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textarea {
|
||||||
|
transition: 300ms;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
min-height: auto;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
background-color: #282828;
|
||||||
|
color: white;
|
||||||
|
border: #2a2a2a 2px solid;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
||||||
|
font-size: 1.08em;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textarea:focus {
|
||||||
|
transition: 300ms;
|
||||||
|
background-color: #333333;
|
||||||
|
border: 2px solid #3a3a3a;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
transition: 300ms;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
background-color: #222222;
|
||||||
|
color: white;
|
||||||
|
border: #2a2a2a00 2px solid;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
transition: 300ms;
|
||||||
|
background-color: #333333;
|
||||||
|
border: 2px solid #3a3a3a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-div {
|
||||||
|
top: 0;
|
||||||
|
margin-top: 10px;
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: fit-content;
|
||||||
|
background-color: #181818;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
color: white;
|
||||||
|
border-radius: 5px;
|
||||||
|
height: fit-content;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: #222222 2px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-div a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #222222;
|
||||||
|
transition: 300ms;
|
||||||
|
border: #2a2a2a00 2px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-div a:hover {
|
||||||
|
transition: 300ms;
|
||||||
|
background-color: #333333;
|
||||||
|
border: #3a3a3a 2px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes hoverup {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
@@ -308,6 +333,7 @@ body{
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notifcations-wrapper {
|
.notifcations-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -319,4 +345,5 @@ body{
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -5,7 +5,8 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
||||||
<title>create paste</title>
|
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
||||||
|
<title>sign-up</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
<label for="passwordTitle" class="label" id="margin-top">Password</label>
|
<label for="passwordTitle" class="label" id="margin-top">Password</label>
|
||||||
<input type="password" id="passwordInput" class="textinput" name="pasteTitle" required maxlength="50" minlength="8">
|
<input type="password" id="passwordInput" class="textinput" name="pasteTitle" required maxlength="50" minlength="8">
|
||||||
<label id="passcharacterCount" for="characterCount" class="ccounter">0/50</label>
|
<label id="passcharacterCount" for="characterCount" class="ccounter">0/50</label>
|
||||||
|
<div id="cf-turnstile" class="cf-turnstile" data-sitekey="{sitekey}"></div>
|
||||||
<button type="submit" class="button" id="button-margin-top">Sign-up</button>
|
<button type="submit" class="button" id="button-margin-top">Sign-up</button>
|
||||||
</form>
|
</form>
|
||||||
<h3 id="error-message"></h3>
|
<h3 id="error-message"></h3>
|
||||||
@@ -41,6 +43,7 @@
|
|||||||
|
|
||||||
var usernameContent = document.getElementById("usernameInput").value;
|
var usernameContent = document.getElementById("usernameInput").value;
|
||||||
var passwordContent = document.getElementById("passwordInput").value;
|
var passwordContent = document.getElementById("passwordInput").value;
|
||||||
|
var cf = turnstile.getResponse();
|
||||||
|
|
||||||
if (isLoggingIn) {
|
if (isLoggingIn) {
|
||||||
createNotification("Please wait for the login to finish.");
|
createNotification("Please wait for the login to finish.");
|
||||||
@@ -56,7 +59,8 @@
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
username: usernameContent,
|
username: usernameContent,
|
||||||
password: passwordContent
|
password: passwordContent,
|
||||||
|
cf: cf
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@@ -75,6 +79,7 @@
|
|||||||
errorElement.style.opacity = 0;
|
errorElement.style.opacity = 0;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
isLoggingIn = false;
|
isLoggingIn = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -174,7 +174,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
width: 85%;
|
width: calc(100% - 52px);
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|||||||
Reference in New Issue
Block a user