Use flags for email / registration correctly.

This commit is contained in:
Paul Makles
2020-08-30 17:48:30 +01:00
parent cbac802978
commit 7c374ec756
9 changed files with 105 additions and 42 deletions

View File

@@ -1,7 +1,8 @@
use crate::util::variables::{HCAPTCHA_KEY, USE_HCAPTCHA};
use reqwest::blocking::Client;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::env;
#[derive(Serialize, Deserialize)]
struct CaptchaResponse {
@@ -9,10 +10,10 @@ struct CaptchaResponse {
}
pub fn verify(user_token: &Option<String>) -> Result<(), String> {
if let Ok(key) = env::var("HCAPTCHA_KEY") {
if *USE_HCAPTCHA {
if let Some(token) = user_token {
let mut map = HashMap::new();
map.insert("secret", key);
map.insert("secret", HCAPTCHA_KEY.to_string());
map.insert("response", token.to_string());
let client = Client::new();