mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
delete captcha option and sudo page
This commit is contained in:
@@ -25,6 +25,16 @@ import createError from '../../../components/error/index';
|
||||
|
||||
//import '../forms.scss';
|
||||
|
||||
export const getPassword = () => {
|
||||
const passwordElement = <HTMLInputElement>document.getElementById('password');
|
||||
if (passwordElement === null) {
|
||||
console.debug('Password is null');
|
||||
return;
|
||||
}
|
||||
|
||||
return passwordElement.value;
|
||||
};
|
||||
|
||||
const login = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
const loginElement = <HTMLInputElement>document.getElementById('login');
|
||||
@@ -36,13 +46,7 @@ const login = async (e: Event) => {
|
||||
const login = loginElement.value;
|
||||
isBlankString(login, 'username', e);
|
||||
|
||||
const passwordElement = <HTMLInputElement>document.getElementById('password');
|
||||
if (passwordElement === null) {
|
||||
console.debug('Password is null');
|
||||
return;
|
||||
}
|
||||
|
||||
const password = passwordElement.value;
|
||||
const password = getPassword();
|
||||
|
||||
const payload = {
|
||||
login,
|
||||
|
||||
31
templates/auth/sudo/getForm.test.ts
Normal file
31
templates/auth/sudo/getForm.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import form from './index';
|
||||
|
||||
it('sudo form works', () => {
|
||||
try {
|
||||
form();
|
||||
} catch (e) {
|
||||
expect(e.message).toBe("Couldn't form element, is the component loaded?");
|
||||
}
|
||||
|
||||
const element = document.createElement('form');
|
||||
element.id = 'form';
|
||||
document.body.appendChild(element);
|
||||
expect(form()).toBe(element);
|
||||
});
|
||||
30
templates/auth/sudo/index.html
Normal file
30
templates/auth/sudo/index.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<. include!("../../components/headers/index.html"); .>
|
||||
<div class="tmp-layout">
|
||||
<main class="auth-main">
|
||||
<div class="auth-inner-container">
|
||||
<. include!("../logo.html"); .>
|
||||
<form
|
||||
class="sitekey-form"
|
||||
method="POST"
|
||||
action="<.= url .>"
|
||||
id="form"
|
||||
>
|
||||
<h1 class="form__title">
|
||||
Confirm Access
|
||||
</h1>
|
||||
<label class="sitekey-form__label" for="password">
|
||||
Password
|
||||
<input
|
||||
class="sitekey-form__input"
|
||||
type="password"
|
||||
name="password"
|
||||
id="password"
|
||||
required
|
||||
/>
|
||||
<. include!("../../components/showPassword/index.html"); .>
|
||||
</label>
|
||||
<input type="submit" class="sitekey-form__submit" value="Confirm access" />
|
||||
</form>
|
||||
</div>
|
||||
<. include!("../../components/additional-data/index.html"); .>
|
||||
<. include!("../../components/footers.html"); .>
|
||||
34
templates/auth/sudo/index.ts
Normal file
34
templates/auth/sudo/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const form = () => {
|
||||
let element = null;
|
||||
const ID = 'form';
|
||||
|
||||
if (element === null) {
|
||||
element = <HTMLFormElement>document.getElementById(ID);
|
||||
if (element === undefined) {
|
||||
throw new Error("Couldn't form element, is the component loaded?");
|
||||
} else {
|
||||
return element;
|
||||
}
|
||||
} else {
|
||||
element;
|
||||
}
|
||||
};
|
||||
|
||||
export default form;
|
||||
Reference in New Issue
Block a user