Merge branch 'master' of http://git2.aycode.com/Adam/TourIAm
This commit is contained in:
commit
332c0a2d56
|
|
@ -8,6 +8,7 @@ namespace TIAM.Entities.Users;
|
|||
|
||||
public interface IUser : IAcUser<Profile, Company, UserToCompany, Address>, IUserDto<Profile, Company, UserToCompany>, IUserBase
|
||||
{
|
||||
public string? ConfirmToken { get; set; }
|
||||
public List<Product> Products { get; }
|
||||
|
||||
//public ServiceProvider ServiceProvider { get; set; }
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ namespace TIAM.Entities.Users
|
|||
[Table("Users")]
|
||||
public class User : AcUser<Profile, Company, UserToCompany, Address>, IUser, IUserDtoDetail
|
||||
{
|
||||
public virtual List<Product> Products { get; set; } = new();
|
||||
public string? ConfirmToken { get; set; }
|
||||
|
||||
public virtual List<Product> Products { get; set; } = [];
|
||||
|
||||
//public virtual ServiceProvider ServiceProvider { get; set; } = new();
|
||||
public virtual List<UserProductMapping> UserProductMappings { get; set; } = new();
|
||||
public virtual List<UserProductMapping> UserProductMappings { get; set; } = [];
|
||||
|
||||
public User() { }
|
||||
public User(string email, string password) : this(Guid.NewGuid(), email, password) { }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
using AyCode.Models.Users;
|
||||
|
||||
namespace TIAM.Models.Dtos.Users;
|
||||
|
||||
public class ForgotPasswordDto : AcForgotPasswordDto
|
||||
{
|
||||
public ForgotPasswordDto() : base()
|
||||
{ }
|
||||
|
||||
public ForgotPasswordDto(string email, string newPassword) : base(email, newPassword)
|
||||
{}
|
||||
}
|
||||
|
|
@ -53,8 +53,8 @@ namespace TIAM.Services.Server.Tests.LoginServices
|
|||
=> base.AcBase_LoginUser_ReturnsUser_WhenUserExist(emailPasswordStrings);
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow([LoginId, LoginPassword, "asdfgh123", "$bcrypt$v=1$salt=JwptfNI6bXd7qKOJDChlvQ==$hash=j4CEfDeibKFWFGUOzxGICyHm3/hA+71j7qoyPDUk1qY="])]
|
||||
public override void AcBase_ChangePassword_ReturnUser_WhenUserLoggedInWithNewPassword(string[] userIdOldPasswordNewPasswordDbBackupHashStrings)
|
||||
=> base.AcBase_ChangePassword_ReturnUser_WhenUserLoggedInWithNewPassword(userIdOldPasswordNewPasswordDbBackupHashStrings);
|
||||
[DataRow([LoginId, LoginPassword, "asdfgh123456"])]//, "$bcrypt$v=1$salt=JwptfNI6bXd7qKOJDChlvQ==$hash=j4CEfDeibKFWFGUOzxGICyHm3/hA+71j7qoyPDUk1qY="])]
|
||||
public override void AcBase_ChangePassword_ReturnUser_WhenUserLoggedInWithNewPassword(string[] userIdOriginalPasswordNewPasswordStrings)
|
||||
=> base.AcBase_ChangePassword_ReturnUser_WhenUserLoggedInWithNewPassword(userIdOriginalPasswordNewPasswordStrings);
|
||||
}
|
||||
}
|
||||
|
|
@ -111,7 +111,8 @@ public class SignalRTags : AcSignalRTags
|
|||
public const int AddUserModelDtoDetail = 131;
|
||||
public const int UpdateUser = 135;
|
||||
public const int UpdateUserModelDtoDetail = 136;
|
||||
public const int ChangeUserPassword = 139;
|
||||
public const int UserChangePassword = 139;
|
||||
public const int UserForgotPassword = 140;
|
||||
|
||||
public const int GetAllLogItemsByFilterText = 1000;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
var changePasswordDto = new ChangePasswordDto(Context.Id, OldPassword, NewPassword);
|
||||
//var changePasswordDto = new ChangePasswordDto(Context.Id, "Asdasd123456", NewPassword);
|
||||
var result = await AdminSignalRClient.PostDataAsync(SignalRTags.ChangeUserPassword, changePasswordDto);
|
||||
var result = await AdminSignalRClient.PostDataAsync(SignalRTags.UserChangePassword, changePasswordDto);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -341,8 +341,8 @@ namespace TIAMWebApp.Server.Controllers
|
|||
}
|
||||
|
||||
[NonAction]
|
||||
[SignalR(SignalRTags.ChangeUserPassword)]
|
||||
public async Task<UserModelDtoDetail?> ChangeUserPassword([FromBody] ChangePasswordDto changePasswordDto)
|
||||
[SignalR(SignalRTags.UserChangePassword)]
|
||||
public async Task<UserModelDtoDetail?> UserChangePassword([FromBody] ChangePasswordDto changePasswordDto)
|
||||
{
|
||||
_logger.Info("ChangeUserPassword called");
|
||||
|
||||
|
|
@ -355,6 +355,21 @@ namespace TIAMWebApp.Server.Controllers
|
|||
return null;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[SignalR(SignalRTags.UserForgotPassword)]
|
||||
public async Task<UserModelDtoDetail?> UserForgotPassword([FromBody] ForgotPasswordDto forgotPasswordDto)
|
||||
{
|
||||
_logger.Info("UserForgotPassword called");
|
||||
|
||||
var errorCode = await _loginService.ForgotPasswordAsync(forgotPasswordDto.Email, forgotPasswordDto.NewPassword);
|
||||
|
||||
if (errorCode == AcErrorCode.Unset)
|
||||
return await userDal.GetUserModelDtoByEmailAsync<UserModelDtoDetail>(forgotPasswordDto.Email, true);
|
||||
|
||||
_logger.Error($"ErrorCode: {errorCode}; email: {forgotPasswordDto.Email}");
|
||||
return null;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[SignalR(SignalRTags.UpdateUserModelDtoDetail)]
|
||||
public async Task<UserModelDtoDetail?> UpdateUserModelDtoDetail(UserModelDtoDetail userModelDtoDetail)
|
||||
|
|
|
|||
Loading…
Reference in New Issue