2023-12-14 22:17:28 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "handler.h"
|
|
|
|
|
2023-12-20 22:42:13 +00:00
|
|
|
class Server;
|
2023-12-14 22:17:28 +00:00
|
|
|
namespace Handler {
|
|
|
|
|
2023-12-22 23:25:20 +00:00
|
|
|
class Register : public Handler {
|
2023-12-14 22:17:28 +00:00
|
|
|
public:
|
2023-12-20 22:42:13 +00:00
|
|
|
Register(Server* server);
|
2023-12-22 23:25:20 +00:00
|
|
|
void handle(Request& request) override;
|
2023-12-14 22:17:28 +00:00
|
|
|
|
2023-12-20 22:42:13 +00:00
|
|
|
enum class Result {
|
|
|
|
success,
|
|
|
|
noLogin,
|
|
|
|
emptyLogin,
|
|
|
|
loginExists,
|
|
|
|
loginPolicyViolation,
|
|
|
|
noPassword,
|
|
|
|
emptyPassword,
|
|
|
|
passwordPolicyViolation,
|
|
|
|
unknownError
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2023-12-22 23:25:20 +00:00
|
|
|
void error(Request& request, Result result, Response::Status code);
|
2023-12-20 22:42:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Server* server;
|
2023-12-14 22:17:28 +00:00
|
|
|
};
|
|
|
|
}
|