ORE Studio 0.0.4
Loading...
Searching...
No Matches
account_dialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_WT_SERVICE_APP_ACCOUNT_DIALOG_HPP
21#define ORES_WT_SERVICE_APP_ACCOUNT_DIALOG_HPP
22
23#include <Wt/WDialog.h>
24#include <Wt/WLineEdit.h>
25#include <Wt/WPasswordEdit.h>
26#include <Wt/WPushButton.h>
27#include <Wt/WText.h>
28#include <Wt/WSignal.h>
29#include <boost/uuid/uuid.hpp>
30
31namespace ores::wt::service::app {
32
37 boost::uuids::uuid id;
38 std::string username;
39 std::string email;
40 std::string password;
41 std::string confirm_password;
42 int version = 0;
43};
44
48class account_dialog : public Wt::WDialog {
49public:
50 enum class mode { add, edit };
51
52 explicit account_dialog(mode m);
53
54 void set_account(const account_data& data);
55 account_data get_account() const;
56
57 Wt::Signal<account_data>& saved() { return saved_; }
58
59private:
60 void setup_form();
61 void setup_buttons();
62 void validate_and_save();
63
64 mode mode_;
65 Wt::WLineEdit* username_edit_;
66 Wt::WLineEdit* email_edit_;
67 Wt::WPasswordEdit* password_edit_;
68 Wt::WPasswordEdit* confirm_password_edit_;
69 Wt::WText* status_text_;
70
71 boost::uuids::uuid account_id_;
72 Wt::Signal<account_data> saved_;
73};
74
75}
76
77#endif
Account data for form binding.
Definition account_dialog.hpp:36
Dialog for creating/editing user accounts.
Definition account_dialog.hpp:48