예제 #1
0
        /// <summary>
        /// 管理员登录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <OperationResult <string> > ManagerLoginAsync(T_ActivityManagerUserInfo_xhrModel request)
        {
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                return(OperationResult.FromError <string>("-31", string.Format(Resource.ParameterError_IsRequired, "账号")));
            }
            if (string.IsNullOrWhiteSpace(request.PassWords))
            {
                return(OperationResult.FromError <string>("-31", string.Format(Resource.ParameterError_IsRequired, "密码")));
            }
            string passWordsSalt = ActivityManager.GetPassWordsSalt(request);

            if (string.IsNullOrWhiteSpace(passWordsSalt))
            {
                return(OperationResult.FromError <string>("-31", "用户名或密码不正确"));
            }
            request.PassWordsSalt = passWordsSalt;
            request.PassWords     = HashSecurityHelper.Sha1Encrypt(request.PassWords + request.PassWordsSalt);
            return(OperationResult.FromResult <string>(await ActivityManager.ManagerLoginAsync(request)));
        }
예제 #2
0
        /// <summary>
        /// 管理员注册
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <OperationResult <bool> > ManagerRegisterAsync(T_ActivityManagerUserInfo_xhrModel request)
        {
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                return(OperationResult.FromError <bool>("-31", string.Format(Resource.ParameterError_IsRequired, "账号")));
            }
            if (string.IsNullOrWhiteSpace(request.PassWords))
            {
                return(OperationResult.FromError <bool>("-31", string.Format(Resource.ParameterError_IsRequired, "密码")));
            }
            string passWordsSalt = ActivityManager.GetPassWordsSalt(request);

            if (!string.IsNullOrWhiteSpace(passWordsSalt))
            {
                return(OperationResult.FromError <bool>("-31", "用户名已存在"));
            }
            request.PassWordsSalt = Guid.NewGuid().ToString();
            request.PassWords     = HashSecurityHelper.Sha1Encrypt(request.PassWords + request.PassWordsSalt);
            //if(request.PassWords.Length>0)
            //return OperationResult.FromError<bool>("-31", "密码"+ request.PassWords+"密码盐"+ request.PassWordsSalt);
            return(OperationResult.FromResult <bool>(await ActivityManager.ManagerRegisterAsync(request)));
        }