36 lines
626 B
C++
36 lines
626 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(std::weak_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;
|
|
};
|
|
}
|
|
|