2 Commits

Author SHA1 Message Date
ameye d776643f7e Added hCaptcha 2022-06-11 23:36:12 -04:00
ameye 9e8ec9c37e fix 2022-06-07 16:50:52 -04:00
4 changed files with 74 additions and 8 deletions
@@ -256,6 +256,7 @@ enum { PARTNER_STRIPE };
#define WRENCHBOARD_COUPON_CREATE 85010
#define WRENCHBOARD_COUPON_ACTIVATE 85015
#define WRENCHBOARD_COUPON_REDEEM 85020
#define WRENCHBOARD_COUPON_MEMLIST 85025
#define WRENCHBOARD_COUPON_END 85999
//**************************************************************
+27
View File
@@ -25,6 +25,7 @@
#define WRENCHBOARD_COUPON_END 85999
****** */
long MemberCouponList( CVars in, CVars &out );
long coupons_calls(CVars in, CVars &out){
@@ -51,6 +52,10 @@ logfmt(logINFO, "coupons_calls()");
return RedeemCoupon(in, out);
break;
case WRENCHBOARD_COUPON_MEMLIST: // member list
return MemberCouponList(in, out);
break;
}
logfmt(logINFO, "/coupons_calls()");
return ret;
@@ -159,6 +164,28 @@ CREATE TABLE coupons_allocation (
return ret;
}
long MemberCouponList( CVars in, CVars &out ){
/*
wrenchboard=> select * from coupons_allocation WHERE member_id = 1 ORDER BY added DESC;
id | code | amount | member_id | added | active | loc | status
----+------------+--------+-----------+----------------------------+----------------------------+-----+--------
7 | WE4BXKLMDP | 200000 | 1 | 2022-06-03 01:07:50.321491 | 2022-06-03 01:12:01.209814 | | 500
6 | QPKM5NEACA | 200000 | 1 | 2022-06-03 01:07:48.053047 | 2022-06-03 01:12:59.395797 | | 500
5 | RGSPQUDOVA | 200000 | 1 | 2022-06-03 01:04:01.632499 | 2022-06-03 01:14:43.54169 | | 500
4 | TH9UGRZV0D | 200000 | 1 | 2022-05-31 19:58:09.980929 | | | 500
3 | I2B5OCO8LP | 200000 | 1 | 2022-05-31 19:55:29.376655 | 2022-06-02 00:27:43.371677 | | 500
2 | U1RBYNH9QV | 0 | 1 | 2022-05-31 19:52:30.010599 | 2022-06-02 00:26:36.12992 | | 500
1 | 1M5IXDSGRK | 0 | 1 | 2022-05-31 19:16:00.499092 | 2022-06-02 00:24:38.080741 | | 500
(7 rows)
wrenchboard=>
wrenchboard=>
wrenchboard=>
wrenchboard=>
*/
return 0;
}
long CreateCoupon( CVars in, CVars &out ){
long ret = 0;
logfmt(logINFO, "CreateCoupon()");
@@ -5,18 +5,29 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Password_recovery extends CI_Controller {
public function index() {
$data = [];
$data['hcaptcha_site_key'] = "416c2382-9d6e-4131-bb58-e61b33f46a8b";
$data['hcaptcha_secret'] = "0x371da01B1407137aCb0FcCB387753450DFD096BC";
$data['action_message'] = "";
if ($_POST) {
$data['email'] = $this->input->post('email');
if ($data['email'] == '') {
$out['error'] = 'Please specify valid emal to continue';
$data['action_message'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
$data['h-captcha-response'] = $this->input->post('h-captcha-response');
if ($this->verifyCaptcha($data)) {
$data['email'] = $this->input->post('email');
if ($data['email'] == '') {
$out['error'] = 'Please specify valid emal to continue';
$data['action_message'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
} else {
$this->resetMemberPass($data['email']);
$out['error'] = "&nbsp;&nbsp;If we find your email, you will receive a link to reset your password. Please use or <a
href='https://www.wrenchboard.com/contact'>contact form</a> if you did not get our message after few minutes. ";
$data['action_message'] = "<div class=\"text-left\"><div class=\"alert alert-info no-border\">" . $out['error'] . "</div></div>";
}
} else {
$this->resetMemberPass($data['email']);
$out['error'] = "&nbsp;&nbsp;If we find your email, you will receive a link to reset your password. Please use or <a
href='https://www.wrenchboard.com/contact'>contact form</a> if you did not get our message after few minutes. ";
$data['action_message'] = "<div class=\"text-left\"><div class=\"alert alert-info no-border\">" . $out['error'] . "</div></div>";
$out['error'] = 'Please verify that you are human';
$data['action_message'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
}
}
$data["message"] = "Enter your account username, Email.<br> We will send you an email to reset your password";
// $this->load->view('users/view_external_header');
@@ -48,4 +59,27 @@ href='https://www.wrenchboard.com/contact'>contact form</a> if you did not get o
return $this->actionMessage;
}
private function verifyCaptcha($verify_data) {
if (!is_array($verify_data) || !array_key_exists('hcaptcha_secret',$verify_data) || $verify_data['hcaptcha_secret']==''
|| !array_key_exists('h-captcha-response',$verify_data) || $verify_data['h-captcha-response']=='') {
return false;
}
$data = array(
'secret' => $verify_data['hcaptcha_secret'],
'response' => $verify_data['h-captcha-response']
);
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
// var_dump($response);
$responseData = json_decode($response);
if(is_object($responseData) && property_exists($responseData, 'success') && $responseData->success) {
return true;
}
return false;
}
}
@@ -4,6 +4,7 @@
<head>
<meta name="title" content="WrenchBoard: Find a Freelancer | Sell Professional Services" />
<?php include("header_contents.php");?>
<script src='https://www.hCaptcha.com/1/api.js' async defer></script>
</head>
<!--end::Head-->
<!--begin::Body-->
@@ -39,6 +40,9 @@
<label class="form-label fw-bolder text-gray-900 fs-6">Email</label>
<input class="form-control form-control-solid" type="email" placeholder="Your Username/Email" name="email" value="" autocomplete="off" />
</div>
<div class="fv-row mb-10" style="text-align:center;">
<div class="h-captcha" data-sitekey="<?php echo $hcaptcha_site_key; ?>"></div>
</div>
<!--end::Input group-->
<!--begin::Actions-->
<?php echo $action_message; ?>