User changes
This commit is contained in:
parent
033e33e84d
commit
38be296be0
|
|
@ -1,6 +1,7 @@
|
|||
@page "/login"
|
||||
@using TIAMWebApp.Shared.Application.Interfaces;
|
||||
@using TIAMWebApp.Shared.Application.Models;
|
||||
@using TIAMWebApp.Shared.Application.Models.PageModels;
|
||||
@inject NavigationManager navManager
|
||||
@inject IUserDataService userDataService
|
||||
<PageTitle>Login</PageTitle>
|
||||
|
|
@ -12,14 +13,19 @@
|
|||
<div class="text-center mt-4 name">
|
||||
Tour I Am
|
||||
</div>
|
||||
<form class="p-3 mt-3">
|
||||
<EditForm Model="@loginModel" OnValidSubmit="Submit">
|
||||
<DataAnnotationsValidator />
|
||||
<!--ValidationSummary /-->
|
||||
<div class="p-3 mt-3">
|
||||
<div class="form-field d-flex align-items-center">
|
||||
<span class="far fa-user"></span>
|
||||
<input type="text" name="phoneNumber" id="phoneNumber" placeholder="Phone number">
|
||||
<input type="tel" @bind-value="loginModel.PhoneNumber" name="phoneNumber" id="phoneNumber" placeholder="Phone number">
|
||||
<ValidationMessage For="@(() => loginModel.PhoneNumber)" />
|
||||
</div>
|
||||
<div class="form-field d-flex align-items-center">
|
||||
<span class="fas fa-key"></span>
|
||||
<input type="password" name="password" id="pwd" placeholder="Password">
|
||||
<input type="password" @bind-value="loginModel.Password" name="password" id="pwd" placeholder="Password">
|
||||
<ValidationMessage For="@(() => loginModel.Password)" />
|
||||
</div>
|
||||
<div class="form-field d-flex align-items-center">
|
||||
|
||||
|
|
@ -34,8 +40,10 @@
|
|||
</select>
|
||||
</div>
|
||||
<!--button class="btn btn-primary mt-3" @onclick="next">Login</button-->
|
||||
<a class="btn btn-primary mt-3" @onclick="next">Login</a>
|
||||
</form>
|
||||
<!--a class="btn btn-primary mt-3" @onclick="next">Login</a-->
|
||||
<button class="btn btn-primary mt-3" type="submit">Login</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
<p>@isUserLoggedIn</p><p>@CurrentValue</p>
|
||||
<div class="text-center fs-6">
|
||||
<a href="#">Forget password?</a> or <a href="register">Sign up</a>
|
||||
|
|
@ -43,6 +51,7 @@
|
|||
</div>
|
||||
|
||||
@code {
|
||||
LoginModel loginModel = new();
|
||||
|
||||
bool isUserLoggedIn;
|
||||
int CurrentValue = 0;
|
||||
|
|
@ -54,6 +63,11 @@
|
|||
isUserLoggedIn = user.IsLoggedIn;
|
||||
user.UserType = (UserType)CurrentValue;
|
||||
navManager.NavigateTo("home");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Submit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Reflection.Metadata;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class UserAPIController : ControllerBase
|
||||
{
|
||||
private static readonly Supplier[] suppliers = new Supplier[]
|
||||
{
|
||||
|
||||
new Supplier(1, "Upgen Ltd.", "Sándor Kovács", "Mr", "Váci street 132", "Budapest", "Budapest", "1136", "Hungary", "+36701234567", "+3611234567", "https://www.upgen.hu"),
|
||||
new Supplier(2, "Kiraly Ltd.", "Elemér Kiraly", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
//generate 9 new suppliers with different homepage url, companyname, contactname, city, address and postalcode
|
||||
new Supplier(3, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(4, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(5, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(6, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(7, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(8, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(9, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(10, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
new Supplier(11, "Király Ltd.", "Elemér Király", "Mr", "Andrássy street 37", "Budapest", "Budapest", "1066", "Hungary", "+36701234567", "+3611234567", "https://www.kiraly.hu"),
|
||||
|
||||
};
|
||||
|
||||
private Product[] GetMockUsers(int SupplierId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static readonly User[] users = new User[]
|
||||
{
|
||||
new User{Id=1, Email="test@tiam.hu", IsLoggedIn = true},
|
||||
|
||||
};
|
||||
|
||||
private readonly ILogger<SupplierAPIController> _logger;
|
||||
|
||||
public UserAPIController(ILogger<SupplierAPIController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<Supplier> GetUsers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.PageModels
|
||||
{
|
||||
public class LoginModel
|
||||
{
|
||||
[Required]
|
||||
public string? Password { get; set; }
|
||||
[Required]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.PageModels
|
||||
{
|
||||
public class RegistrationModel
|
||||
{
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,10 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
{
|
||||
public class User
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
public bool IsLoggedIn { get; set; }
|
||||
public UserType UserType { get; set; }
|
||||
public int UserRoles { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue