pica/handler/login.h
2024-01-22 15:21:55 -03:00

36 lines
635 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 Login : public Handler {
public:
Login(const std::shared_ptr<Server>& server);
void handle(Request& request) override;
enum class Result {
success,
noLogin,
emptyLogin,
noPassword,
emptyPassword,
wrongCredentials,
unknownError
};
private:
void error(Request& request, Result result, Response::Status code);
private:
std::weak_ptr<Server> server;
};
}