<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[log in system backend.]]></title><description><![CDATA[<p dir="auto">Hi everyone,<br />
I am trying to make a Qt inventory application project for learning purpose.<br />
I recently learned some basic of Qt (core and widget) and I have c++ background.<br />
I have a question about the application design specifically regarding the sign-in part.</p>
<p dir="auto">I want to user to be able to sign-in based on username, and password.<br />
so at first, I thought that I can make a create account form which gets the username and password in a QMap container, and later I use that  QMap to check if they are correctly filled to allow log-in in the inventory application dashboard.</p>
<p dir="auto">However, I am new to software development and I want to know in real world application what should I do rather than using QMap.<br />
I know I should not use file to store the username, and password in a file.<br />
what do you suggest.<br />
is the SQL the right choice, or not.<br />
later each user (with specific username, and password), can have access to their specific inventory application and their own specific database.</p>
<p dir="auto">Thanks a lot for your guide and feedback.</p>
]]></description><link>https://forum.qt.io/topic/164924/log-in-system-backend.</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 02:40:59 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164924.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Jul 2026 17:08:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to log in system backend. on Fri, 24 Jul 2026 19:21:19 GMT]]></title><description><![CDATA[<p dir="auto">I am fully aware that you are developing a desktop application. This does not mean it should not access a remote service.<br />
If you want to build your skills, I would consider not dumping that part. Implement it in a later stage but don't drop it.<br />
Typically an inventory application will make use a of centralized storage so that all users can access the same information.<br />
You can either do it using a database or a web service in front of a database.</p>
]]></description><link>https://forum.qt.io/post/839365</link><guid isPermaLink="true">https://forum.qt.io/post/839365</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 24 Jul 2026 19:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Sun, 26 Jul 2026 19:15:29 GMT]]></title><description><![CDATA[<p dir="auto">One additional thing: don't fall in the trap of "make it million users salable from the beginning". Start small, then scale as needed.</p>
]]></description><link>https://forum.qt.io/post/839394</link><guid isPermaLink="true">https://forum.qt.io/post/839394</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 26 Jul 2026 19:15:29 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Sun, 26 Jul 2026 16:52:38 GMT]]></title><description><![CDATA[<p dir="auto">It's exactly right. If you can handle C++ you can handle the rest. Just additional parts of knowledge to bolt on as part of the journey.</p>
<p dir="auto">I would almost break this into two projects: the first being the core inventory application setup with a local SQL database to handle the model/views, UI components, etc. The login could just be a rudimentary login form as a placeholder via files.</p>
<p dir="auto">Then if you want to push to something that could actually be deployed you can research and tackle the above. It's a lot to bite off at once. I know that feeling of starting simple and then realizing that the complexity is quickly scaling exponentially.</p>
<p dir="auto">Happy learning!</p>
]]></description><link>https://forum.qt.io/post/839392</link><guid isPermaLink="true">https://forum.qt.io/post/839392</guid><dc:creator><![CDATA[ZNohre]]></dc:creator><pubDate>Sun, 26 Jul 2026 16:52:38 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Sun, 26 Jul 2026 16:40:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/znohre">@<bdi>ZNohre</bdi></a><br />
Thanks a lot for your thorough response.<br />
In fact, every time I want to do a project, and I try to keep it simple and just accomplish the project, but I end up learning other tools that I have not considered at first, in order to accomplish my project. I think it's common and I should be able to learn new tools and adapt.</p>
<p dir="auto">Thanks again for your guide.</p>
]]></description><link>https://forum.qt.io/post/839391</link><guid isPermaLink="true">https://forum.qt.io/post/839391</guid><dc:creator><![CDATA[imanipourmeysa]]></dc:creator><pubDate>Sun, 26 Jul 2026 16:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Sat, 25 Jul 2026 22:16:45 GMT]]></title><description><![CDATA[<p dir="auto">Coming from a C++ background I remember having the same question when I first started building my knowledge in Qt. It seemed like such a simple issue had such a steep learning curve if I wanted something even resembling a "real-world" login screen with user authentication.</p>
<p dir="auto">As you're layering in knowledge of backend programming and learning app development (especially if you're interested in creating inventory applications that live in the real world), I would point you to the below REST API framework I wish I had known earlier. You mention:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/imanipourmeysa">@<bdi>imanipourmeysa</bdi></a> said in <a href="/post/839341">log in system backend.</a>:</p>
<blockquote>
<p dir="auto">is the SQL the right choice, or not.</p>
</blockquote>
<p dir="auto">No. If you're relying on direct SQL login and access from Qt you're exposing your database to every user, making it easy to bypass your UI and modify data. In a real-world implementation it also forces you to open your database on the network, which is unsafe. A Web API fixes this by acting as a controlled gateway: Qt sends simple HTTP requests, and only the backend touches SQL.</p>
<ul>
<li><strong>Qt Desktop App</strong> - Contains the user interface and functions as a client to your backend database via a Web API. The desktop app will contain some form of ApiClient class. This is the C++ interface for login/authentication, as well as all database operations (add, update, delete). A simple ApiClient example for you might be:</li>
</ul>
<pre><code>struct LoginResponse
{
    QString token;
};

