Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            Response.ContentType = "text/plain";

            var un = Request["username"];
            var pw = Request["password"];

            if (String.IsNullOrEmpty(un) || String.IsNullOrEmpty(pw))
            {
                invalid(null);
            }
            else
            {
                try {
                    var hash = SecureData.Login(un, pw);
                    Response.Write(hash);
                } catch (Exception ex) {
                    invalid("Login failed: " + ex.Message);
                }
            }
        }
Beispiel #2
0
        public Status Login(Credential credential)
        {
            var status = new Status();

            try
            {
                var dsValidateLogin = SecureData.TestLogin(false, credential.Username, credential.Password);

                if (dsValidateLogin.Tables.Contains("validate_login") && dsValidateLogin.Tables["validate_login"].Rows.Count > 0)
                {
                    status.CooperatorId = dsValidateLogin.Tables["validate_login"].Rows[0].Field <int>("cooperator_id");
                    status.Token        = SecureData.Login(credential.Username, credential.Password);
                    if (string.IsNullOrEmpty(status.Token))
                    {
                        status.Success = false;
                        status.Error   = "Error generating token";
                    }
                    else
                    {
                        status.Success = true;
                    }
                }
                else
                {
                    status.Success = false;
                    status.Error   = "Error validating credentials";
                }
            }
            catch (Exception ex)
            {
                status.Success = false;
                status.Error   = ex.Message;
            }

            return(status);
        }
Beispiel #3
0
 public string Login(string userName, string password)
 {
     return(SecureData.Login(userName, password));
 }
Beispiel #4
0
 public string Login()
 {
     return(SecureData.Login(_conn.GrinGlobalUserName, _conn.GrinGlobalPassword, _conn.GenerateDataConnectionSpec()));
 }