Skip to content

Commit d7b9f1e

Browse files
committed
Remove the Flexer component from the Security tab in settings
1 parent b23d8b5 commit d7b9f1e

1 file changed

Lines changed: 36 additions & 45 deletions

File tree

src/gui/src/UI/Settings/UITabSecurity.js

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919
import TeePromise from "../../util/TeePromise.js";
20-
import Button from "../Components/Button.js";
21-
import Flexer from "../Components/Flexer.js";
22-
import JustHTML from "../Components/JustHTML.js";
23-
import PasswordEntry from "../Components/PasswordEntry.js";
2420
import UIComponentWindow from "../UIComponentWindow.js";
2521
import UIWindow2FASetup from "../UIWindow2FASetup.js";
2622

@@ -112,47 +108,22 @@ export default {
112108
password_confirm_promise.resolve(true);
113109
$(win).close();
114110
}
115-
const password_confirm = new Flexer({
116-
children: [
117-
new JustHTML({
118-
html: /*html*/`
119-
<h3 style="text-align:center; font-weight: 500; font-size: 20px;">${
120-
i18n('disable_2fa_confirm')
121-
}</h3>
122-
<p style="text-align:center; padding: 0 20px;">${
123-
i18n('disable_2fa_instructions')
124-
}</p>
125-
`
126-
}),
127-
new Flexer({
128-
gap: '5pt',
129-
children: [
130-
new PasswordEntry({
131-
_ref: me => password_entry = me,
132-
on_submit: async () => {
133-
try_password();
134-
}
135-
}),
136-
new Button({
137-
label: i18n('disable_2fa'),
138-
on_click: async () => {
139-
try_password();
140-
}
141-
}),
142-
new Button({
143-
label: i18n('cancel'),
144-
style: 'secondary',
145-
on_click: async () => {
146-
password_confirm_promise.resolve(false);
147-
$(win).close();
148-
}
149-
})
150-
]
151-
}),
152-
]
153-
});
111+
112+
let h = '';
113+
h += `<div style="display: flex; flex-direction: column; gap: 20pt; justify-content: center;">`;
114+
h += `<div>`;
115+
h += `<h3 style="text-align:center; font-weight: 500; font-size: 20px;">${i18n('disable_2fa_confirm')}</h3>`;
116+
h += `<p style="text-align:center; padding: 0 20px;">${i18n('disable_2fa_instructions')}</p>`;
117+
h += `</div>`;
118+
h += `<div style="display: flex; gap: 5pt;">`;
119+
h += `<input type="password" class="password-entry" />`;
120+
h += `<button class="button confirm-disable-2fa">${i18n('disable_2fa')}</button>`;
121+
h += `<button class="button secondary cancel-disable-2fa">${i18n('cancel')}</button>`;
122+
h += `</div>`;
123+
h += `</div>`;
124+
154125
win = await UIComponentWindow({
155-
component: password_confirm,
126+
html: h,
156127
width: 500,
157128
backdrop: true,
158129
is_resizable: false,
@@ -163,7 +134,27 @@ export default {
163134
padding: '20px',
164135
},
165136
});
166-
password_entry.focus();
137+
138+
// Set up event listeners
139+
const $win = $(win);
140+
const $password_entry = $win.find('.password-entry');
141+
142+
$password_entry.on('keypress', (e) => {
143+
if(e.which === 13) { // Enter key
144+
try_password();
145+
}
146+
});
147+
148+
$win.find('.confirm-disable-2fa').on('click', () => {
149+
try_password();
150+
});
151+
152+
$win.find('.cancel-disable-2fa').on('click', () => {
153+
password_confirm_promise.resolve(false);
154+
$win.close();
155+
});
156+
157+
$password_entry.focus();
167158

168159
const ok = await password_confirm_promise;
169160
if ( ! ok ) return;

0 commit comments

Comments
 (0)