siarashield_workspace 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,9 +12,6 @@ npm i siarashield_workspace
|
|
|
12
12
|
|
|
13
13
|
Get your public/private keys from <a href="https://mycybersiara.com" target="_blank" rel="noopener noreferrer">mycybersiara.com</a>.
|
|
14
14
|
|
|
15
|
-
- For staging/development, set public key as `TEST-CYBERSIARA` in your `.env`/environment config.
|
|
16
|
-
|
|
17
|
-
|
|
18
15
|
## 3) Put keys in correct place
|
|
19
16
|
|
|
20
17
|
- **Frontend (Angular):** public key only
|
|
@@ -25,13 +22,7 @@ Frontend should read public key from `.env` or your environment file.
|
|
|
25
22
|
Example `.env` values:
|
|
26
23
|
|
|
27
24
|
```env
|
|
28
|
-
SIARASHIELD_PUBLIC_KEY=
|
|
29
|
-
SIARASHIELD_PRIVATE_KEY=YOUR-PRIVATE-KEY
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Backend example (`.env`):
|
|
33
|
-
|
|
34
|
-
```env
|
|
25
|
+
SIARASHIELD_PUBLIC_KEY=YOUR-PUBLIC-KEY
|
|
35
26
|
SIARASHIELD_PRIVATE_KEY=YOUR-PRIVATE-KEY
|
|
36
27
|
```
|
|
37
28
|
|
|
@@ -41,17 +32,24 @@ If your frontend project already uses `.env`, that is fine. Map it to the same p
|
|
|
41
32
|
|
|
42
33
|
```html
|
|
43
34
|
<div class="SiaraShield"></div>
|
|
44
|
-
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
In your submit button, make sure to add this class:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<button class="CaptchaSubmit"></button>
|
|
45
41
|
```
|
|
46
42
|
|
|
47
43
|
## 5) Add TypeScript integration (copy-paste)
|
|
48
44
|
|
|
45
|
+
This captcha is not only for login form. You can integrate it in any form component like Login, Contact Us, Signup, Forgot Password, Lead Form, etc.
|
|
46
|
+
|
|
49
47
|
```ts
|
|
50
48
|
import { OnInit } from '@angular/core';
|
|
51
49
|
import { environment } from '../environments/environment';
|
|
52
50
|
import { initSiaraShield, checkSiaraShieldCaptcha } from 'siarashield_workspace';
|
|
53
51
|
|
|
54
|
-
export class
|
|
52
|
+
export class FormComponent implements OnInit {
|
|
55
53
|
ngOnInit() {
|
|
56
54
|
this.initializeCaptcha();
|
|
57
55
|
}
|
|
@@ -69,8 +67,8 @@ export class LoginComponent implements OnInit {
|
|
|
69
67
|
const result = checkSiaraShieldCaptcha();
|
|
70
68
|
if (result.ok) {
|
|
71
69
|
console.log(result.token);
|
|
72
|
-
// API call here
|
|
73
|
-
alert('
|
|
70
|
+
// API call here (Login/Contact/Signup/etc.)
|
|
71
|
+
alert('Form submitted successfully');
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
}
|