blob: c3f2befe25381a8c1f04850a563b57270a286046 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
const std = @import("std");
const Context = @import("../../context.zig");
const Storage = @import("../../../storage/root.zig");
pub const needs_auth = false;
pub const method = .POST;
const Body = struct {
user: []const u8,
password: []const u8,
};
const Result = struct {
success: bool,
};
pub fn handler(ctx: *Context, body: Body) anyerror!Result {
var user = Storage.User.open(ctx.storage, body.user, ctx.allocator) catch return .{
.success = false
};
defer user.deinit();
return .{ .success = user.check_password(body.password) };
}
|