/// <summary>
 /// 检查用户名是否唯一
 /// </summary>
 /// <param name="addLoginDto"></param>
 internal void CheckaddLoginDto(AddLoginDto addLoginDto)
 {
     if (_boProvider._context.Peoples.Any(m => m.NetName == addLoginDto.NetName))
     {
         throw ExceptionHelper.InvalidArgumentException("该用户名已存在");
     }
 }
Beispiel #2
0
        /// <summary>
        /// 设置密码和用户名
        /// </summary>
        /// <param name="addLoginDto"></param>
        internal bool SetPayPassword(AddLoginDto addLoginDto)
        {
            var salt = CreateSalt();
            var pwd  = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(addLoginDto.Password + salt))).Replace("-", "");

            People.Password = pwd;
            People.NetName  = addLoginDto.NetName;
            People.Salt     = salt;
            return(_boProvider._peopleRepo.SetPayPassword(People));
        }
 public async Task AddLoginAsync([FromBody] AddLoginDto loginDto)
 {
     await _userStore.AddLoginAsync(
         loginDto.User,
         loginDto.UserLoginInfo);
 }
Beispiel #4
0
        public async Task AddLoginAsync([FromBody] AddLoginDto login, [FromServices] WebStoreDB db)
        {
            await _userStore.AddLoginAsync(login.User, login.UserLoginInfo);

            await db.SaveChangesAsync();
        }