From a48dff4a85179e3a380f9cf1025709b10ff783d9 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 15 Dec 2025 10:29:03 -0500 Subject: [PATCH] improve new API method signatures --- Oqtane.Client/Services/UserService.cs | 6 +++--- Oqtane.Server/Controllers/UserController.cs | 17 ++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Oqtane.Client/Services/UserService.cs b/Oqtane.Client/Services/UserService.cs index 437a23a6..76de84e0 100644 --- a/Oqtane.Client/Services/UserService.cs +++ b/Oqtane.Client/Services/UserService.cs @@ -291,12 +291,12 @@ namespace Oqtane.Services public async Task ForgotPasswordAsync(string username) { - return await GetJsonAsync($"{Apiurl}/forgotpassword?name={username}"); + return await GetJsonAsync($"{Apiurl}/forgotpassword/{WebUtility.UrlEncode(username)}"); } public async Task ForgotUsernameAsync(string email) { - return await GetJsonAsync($"{Apiurl}/forgotusername?email={email}"); + return await GetJsonAsync($"{Apiurl}/forgotusername/{WebUtility.UrlEncode(email)}"); } public async Task ResetPasswordAsync(User user, string token) @@ -388,7 +388,7 @@ namespace Oqtane.Services public async Task SendLoginLinkAsync(string email) { - return await GetJsonAsync($"{Apiurl}/loginlink?email={email}"); + return await GetJsonAsync($"{Apiurl}/loginlink/{WebUtility.UrlEncode(email)}"); } } } diff --git a/Oqtane.Server/Controllers/UserController.cs b/Oqtane.Server/Controllers/UserController.cs index 57ea1641..ece7d295 100644 --- a/Oqtane.Server/Controllers/UserController.cs +++ b/Oqtane.Server/Controllers/UserController.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Security.Claims; -using System.Security.Policy; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; @@ -294,15 +293,15 @@ namespace Oqtane.Controllers return user; } - // GET api//forgotpassword?name=x - [HttpGet("forgotpassword")] - public async Task ForgotPassword(string name) + // GET api//forgotpassword/x + [HttpGet("forgotpassword/{username}")] + public async Task ForgotPassword(string username) { - return await _userManager.ForgotPassword(name); + return await _userManager.ForgotPassword(username); } - // GET api//forgotusername?email=x - [HttpGet("forgotusername")] + // GET api//forgotusername/x + [HttpGet("forgotusername/{email}")] public async Task ForgotUsername(string email) { return await _userManager.ForgotUsername(email); @@ -564,8 +563,8 @@ namespace Oqtane.Controllers } } - // GET api//loginlink?email=x - [HttpGet("loginlink")] + // GET api//loginlink/x + [HttpGet("loginlink/{email}")] public async Task SendLoginLink(string email) { return await _userManager.SendLoginLink(email);