class ApiClient : public QObject
{
    Q_OBJECT

public:
    explicit ApiClient(QObject* parent = nullptr);

    // User authentication
    QFuture&lt;LoginResponse&gt; login(const QString&amp; username, const QString&amp; password);

    // Inventory API calls
    QFuture&lt;QVector&lt;InventoryItem&gt;&gt; getInventory(const InventoryFilter &amp;f);
    QFuture&lt;InventoryItem&gt; createInventory(const InventoryItem&amp; i);
    QFuture&lt;InventoryItem&gt; updateInventory(int id, const InventoryItem&amp; i);
    QFuture&lt;void&gt; deleteInventory(int id);

private:
    QString m_token;
    QNetworkAccessManager m_manager;

    QNetworkRequest buildRequest(const QString&amp; path) const;
};
</code></pre>
<p dir="auto">The actual login code might look something like this:</p>
<pre><code>QFuture&lt;LoginResponse&gt; ApiClient::login(const QString&amp; username, const QString&amp; password)
{
    QPromise&lt;LoginResponse&gt; promise;
    auto future = promise.future();

    QJsonObject payload;
    payload["username"] = username;
    payload["password"] = password;

    QNetworkRequest req = buildRequest("/login");
    QByteArray body = QJsonDocument(payload).toJson();

    QNetworkReply* reply = m_manager.post(req, body);

    QObject::connect(reply, &amp;QNetworkReply::finished, this,
                     [this, reply, promise = std::move(promise)]() mutable
                     {
                         reply-&gt;deleteLater();

                         if (reply-&gt;error() != QNetworkReply::NoError) {
                             promise.setException(std::make_exception_ptr(
                                 std::runtime_error(reply-&gt;errorString().toStdString())));
                             promise.finish();
                             return;
                         }

                         const QJsonDocument doc = QJsonDocument::fromJson(reply-&gt;readAll());
                         const QJsonObject obj = doc.object();

                         LoginResponse r;
                         r.token = obj["token"].toString();

                         this-&gt;setToken(r.token);

                         promise.addResult(r);
                         promise.finish();
                     });

    return future;
}
</code></pre>
<ul>
<li><strong>Web API</strong> - The backend service your Qt app talks to — it handles authentication, business rules, and all database access. Instead of Qt connecting directly to SQL, the Qt client sends JSON over HTTP to the API, which returns structured responses like login tokens or inventory data.</li>
</ul>
<p dir="auto">I'm using a Windows environment so the <a href="http://ASP.NET" target="_blank" rel="noopener noreferrer nofollow ugc">ASP.NET</a> code for the backend login endpoint might look like:</p>
<pre><code>app.MapPost("/login", async (
    LoginRequest req,
    AppDbContext db,
    PasswordHasher hasher,
    JwtTokenFactory tokenFactory) =&gt;
{
    var user = await db.Users
        .Where(u =&gt; u.Username == req.Username &amp;&amp; u.IsActive)
        .SingleOrDefaultAsync();

    if (user == null)
        return Results.Unauthorized();

    if (!hasher.VerifyPassword(req.Password, user.PasswordHash, user.PasswordSalt))
        return Results.Unauthorized();

    var token = tokenFactory.CreateToken(user.Username, user.IsAdmin);
    return Results.Ok(new LoginResponse(token));
});
</code></pre>
<ul>
<li><strong>SQL Server</strong> - the database where your application’s data actually lives, and the Web API is responsible for reading and writing to it. You can run your favorite SQL server locally, create tables for users and inventory, and let your API expose safe, authenticated endpoints that your Qt app consumes.</li>
</ul>
<p dir="auto">A simple SQL User table that the login API interfaces with might be:</p>
<pre><code>CREATE TABLE dbo.Users
(
    Id              INT             NOT NULL IDENTITY(1,1),
    Username        NVARCHAR(100)   NOT NULL,
    PasswordHash    VARBINARY(256)  NOT NULL,
    PasswordSalt    VARBINARY(128)  NOT NULL,
    CreatedAtUtc    DATETIME2(7)    NOT NULL,
    IsActive        BIT             NOT NULL,
    IsAdmin         BIT             NOT NULL,
);
</code></pre>
<p dir="auto">With some basic AI prompts it's more straightforward than you might think to get a basic real-world implementation setup here to start playing with.</p>
<p dir="auto">The younger version of myself would have hated the length of this post ("you mean I have to learn SQL, C#, API configuration, etc. IN ADDITION to the Qt framework??"). Yes, and it's not so bad :)</p>
]]></description><link>https://forum.qt.io/post/839381</link><guid isPermaLink="true">https://forum.qt.io/post/839381</guid><dc:creator><![CDATA[ZNohre]]></dc:creator><pubDate>Sat, 25 Jul 2026 22:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Fri, 24 Jul 2026 19:21:19 GMT]]></title><description><![CDATA[<p dir="auto">I am fully aware that you are developing a desktop application. This does not mean it should not access a remote service.<br />
If you want to build your skills, I would consider not dumping that part. Implement it in a later stage but don't drop it.<br />
Typically an inventory application will make use a of centralized storage so that all users can access the same information.<br />
You can either do it using a database or a web service in front of a database.</p>
]]></description><link>https://forum.qt.io/post/839365</link><guid isPermaLink="true">https://forum.qt.io/post/839365</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 24 Jul 2026 19:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Thu, 23 Jul 2026 21:03:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">My purpose is to learn Qt, and I considered this project (inventory management app) to do in Qt.<br />
However, it comes to my mind, that I even may not need a log-in system.<br />
If I am developing a desktop application (not a web app), then I may not need to have log in.<br />
I am trying to do an application, as portfolio and learning purpose, so I can get a job in C++/Qt, and I considered this project.</p>
<p dir="auto">thanks for your responses, they guided me.</p>
]]></description><link>https://forum.qt.io/post/839346</link><guid isPermaLink="true">https://forum.qt.io/post/839346</guid><dc:creator><![CDATA[imanipourmeysa]]></dc:creator><pubDate>Thu, 23 Jul 2026 21:03:10 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Thu, 23 Jul 2026 20:03:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a><br />
Thank you for the advices.</p>
]]></description><link>https://forum.qt.io/post/839345</link><guid isPermaLink="true">https://forum.qt.io/post/839345</guid><dc:creator><![CDATA[imanipourmeysa]]></dc:creator><pubDate>Thu, 23 Jul 2026 20:03:41 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Thu, 23 Jul 2026 18:28:06 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Some details are missing:</p>
<ul>
<li>Are you writing both the client and the server with Qt ?</li>
<li>Do you already have the backend working ?</li>
</ul>
<p dir="auto">If you want to do both with Qt, then I would recommend checking the <a href="https://github.com/cutelyst/cutelyst" target="_blank" rel="noopener noreferrer nofollow ugc">cutelyst</a> project for the backend part.</p>
<p dir="auto">If you want to broaden your knowledge, then maybe something like Django, which is in Python, for the backend part might simplify your life for getting started as all the users/password management is included there.</p>
]]></description><link>https://forum.qt.io/post/839343</link><guid isPermaLink="true">https://forum.qt.io/post/839343</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 23 Jul 2026 18:28:06 GMT</pubDate></item><item><title><![CDATA[Reply to log in system backend. on Thu, 23 Jul 2026 17:57:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/imanipourmeysa">@<bdi>imanipourmeysa</bdi></a></p>
<p dir="auto">Hi,</p>
<p dir="auto">yes, a login dialog is reasonable. There you can use a <code>QLineEdit</code> with its <code>Password</code> mode to display input as dots.</p>
<blockquote>
<p dir="auto">I know I should not use file to store the username, and password in a file.</p>
</blockquote>
<p dir="auto">You can. On e.g. Linux everything is a file ;-)<br />
But of course you should not store it as plaintext<br />
Use for example <code>QCryptograhicHash</code> and hash the input in the same way using the same algo.<br />
Store the hash in an SQL DB (using the <code>QSQL</code> Module)</p>
<ul>
<li><a href="https://doc.qt.io/qt-6/qcryptographichash.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qcryptographichash.html</a></li>
</ul>
<p dir="auto">Edit:</p>
<p dir="auto">The hash algos in <code>QCrytographicHash</code> are not very safe for passwords, at least not for actual SOTA security.<br />
You can still use it in your project to prove the point and to have some security.<br />
For actual passwords you need something like Argon (available via thirdparty lib) which adds salt to your key and is AFAIK slow to make brute forcing attacks harder.</p>
]]></description><link>https://forum.qt.io/post/839342</link><guid isPermaLink="true">https://forum.qt.io/post/839342</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Thu, 23 Jul 2026 17:57:58 GMT</pubDate></item></channel></rss>