Пример #1
0
        /// <summary>
        /// 临时密钥登录
        /// </summary>
        /// <param name="user"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public async Task <bool> CheckTempPasswordLoginAsync(UserItemDto user, string password)
        {
            var code = await _simpleKeyValueService.CheckAndGet(StsConstants.TempPasswordContainerName,
                                                                user.Id.ToString(), TimeSpan.FromSeconds(30)); //临时密码30秒钟有效

            if (code != password)
            {
                return(false);
            }

            await _simpleKeyValueService.Remove(StsConstants.TempPasswordContainerName, user.Id.ToString());

            return(true);
        }
Пример #2
0
        public async Task <IActionResult> DeleteAsync(string key)
        {
            var result = await _simpleKeyValueService.Remove(ContainerName, key);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }