Merge branch 'Pierre' into 'Eric'

start of the Ui intigrating

See merge request moonleay/imageboard!7
This commit is contained in:
moonleay 2023-05-17 11:22:16 +00:00
commit a6d395ab58
6 changed files with 53 additions and 21 deletions

View file

@ -15,17 +15,14 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.13" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.13" />
<PackageReference Include="Radzen.Blazor" Version="4.4.0" /> <PackageReference Include="Radzen.Blazor" Version="4.10.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Data\Migrations" /> <Folder Include="Data\Migrations" />
<Folder Include="wwwroot\img\dynamic\comment\art" />
<Folder Include="wwwroot\img\dynamic\comment\au" /> <Folder Include="wwwroot\img\dynamic\comment\au" />
<Folder Include="wwwroot\img\dynamic\comment\e" />
<Folder Include="wwwroot\img\dynamic\comment\tec" /> <Folder Include="wwwroot\img\dynamic\comment\tec" />
<Folder Include="wwwroot\img\dynamic\comment\vg" />
<Folder Include="wwwroot\img\dynamic\op\art" /> <Folder Include="wwwroot\img\dynamic\op\art" />
<Folder Include="wwwroot\img\dynamic\op\au" /> <Folder Include="wwwroot\img\dynamic\op\au" />
<Folder Include="wwwroot\img\dynamic\op\e" /> <Folder Include="wwwroot\img\dynamic\op\e" />

View file

@ -5,39 +5,58 @@
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navManager @inject NavigationManager navManager
<h3>Login to bulletbroards</h3>
<div> <h3 class="headLogin">Login to bulletbroards</h3>
<div class="login">
<form> <form>
<div> <RadzenTemplateForm TItem="Model" Data="model" Submit=@login>
<label for="email">Email:</label> <RadzenStack Gap="1rem" Class="gapeing">
<input type="email" id="email" @bind="Email" /> <RadzenFormField Text="Email" Variant="@vari">
</div> <ChildContent>
<div> <RadzenTextBox Name="Email" @bind-Value=@model.Email />
<label for="password">Password:</label> </ChildContent>
<input type="password" id="password" @bind="Password" /> <Helper>
</div> <RadzenRequiredValidator Component="Email" Text="First name is required." />
<a @onclick="login" href="javascript:void(0)">[Login]</a> </Helper>
</RadzenFormField>
<RadzenFormField Text="Password" Variant="@vari">
<ChildContent>
<RadzenTextBox Name="Password" @bind-Value=@model.Password />
</ChildContent>
<Helper>
<RadzenRequiredValidator Component="Password" Text="Your Password" />
</Helper>
</RadzenFormField>
<RadzenButton ButtonType="ButtonType.Submit" Text="Login" ></RadzenButton>
</RadzenStack>
</RadzenTemplateForm>
</form> </form>
</div> </div>
<Register></Register>
@code { @code {
private string Email { get; set; } private Variant vari = Variant.Outlined;
private string Password { get; set; }
private bool verified; private bool verified;
class Model
{
public string Email { get; set; }
public string Password { get; set; }
}
Model model = new Model();
private async Task login() private async Task login()
{ {
Console.WriteLine("loggin you in..."); Console.WriteLine("loggin you in...");
var user = await UsersRepository.getUserByEmailRawAsync(Email); var user = await UsersRepository.getUserByEmailRawAsync(model.Email);
if (user == null) if (user == null)
{ {
await js.InvokeVoidAsync("alert", "User does not exist"); await js.InvokeVoidAsync("alert", "User does not exist");
verified = false; verified = false;
return; return;
} }
verified = BCrypt.Net.BCrypt.Verify(Password, user.Password); verified = BCrypt.Net.BCrypt.Verify(model.Password, user.Password);
if (verified) if (verified)
{ {
verified = true; verified = true;

View file

@ -0,0 +1,11 @@
.headLogin{
text-align: center;
-webkit-text-size-adjust: auto;
}
.login{
text-align: center;
align-items:center;
font-style: unset;}
.gaping{
alignment: left;
}

View file

@ -20,6 +20,10 @@
</form> </form>
</div> </div>
<span>By registering you confirm that you are atleast 18 years of age.</span> <span>By registering you confirm that you are atleast 18 years of age.</span>
@code { @code {
private string Email { get; set; } private string Email { get; set; }
private string Password { get; set; } private string Password { get; set; }

View file

@ -15,7 +15,8 @@
<link href="css/site.css" rel="stylesheet"/> <link href="css/site.css" rel="stylesheet"/>
<link href="ImageBoardServerApp.styles.css" rel="stylesheet"/> <link href="ImageBoardServerApp.styles.css" rel="stylesheet"/>
<link rel="icon" type="image/png" href="/img/static/logo.png"/> <link rel="icon" type="image/png" href="/img/static/logo.png"/>
<!--<link rel="stylesheet" href="_content/Radzen.Blazor/css/material-dark.css"> --> <link rel="stylesheet" href="_content/Radzen.Blazor/css/material-base.css">
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered"/> <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered"/>
</head> </head>
<body> <body>