コード例 #1
0
        public IHttpActionResult ChangePassword(string token, string newPass)
        {
            if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(newPass))
            {
                return(BadRequest("Token or new pass empty."));
            }

            string userId = _tokenCheck.DecodeUserId(token);

            if (token == null)
            {
                return(BadRequest("Token not valid."));
            }

            _SettingMng.ChangePassword(userId, newPass);

            return(Ok());
        }
コード例 #2
0
        public IHttpActionResult DecodeUserId(string token)
        {
            if (string.IsNullOrEmpty(token))
            {
                return(BadRequest("Empty token"));
            }

            try
            {
                string userId = _tokenCheck.DecodeUserId(token);
                if (string.IsNullOrEmpty(userId))
                {
                    return(BadRequest("Error, faild get user id"));
                }
                return(Ok(userId));
            }

            catch (Exception e)
            {
                return(Content(HttpStatusCode.InternalServerError, e.Message));
            }
        }