Fixed login service to the correct routes
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
<list>
|
||||
<option value="lactose" />
|
||||
<option value="database" />
|
||||
<option value="milkstream" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="sourceFilePath" value="docker-compose.yml" />
|
||||
|
||||
23
.run/MilkStream_Dockerfile.run.xml
Normal file
23
.run/MilkStream_Dockerfile.run.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MilkStream/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="milkstream" />
|
||||
<option name="containerName" value="milkstream" />
|
||||
<option name="contextFolderPath" value="." />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="8080" />
|
||||
<option name="hostIp" value="127.0.0.1" />
|
||||
<option name="hostPort" value="8080" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="sourceFilePath" value="MilkStream/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -18,6 +18,10 @@
|
||||
<label class="login-lbl">Password</label>
|
||||
<input type="password" placeholder="Password" required="required" id="password" @bind="password"/>
|
||||
</div>
|
||||
<div class="login-group">
|
||||
<label class="login-lbl">Confirm Password</label>
|
||||
<input type="password" placeholder="Confirm Password" required="required" id="confirm-password" @bind="confirmPassword"/>
|
||||
</div>
|
||||
<div class="login-group">
|
||||
<a href="/login"><button class="login-btn" type="button" id="login-button">Login</button></a>
|
||||
<button class="login-btn" type="button" id="register-button" @onclick="Register_OnClick">Register</button>
|
||||
@@ -28,6 +32,7 @@
|
||||
string username = string.Empty;
|
||||
string email = string.Empty;
|
||||
string password = string.Empty;
|
||||
string confirmPassword = string.Empty;
|
||||
|
||||
async Task Register_OnClick() {
|
||||
var result = await loginService.Register(username, email, password);
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using Butter.Dtos;
|
||||
using Butter.Dtos.User;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace MilkStream;
|
||||
|
||||
public class LoginServiceOptions() {
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class LoginService {
|
||||
private HttpClient client;
|
||||
HttpClient client;
|
||||
|
||||
public LoginService() {
|
||||
public LoginService(IOptions<LoginServiceOptions> options) {
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = new Uri("http://api.milkyshot.r3d.codes/Auth/login");
|
||||
client.BaseAddress = new Uri(options.Value.BaseUrl);
|
||||
}
|
||||
|
||||
public async Task<(bool, string)> Login(string username, string password) {
|
||||
@@ -18,7 +22,7 @@ public class LoginService {
|
||||
Password = password
|
||||
};
|
||||
|
||||
var response = await client.PostAsJsonAsync("api/login", loginDto);
|
||||
var response = await client.PostAsJsonAsync("api/Auth/login", loginDto);
|
||||
|
||||
return response.IsSuccessStatusCode ? (true, response.Content.ReadAsStringAsync().Result) : (false, string.Empty);
|
||||
}
|
||||
@@ -30,13 +34,13 @@ public class LoginService {
|
||||
Password = password
|
||||
};
|
||||
|
||||
var response = await client.PostAsJsonAsync("api/register", registerDto);
|
||||
var response = await client.PostAsJsonAsync("api/Auth/register", registerDto);
|
||||
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
public async Task<bool> Logout() {
|
||||
var response = await client.PostAsync("api/logout", null);
|
||||
var response = await client.PostAsync("api/Auth/logout", null);
|
||||
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,15 @@ using MilkStream.Components;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Configuration.AddJsonFile("appsettings.json", optional: false);
|
||||
builder.Configuration.AddJsonFile("appsettings.Development.json", optional: true);
|
||||
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
builder.Services.AddScoped<LoginService>();
|
||||
builder.Services.Configure<LoginServiceOptions>(builder.Configuration.GetSection("LoginService"));
|
||||
builder.WebHost.UseStaticWebAssets();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
@@ -5,5 +5,8 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"LoginService" : {
|
||||
"BaseUrl": "http://lactose:8080/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AComponentBase_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F47427c9d550b45dead5de62b717032c4c5200_003Fb9_003F46c6ba6c_003FComponentBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AConfigurationExtensions_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb8c1c57742337e59591581af3eb2c647e9ed52d2951655fd74b1facf3ff520_003FConfigurationExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControllerBase_002Ecs_002Fl_003AC_0021_003FUsers_003Fnivek_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F96a4cc66aa48dda8a9d8be8febec4a769fc143f7a86dd53ecdebfb9c3177d_003FControllerBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEntityFrameworkServiceCollectionExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F449b441523c469ed34ff5a5e14f0bafcd8f097aa463655303dc19048fa44ac3_003FEntityFrameworkServiceCollectionExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEventCallbackWorkItem_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F47427c9d550b45dead5de62b717032c4c5200_003Fb3_003F1723aeb0_003FEventCallbackWorkItem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIFileInfo_002Ecs_002Fl_003AC_0021_003FUsers_003Fnivek_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F781590a6c8e24e6b9f85d75a1ac30c819918_003F47_003Fda5e789a_003FIFileInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileInfo_002Ecs_002Fl_003AC_0021_003FUsers_003Fnivek_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9fcad18e31a1983467a9fd4bfef344ee97d72fa4ab6ba20353b8f78db8437b1_003FFileInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIOptions_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F0b29d7c10c394184986edeae1eabf7161ce00_003F18_003Faa883c92_003FIOptions_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4363be3555734c96804bc429c863e56ab2e200_003F2f_003F2c688ff0_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARenderer_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F47427c9d550b45dead5de62b717032c4c5200_003F63_003F921ad06e_003FRenderer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
@@ -26,9 +26,12 @@
|
||||
|
||||
milkstream:
|
||||
image: milkstream
|
||||
container_name: milkstream
|
||||
build:
|
||||
context: .
|
||||
dockerfile: MilkStream/Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
volumes:
|
||||
pg_dbdata:
|
||||
Reference in New Issue
Block a user