Merge branch 'master' of https://dev.azure.com/luolan/ASG%E7%B3%BB%E7%BB%9F/_git/asg_backend
This commit is contained in:
commit
e836c3337f
@ -175,21 +175,21 @@ namespace asg_form.Controllers
|
||||
{
|
||||
int wp = -1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var maxId = await userManager.Users.MaxAsync(u => u.Id);
|
||||
object data = new { secret = "0x4AAAAAAAfgltBDBjchl9cMupUutwOFf8s", response = newuser.token };
|
||||
var a = await "https://challenges.cloudflare.com/turnstile/v0/siteverify".PostJsonAsync(data);
|
||||
var ok = await a.GetJsonAsync<reqdata>();
|
||||
object data = new { id = "67134feddc0ff12924d9aaf4", secretkey = "c3e08b07b8034e6b961f010abed5586a", scene= 3,token=newuser.token,ip=newuser.ip};
|
||||
var a = await newuser.server.PostJsonAsync(data);
|
||||
var ok = await a.GetJsonAsync();
|
||||
Console.WriteLine(ok);
|
||||
wp = 0;
|
||||
if (ok.success || newuser.token == "7kyes")
|
||||
if (ok.success ==1)
|
||||
{
|
||||
wp = 2;
|
||||
User? user = await this.userManager.FindByNameAsync(newuser.userName);
|
||||
if (user == null)
|
||||
{
|
||||
wp = 1;
|
||||
user = new User { Id=maxId+1,UserName = newuser.userName, chinaname = newuser.chinaname, EmailConfirmed = true, Integral = 0 };
|
||||
user = new User { Id=maxId+1,UserName = newuser.userName, chinaname = newuser.chinaname, EmailConfirmed = true, Integral = 0 ,qqnumber=newuser.qqNumber};
|
||||
wp = 3;
|
||||
var r = await userManager.CreateAsync(user, newuser.password);
|
||||
wp = 4;
|
||||
@ -208,15 +208,10 @@ namespace asg_form.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest(new error_mb { code = 400, message = "未通过人机验证" });
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var innerException = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
|
||||
return Ok( new { code = 500, message = "服务器错误", details = innerException, wp });
|
||||
return BadRequest(new error_mb { code = 400, message = $"未通过人机验证{await a.GetStringAsync()}" });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public readonly CaptchaService _captchaService = new CaptchaService();
|
||||
|
||||
@ -362,7 +357,7 @@ namespace asg_form.Controllers
|
||||
|
||||
|
||||
|
||||
public record Adduserreq(string userName, string password, string chinaname, string token);
|
||||
public record Adduserreq(string userName, string password, string chinaname, string server,string token,string ip, string qqNumber);
|
||||
|
||||
public record AddUserReq(string userName, string password, string chinaname, string captcha,string uid);
|
||||
|
||||
|
@ -5,6 +5,7 @@ using Flandre.Adapters.OneBot.Extensions;
|
||||
using Flandre.Framework;
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -149,7 +150,7 @@ var app = builder.Build();
|
||||
app.UseCors();
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseKnife4UI(c =>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user