Esempio n. 1
0
        public bool LogoutCustomer(HttpContextBase context, HotcakesApplication app)
        {
            var result = true;

            Cookies.SetCookieString(WebAppSettings.CookieNameAuthenticationTokenCustomer(app.CurrentStore.Id),
                                    string.Empty,
                                    context, false, Factory.CreateEventLogger());
            return(result);
        }
Esempio n. 2
0
        public bool LogoutCustomer(System.Web.HttpContextBase context, MerchantTribeApplication app)
        {
            bool result = true;

            Cookies.SetCookieString(WebAppSettings.CookieNameAuthenticationTokenCustomer(app.CurrentStore.Id),
                                    "",
                                    context, false, new EventLog());
            return(result);
        }
Esempio n. 3
0
        public override bool LoginUser(string email, string password, out string errorMessage, out string userId)
        {
            var result = false;

            errorMessage = string.Empty;
            userId       = null;

            try
            {
                var op = ValidateUser(email, password);
                if (op.Success == false)
                {
                    errorMessage = op.Message;
                    return(false);
                }

                var u = Customers.FindByEmail(email).FirstOrDefault();
                if (u == null)
                {
                    errorMessage = "Please check your email address and password and try again.";
                    return(false);
                }

                userId = u.Bvin;

                Cookies.SetCookieString(WebAppSettings.CookieNameAuthenticationTokenCustomer(Context.CurrentStore.Id),
                                        u.Bvin,
                                        Context.RoutingContext.HttpContext, false, Factory.CreateEventLogger());
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
                EventLog.LogEvent(ex);
                errorMessage = "Unknown login error. Contact administrator for assistance.";
            }

            return(result);
        }
Esempio n. 4
0
        public bool LoginCustomer(string email, string password, ref string errorMessage, System.Web.HttpContextBase context, ref string userId, MerchantTribeApplication app)
        {
            bool result = false;

            try
            {
                SystemOperationResult op = ValidateUser(email, password);
                if (op.Success == false)
                {
                    errorMessage = op.Message;
                    return(false);
                }

                CustomerAccount u = Customers.FindByEmail(email);
                if (u == null)
                {
                    errorMessage = "Please check your email address and password and try again.";
                    return(false);
                }

                userId = u.Bvin;

                Cookies.SetCookieString(WebAppSettings.CookieNameAuthenticationTokenCustomer(app.CurrentStore.Id),
                                        u.Bvin,
                                        context, false, new EventLog());
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
                EventLog.LogEvent(ex);
                errorMessage = "Unknown login error. Contact administrator for assistance.";
            }

            return(result);
        }