Example #1
0
 public object ModifyPassowrd(string account, string newPassword)
 {
     try
     {
         if (!UserServer.AccountIsExist(account).Equals("account is exists"))
         {
             return(new
             {
                 msg = "account not found"
             });
         }
         var re = UserServer.ModifyPassowrd(account, newPassword);
         return(new
         {
             msg = re
         });
     }
     catch (Exception e)
     {
         return(new
         {
             msg = e.Message
         });
     }
 }
Example #2
0
        public object Register([FromBody] User user)
        {
            try
            {
                if (user == null)
                {
                    return(new { msg = "bad request" });
                }

                var account  = user.Account;
                var active   = user.ActiveCode;
                var password = user.Password;
                var phoneNum = user.PhoneNum;

                if (UserServer.AccountIsExist(account).Equals("account is exists"))
                {
                    return(new { msg = "account is exists" });
                }

                if (UserServer.ActiveCodeState(active).Equals("key is invalid") ||
                    UserServer.ActiveCodeState(active).Equals("key is not found"))
                {
                    return(new { msg = "key is not found or invaild" });
                }

                var re = UserServer.Register(active, account, password, phoneNum);

                return(new { msg = re });
            }
            catch (Exception e)
            {
                return(new { msg = e.Message });
            }
        }
Example #3
0
 public object AccountIsExist(string account)
 {
     try
     {
         var re = UserServer.AccountIsExist(account);
         return(new { msg = re });
     }
     catch (Exception e)
     {
         return(new { msg = e.Message });
     }
 }
Example #4
0
 public object GetUser(string account)
 {
     try
     {
         if (!UserServer.AccountIsExist(account).Equals("account is exists"))
         {
             return(new { msg = "account not found" });
         }
         var re = UserServer.GetUser(account);
         return(re);
     }
     catch (Exception e)
     {
         return(new { msg = e.Message });
     }
 }
Example #5
0
 public object AccountIsExist(string account)
 {
     try
     {
         var addr = Server.GetUserIp(Request.HttpContext);
         if (Server.IPHandle(addr) == 0)
         {
             return(new { msg = "your ip can't using our api , please contact administrator" });
         }
         var re = UserServer.AccountIsExist(account);
         return(new { msg = re });
     }
     catch (Exception e)
     {
         return(new { msg = e.Message });
     }
 }
Example #6
0
        public object Register([FromBody] User user)
        {
            try
            {
                var addr = Server.GetUserIp(Request.HttpContext);
                if (Server.IPHandle(addr) == 0)
                {
                    return(new { msg = "your ip can't using our api , please contact administrator" });
                }

                if (user == null)
                {
                    return(new { msg = "bad request" });
                }

                var account  = user.Account;
                var active   = user.ActiveCode;
                var password = user.Password;
                var phoneNum = user.PhoneNum;

                if (UserServer.AccountIsExist(account).Equals("account is exists"))
                {
                    return(new { msg = "account is exists" });
                }

                if (UserServer.ActiveCodeState(active).Equals("key is invalid") ||
                    UserServer.ActiveCodeState(active).Equals("key is not found"))
                {
                    return(new { msg = "key is not found or invaild" });
                }

                var re = UserServer.Register(active, account, password, phoneNum);

                return(new { msg = re });
            }
            catch (Exception e)
            {
                return(new { msg = e.Message });
            }
        }
Example #7
0
        public object ModifyPassword([FromBody] User user)
        {
            try
            {
                var addr = Server.GetUserIp(Request.HttpContext);
                if (Server.IPHandle(addr) == 0)
                {
                    return(new
                    {
                        msg = "your ip can't using our api , please contact administrator"
                    });
                }

                if (user == null)
                {
                    return(new { msg = "request error" });
                }

                var account     = user.Account;
                var newPassword = user.Password;

                if (!UserServer.AccountIsExist(account).Equals("account is exists"))
                {
                    return(new
                    {
                        msg = "account not found"
                    });
                }
                var re = UserServer.ModifyPassowrd(account, newPassword);
                return(new
                {
                    msg = re
                });
            }
            catch (Exception e)
            {
                return(new { msg = e.Message });
            }
        }
Example #8
0
        public object Register(string active, string account, string password, string phoneNum)
        {
            try
            {
                if (UserServer.AccountIsExist(account).Equals("account is exists"))
                {
                    return(new { msg = "account is exists" });
                }

                if (UserServer.ActiveCodeState(active).Equals("key is invalid") ||
                    UserServer.ActiveCodeState(active).Equals("key is not found"))
                {
                    return(new { msg = "key is not found or invaild" });
                }

                var re = UserServer.Register(active, account, password, phoneNum);

                return(new { msg = re });
            }
            catch (Exception e)
            {
                return(new { msg = e.Message });
            }
        }