widget: verification works

This commit is contained in:
realaravinth
2021-05-29 21:19:45 +05:30
parent d9cb38ac13
commit 98cf4a476d
13 changed files with 188 additions and 39 deletions

View File

@@ -1,4 +1,5 @@
<. include!("../../../components/headers/index.html"); .>
<. include!("../../../components/headers/widget-headers.html"); .>
<body class="layout">
<. include!("../../navbar/index.html"); .>
<div class="tmp-layout">
<. include!("../../header/index.html"); .>
@@ -10,7 +11,11 @@
<form class="sitekey-form" action="<.= crate::V1_API_ROUTES.levels.add .>" method="post">
<h1 class="form__title">
Sitekey: <.= name .>
Sitekey: <.= name .>
<a href="<.= crate::WIDGET_ROUTES.verification_widget .>/?sitekey=<.= key.>"
>Click here to see CAPTCHA widget in action</a>
</h1>
<label class="sitekey-form__label" for="description">
Description
@@ -47,6 +52,8 @@
<. } .>
</form>
</div>
<!-- end of container -->
<. include!("../../../components/footers.html"); .>

View File

@@ -5,5 +5,7 @@
href="<.= &*crate::VERIFICATIN_WIDGET_CSS .>"
/>
<script src="<.= &*crate::VERIFICATIN_WIDGET_JS .>"></script>
<script src="<.= &*crate::WIDGET_ROUTES.js .>"></script>
<script src="<.= &*crate::WIDGET_ROUTES.wasm .>"></script>
</body>
</html>

View File

@@ -15,11 +15,41 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import './main.scss';
const PARENT = window.parent;
const verificationContainer = <HTMLElement>(
document.querySelector('.widget__verification-container')
);
verificationContainer.style.display = 'flex';
//PARENT.postMessage
//import prove from './runner/prove';
//import fetchPoWConfig from './runner/fetchPoWConfig';
//import sendWork from './runner/sendWork';
//import sendToParent from './runner/sendToParent';
//import * as CONST from './runner/const';
//
///** add mcaptcha widget element to DOM */
//export const register = () => {
// const verificationContainer = <HTMLElement>(
// document.querySelector('.widget__verification-container')
// );
// verificationContainer.style.display = 'flex';
//
// CONST.btn().addEventListener('click', e => solveCaptchaRunner(e));
//};
//
//const solveCaptchaRunner = async (e: Event) => {
// e.preventDefault();
// // steps:
//
// // 1. hide --before message
// CONST.messageText().before().style.display = 'none';
//
// // 1. show --during
// CONST.messageText().during().style.display = 'block';
// // 1. get config
// const config = await fetchPoWConfig();
// // 2. prove work
// const proof = await prove(config);
// // 3. submit work
// const token = await sendWork(proof);
// // 4. send token
// sendToParent(token);
// // 5. mark checkbox checked
// CONST.btn().checked = true;
//};
//
//register();

View File

@@ -83,7 +83,7 @@
}
.widget__verification-checkbox:checked ~ .widget__verification-text--during {
display: non;
display: none;
}
.widget__verification-checkbox:checked ~ .widget__verification-text--error {