siarashield_workspace 0.0.10 → 0.0.11
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 +30 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,17 +41,36 @@ import { initSiaraShield, checkSiaraShieldCaptchaAsync } from 'siarashield_works
|
|
|
41
41
|
5. Initialize captcha and validate on submit:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
+
import { OnInit } from '@angular/core';
|
|
44
45
|
import { environment } from '../environments/environment';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
import { checkSiaraShieldCaptcha, initSiaraShield } from 'siarashield_workspace';
|
|
47
|
+
|
|
48
|
+
export class LoginComponent implements OnInit {
|
|
49
|
+
ngOnInit() {
|
|
50
|
+
this.initializeCaptcha();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
initializeCaptcha() {
|
|
54
|
+
initSiaraShield({
|
|
55
|
+
publicKey: environment.siaraShield.publicKey,
|
|
56
|
+
loadJQuery: true,
|
|
57
|
+
})
|
|
58
|
+
.then(() => {
|
|
59
|
+
console.log('SiaraShield Initialized ✅');
|
|
60
|
+
})
|
|
61
|
+
.catch((err: any) => {
|
|
62
|
+
console.error('Initialization Error:', err);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
onSubmit() {
|
|
67
|
+
const result = checkSiaraShieldCaptcha();
|
|
68
|
+
if (result.ok) {
|
|
69
|
+
console.log(result.token);
|
|
70
|
+
// API call here
|
|
71
|
+
alert('Login Successful ✅');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
55
74
|
}
|
|
56
75
|
```
|
|
57
76
|
|
|
@@ -59,7 +78,7 @@ Note: Please put your submit button code inside `if (result.ok)`.
|
|
|
59
78
|
Add `CaptchaSubmit` class in your submit button:
|
|
60
79
|
|
|
61
80
|
```html
|
|
62
|
-
<button class="CaptchaSubmit"
|
|
81
|
+
<button class="CaptchaSubmit" (click)="onSubmit()">Login</button>
|
|
63
82
|
```
|
|
64
83
|
|
|
65
84
|
## jQuery loading behavior
|