예제 #1
0
 public static Response CheckLogIn_forProcess(string authHeader)
 {
     try
     {
         //Decode Credentials
         string   encodedCredential = authHeader.Substring("Basic ".Length).Trim();
         Encoding encoding          = Encoding.GetEncoding("US-ASCII");
         string   decoded           = encoding.GetString(Convert.FromBase64String(encodedCredential));
         var      credential        = decoded.Split(':');
         //authenticate
         Response    response = new Response();
         USER_MASTER oMaster  = new USER_MASTER(Properties.Settings.Default.MyConnection);
         DataTable   dtLogIn  = oMaster.CheckLogIn(credential[0], credential[1]);
         if (dtLogIn.Rows.Count > 0)
         {
             response.Status  = 1;
             response.Message = "";
         }
         else
         {
             response.Status  = 0;
             response.Message = "Authentication Required";
         }
         return(response);
     }
     catch (Exception ex)
     {
         Response response = new Response();
         response.Message = ex.Message + "\n" + ex.StackTrace;
         response.Status  = 0;
         return(response);
     }
 }
예제 #2
0
 public Response CheckLogIn(string strUserName, string strPass)
 {
     try
     {
         USER_MASTER oMaster = new USER_MASTER(Properties.Settings.Default.MyConnection);
         DataTable   dtLogIn = oMaster.CheckLogIn(strUserName, strPass);
         if (dtLogIn.Rows.Count > 0)
         {
             response.Status  = 1;
             response.Message = "";
         }
         else
         {
             response.Status  = 0;
             response.Message = "Authentication requrie!";
         }
         return(response);
     }
     catch (Exception ex)
     {
         response.Status  = 0;
         response.Message = ex.Message + "\n" + ex.StackTrace;
         return(response);
     }
 }
예제 #3
0
        public ActionResult SignUpSubmit(USER_MASTER objUSER_MASTER)
        {
            string Msg = "";

            try
            {
                if (objUSER_MASTER.PASSWORD != objUSER_MASTER.CONFIRM_PASSWORD)
                {
                    Msg = "Password is not matched";
                }
                else
                {
                    string pass = "";
                    pass = CryptoEngine.Encrypt(objUSER_MASTER.PASSWORD, "sblw-3hn8-sqoy19");
                    objUSER_MASTER.PASSWORD = pass;
                    Msg = objUSER_MASTER.SaveData();
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            ViewBag.Message = Msg;
            return(View("~/Views/LogIn/SignUp.cshtml", objUSER_MASTER));
        }
예제 #4
0
        public ActionResult LoginSubmit(USER_MASTER objUSER_MASTER)
        {
            USER_MASTERs objUSER_MASTERs = new USER_MASTERs();

            string str         = objUSER_MASTER.EMAIL_ID;
            string email_id    = "";
            string mobile_no   = "";
            string decryptPass = "";
            String Msg         = "";

            try
            {
                if (string.IsNullOrEmpty(objUSER_MASTER.EMAIL_ID))
                {
                    Msg = "Please enter EmailId/Mobile number";
                }
                if (string.IsNullOrEmpty(objUSER_MASTER.PASSWORD))
                {
                    Msg = "Please Enter the password";
                }
                if (Msg == "")
                {
                    if (str.Contains("@"))
                    {
                        email_id = objUSER_MASTER.EMAIL_ID;
                    }
                    else
                    {
                        mobile_no = objUSER_MASTER.EMAIL_ID;
                    }

                    objUSER_MASTERs.LogInUser(email_id, mobile_no, "");
                    decryptPass = CryptoEngine.Decrypt(objUSER_MASTERs[0].PASSWORD, "sblw-3hn8-sqoy19");

                    if (objUSER_MASTERs.Count > 0)
                    {
                        if (objUSER_MASTERs[0].ACTIVE == "Y" && objUSER_MASTER.PASSWORD == decryptPass)
                        {
                            return(View("~/Views/Home/Index.cshtml"));
                        }
                    }

                    else
                    {
                        ViewBag.Message = "Invalid UserId/Password";
                    }
                }
                else
                {
                    ViewBag.Message = Msg;
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            return(View("~/Views/LogIn/LogIn.cshtml", objUSER_MASTER));
        }
예제 #5
0
        public ActionResult SignUp()
        {
            USER_MASTER objUSER_MASTER = new USER_MASTER();

            return(View(objUSER_MASTER));
        }