require name before use (--> user status 7)
This commit is contained in:
14
Moonlight/App/Models/Forms/NameModel.cs
Normal file
14
Moonlight/App/Models/Forms/NameModel.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Moonlight.App.Models.Forms;
|
||||||
|
|
||||||
|
public class NameModel
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
[MinLength(2, ErrorMessage = "Do you think, that works?")]
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MinLength(2, ErrorMessage = "Do you think, that works?")]
|
||||||
|
public string LastName { get; set; }
|
||||||
|
}
|
||||||
67
Moonlight/Shared/Components/Auth/UserDataSetView.razor
Normal file
67
Moonlight/Shared/Components/Auth/UserDataSetView.razor
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components
|
||||||
|
@using Moonlight.App.Database.Entities
|
||||||
|
@using Moonlight.App.Models.Forms
|
||||||
|
@using Moonlight.App.Models.Misc
|
||||||
|
@using Moonlight.App.Repositories
|
||||||
|
@using Moonlight.App.Services
|
||||||
|
@using Moonlight.App.Services.Sessions
|
||||||
|
|
||||||
|
@inject IdentityService IdentityService
|
||||||
|
@inject UserRepository UserRepository
|
||||||
|
@inject SmartTranslateService SmartTranslateService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<div class="d-flex flex-center">
|
||||||
|
<div class="card rounded-3 w-md-550px">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex flex-center flex-column-fluid">
|
||||||
|
<LazyLoader Load="Load">
|
||||||
|
<SmartForm Model="Name" OnValidSubmit="SetName">
|
||||||
|
<div class="text-center mt-3 mb-11">
|
||||||
|
<h1 class="text-dark fw-bolder mb-3">
|
||||||
|
<TL>Enter your information</TL>
|
||||||
|
</h1>
|
||||||
|
<div class="text-gray-500 fw-semibold fs-6">
|
||||||
|
<TL>You need to enter your full name in order to use moonlight</TL>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col">
|
||||||
|
<InputText @bind-Value="Name.FirstName" type="text" placeholder="@(SmartTranslateService.Translate("First name"))" class="form-control bg-transparent"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<InputText @bind-Value="Name.LastName" type="text" placeholder="@(SmartTranslateService.Translate("Last name"))" class="form-control bg-transparent"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary float-end mt-3">
|
||||||
|
<TL>Change</TL>
|
||||||
|
</button>
|
||||||
|
</SmartForm>
|
||||||
|
</LazyLoader>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private User User;
|
||||||
|
private NameModel Name = new ();
|
||||||
|
|
||||||
|
private async Task Load(LazyLoader loader)
|
||||||
|
{
|
||||||
|
User = await IdentityService.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetName()
|
||||||
|
{
|
||||||
|
User.FirstName = Name.FirstName;
|
||||||
|
User.LastName = Name.LastName;
|
||||||
|
User.Status = UserStatus.Unverified;
|
||||||
|
|
||||||
|
UserRepository.Update(User);
|
||||||
|
NavigationManager.NavigateTo(NavigationManager.Uri, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -83,6 +83,10 @@
|
|||||||
{
|
{
|
||||||
<PasswordChangeView></PasswordChangeView>
|
<PasswordChangeView></PasswordChangeView>
|
||||||
}
|
}
|
||||||
|
else if (User.Status == UserStatus.DataPending)
|
||||||
|
{
|
||||||
|
<UserDataSetView></UserDataSetView>
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@Body
|
@Body
|
||||||
|
|||||||
@@ -464,3 +464,6 @@ Amount;Amount
|
|||||||
Do you really want to delete it?;Do you really want to delete it?
|
Do you really want to delete it?;Do you really want to delete it?
|
||||||
Change your password;Change your password
|
Change your password;Change your password
|
||||||
You need to change your password in order to use moonlight;You need to change your password in order to use moonlight
|
You need to change your password in order to use moonlight;You need to change your password in order to use moonlight
|
||||||
|
You need to enter your full name in order to use moonlight;You need to enter your full name in order to use moonlight
|
||||||
|
Enter your information;Enter your information
|
||||||
|
The field FirstName must be a string or array type with a minimum length of '2'.;The field FirstName must be a string or array type with a minimum length of '2'.
|
||||||
|
|||||||
Reference in New Issue
Block a user