예제 #1
0
    public async Task <string> Register(RegisterUser register)
    {
        if (!await register.IsLikelyValid(_captcha))
        {
            Response.StatusCode = 400;
            return("Invalid response!");
        }

        var modulrID = await _query.UserExists(register.Email);

        if (modulrID != 0)
        {
            Response.StatusCode = 403;
            return("Account is already registered!");
        }

        modulrID = await _query.Register(register.Name, register.Email);

        await _manager.SetPassword(modulrID, register.Password);

        return("");
    }