コード例 #1
0
        override public loginParams loadToken()
        {
            loginParams login = new loginParams();

            login.LoginClientName = "TestClient";
            return(login);
        }
コード例 #2
0
ファイル: ForumsController.cs プロジェクト: galbened/sadna
        public HttpResponseMessage Post(int forumId, loginParams log)
        {
            try
            {
                if (log.username.CompareTo("Admin") == 0 && log.password.CompareTo("Admin") == 0)
                {
                    var data = new
                    {
                        id       = 1,
                        username = "******",
                        type     = "admin"
                    };

                    var result = new
                    {
                        data = data
                    };

                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
                    return(response);
                }
                else
                {
                    var userId = driver.Login(log.username, log.password, forumId);
                    var data   = new
                    {
                        id       = userId,
                        username = log.username,
                        type     = driver.GetUserType(forumId, userId)
                    };

                    var result = new
                    {
                        data = data
                    };

                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
                    return(response);
                }
            }
            catch (Exception e)
            {
                var data = new
                {
                    message = e.Message
                };
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotFound, data);
                return(response);
            }
        }
コード例 #3
0
 override public bool login(loginParams param)
 {
     Console.WriteLine("LoginClient!!");
     Debug.WriteLine("LoginClient!!\n");
     return(true);
 }