diff --git a/Bootstrap.Admin/Controllers/Api/NewController.cs b/Bootstrap.Admin/Controllers/Api/NewController.cs index 90ae5afb..603af6b2 100644 --- a/Bootstrap.Admin/Controllers/Api/NewController.cs +++ b/Bootstrap.Admin/Controllers/Api/NewController.cs @@ -1,5 +1,4 @@ using Bootstrap.DataAccess; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; @@ -29,19 +28,6 @@ namespace Bootstrap.Admin.Controllers }); } /// - /// 登录页面注册新用户提交按钮调用 - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public bool Post([FromBody] User user) - { - var ret = UserHelper.SaveUser(user); - if (ret) NotificationHelper.PushMessage(new MessageBody() { Category = "Users", Message = string.Format("{0}-{1}", user.UserName, user.Description) }); - return ret; - } - /// /// 新用户授权/拒绝接口 /// /// diff --git a/Bootstrap.Admin/Controllers/Api/RegisterController.cs b/Bootstrap.Admin/Controllers/Api/RegisterController.cs index 20bd9d32..184bd1b3 100644 --- a/Bootstrap.Admin/Controllers/Api/RegisterController.cs +++ b/Bootstrap.Admin/Controllers/Api/RegisterController.cs @@ -20,5 +20,17 @@ namespace Bootstrap.Admin.Controllers.Api { return BootstrapUser.RetrieveUserByUserName(userName) == null && !UserHelper.RetrieveNewUsers().Any(u => u.UserName == userName); } + /// + /// 登录页面注册新用户提交按钮调用 + /// + /// + /// + [HttpPost] + public bool Post([FromBody] User user) + { + var ret = UserHelper.SaveUser(user); + if (ret) NotificationHelper.PushMessage(new MessageBody() { Category = "Users", Message = string.Format("{0}-{1}", user.UserName, user.Description) }); + return ret; + } } } diff --git a/Bootstrap.Admin/wwwroot/js/login.js b/Bootstrap.Admin/wwwroot/js/login.js index 1044296a..585aecb0 100644 --- a/Bootstrap.Admin/wwwroot/js/login.js +++ b/Bootstrap.Admin/wwwroot/js/login.js @@ -14,7 +14,7 @@ $('#btnSubmit').on('click', function () { $.bc({ - url: "api/New", + url: "api/Register", data: { UserName: $('#userName').val(), Password: $('#password').val(), DisplayName: $('#displayName').val(), Description: $('#description').val() }, modal: '#dialogNew', method: "post",