37 lines
698 B
C++
37 lines
698 B
C++
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "handler.h"
|
|
|
|
class Server;
|
|
namespace Handler {
|
|
|
|
class Register : public Handler {
|
|
public:
|
|
Register(const std::shared_ptr<Server>& server);
|
|
void handle(Request& request) override;
|
|
|
|
enum class Result {
|
|
success,
|
|
noLogin,
|
|
emptyLogin,
|
|
loginExists,
|
|
loginPolicyViolation,
|
|
noPassword,
|
|
emptyPassword,
|
|
passwordPolicyViolation,
|
|
unknownError
|
|
};
|
|
|
|
private:
|
|
void error(Request& request, Result result, Response::Status code);
|
|
|
|
private:
|
|
std::weak_ptr<Server> server;
|
|
};
|
|
}
|