BootstrapAdmin/Bootstrap.Admin/Controllers/Api/RegisterController.cs

25 lines
711 B
C#

using Bootstrap.DataAccess;
using Bootstrap.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace Bootstrap.Admin.Controllers.Api
{
[AllowAnonymous]
[Route("api/[controller]")]
public class RegisterController : Controller
{
/// <summary>
/// 登录页面注册新用户remote validate调用
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public bool Get(string userName)
{
return BootstrapUser.RetrieveUserByUserName(userName) == null && !UserHelper.RetrieveNewUsers().Any(u => u.UserName == userName);
}
}
}