pica/handler/register.h

37 lines
698 B
C
Raw Permalink Normal View History

2023-12-30 22:42:11 +00:00
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
//SPDX-License-Identifier: GPL-3.0-or-later
2023-12-14 22:17:28 +00:00
#pragma once
2023-12-30 22:42:11 +00:00
#include <memory>
2023-12-14 22:17:28 +00:00
#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:
2024-01-22 18:21:55 +00:00
Register(const std::shared_ptr<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:
2023-12-30 22:42:11 +00:00
std::weak_ptr<Server> server;
2023-12-14 22:17:28 +00:00
};
}