mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-13 19:15:39 +00:00
settings page, clipboard component
This commit is contained in:
56
templates/panel/settings/index.html
Normal file
56
templates/panel/settings/index.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<. const COPY_ALT: &str = "copy secret"; .>
|
||||
<. const COPY_CLASS: &str = "settings__secret-copy"; .>
|
||||
<. const DONE_ALT: &str = "secret copied"; .>
|
||||
<. const DONE_CLASS: &str = "settings__secret-copy-done"; .>
|
||||
|
||||
<. let clipboard_data = ("secret", &secret); .>
|
||||
|
||||
<. include!("../../components/headers/index.html"); .>
|
||||
<. include!("../navbar/index.html"); .>
|
||||
<div class="tmp-layout">
|
||||
<. include!("../header/index.html"); .>
|
||||
<main class="panel-main">
|
||||
<. include!("../help-banner/index.html"); .>
|
||||
<!-- Main content container -->
|
||||
<div class="inner-container">
|
||||
<div class="sitekey-form" action="<.= crate::V1_API_ROUTES.levels.add .>" method="post">
|
||||
<h1 class="form__title">
|
||||
<.= PAGE .>
|
||||
</h1>
|
||||
<form action="<.= crate::V1_API_ROUTES.account.update_email .>" method="post">
|
||||
<label class="sitekey-form__label" for="description">
|
||||
Email
|
||||
<input
|
||||
class="sitekey-form__input"
|
||||
type="email"
|
||||
name="email"
|
||||
id="email"
|
||||
<. if let Some(email) = email { .>
|
||||
<. if !email.trim().is_empty() { .>
|
||||
value="<.= email .>"
|
||||
<. } .>
|
||||
<. } .>
|
||||
/>
|
||||
</label>
|
||||
<button class="sitekey-form__submit" type="submit">Update</button>
|
||||
</form>
|
||||
|
||||
<label class="sitekey-form__label" for="secret">
|
||||
Cooldown Duratoin(in seconds)
|
||||
<input
|
||||
class="sitekey-form__input"
|
||||
type="password"
|
||||
name="secret-password"
|
||||
id="secret"
|
||||
value="<.= secret .>"
|
||||
/>
|
||||
<. include!("../../components/showPassword/index.html"); .>
|
||||
<. include!("../../components/clipboard/index.html"); .>
|
||||
</label>
|
||||
<a class="settings__delete-account-link" href="<.= crate::PAGES.panel.sitekey.add .>">
|
||||
<button class="settings__delete-account-btn" type="submit">Delete Account</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of container -->
|
||||
<. include!("../../components/footers.html"); .>
|
||||
34
templates/panel/settings/index.ts
Normal file
34
templates/panel/settings/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/>.
|
||||
*/
|
||||
|
||||
import registerShowPassword from '../../components/showPassword/';
|
||||
import CopyIcon from '../../components/clipboard/';
|
||||
|
||||
const SECRET_COPY_ICON = 'settings__secret-copy';
|
||||
const SECRET_COPY_DONE_ICON = 'settings__secret-copy-done';
|
||||
|
||||
const index = () => {
|
||||
registerShowPassword();
|
||||
|
||||
const secretElement = <HTMLElement>(
|
||||
document.querySelector(`.${SECRET_COPY_ICON}`)
|
||||
);
|
||||
const writeText = secretElement.dataset.secret;
|
||||
new CopyIcon(writeText, SECRET_COPY_ICON, SECRET_COPY_DONE_ICON);
|
||||
};
|
||||
|
||||
export default index;
|
||||
30
templates/panel/settings/main.scss
Normal file
30
templates/panel/settings/main.scss
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 '../../components/clipboard/copy';
|
||||
|
||||
.settings__secret-copy {
|
||||
@include copy-icon;
|
||||
}
|
||||
|
||||
.settings__secret-copy:hover .settings__secret-copy-done:hover {
|
||||
@include copy-icon-hover;
|
||||
}
|
||||
|
||||
.settings__secret-copy-done {
|
||||
@include copy-done-icon;
|
||||
}
|
||||
Reference in New Issue
Block a user