示例#1
0
        private void Bind()
        {
            Control ctl = this.LoadControl("~/WebUserControls/UCMenu.ascx");

            ctl.ID = "UCMenu";
            phUc.Controls.Add(ctl);

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var Profile         = new CustomProfileCommon();
                var userProfileInfo = JsonConvert.DeserializeObject <UserProfileInfo>(Profile.UserInfo);
                if (userProfileInfo != null)
                {
                    lbSiteTitle.InnerText = userProfileInfo.SiteTitle;
                    if (!string.IsNullOrWhiteSpace(userProfileInfo.SiteLogo))
                    {
                        imgLogo.Src     = userProfileInfo.SiteLogo;
                        imgLogo.Visible = true;
                    }
                    if (!string.IsNullOrWhiteSpace(userProfileInfo.CultureName) && userProfileInfo.CultureName.ToLower() == "en-us")
                    {
                        LoginStatus lsUser = lvUser.FindControl("lsUser") as LoginStatus;
                        lsUser.LogoutText = "[Sign Out]";
                        LoginName lnUser = lvUser.FindControl("lnUser") as LoginName;
                        lnUser.FormatString = "Welcome,{0}";
                    }
                    lbAppId.InnerText = userProfileInfo.SiteCode;
                }
            }
        }
 public override void WriteToStream(IndentStream stream)
 {
     stream.Write("CREATE LOGIN ");
     LoginName.WriteToStream(stream);
     stream.Write(" WITH PASSWORD = ");
     Password.WriteToStream(stream);
 }
示例#3
0
        public User(string user)
        {
            string[] delim      = { ",#" };
            string[] userFields = user.Split(delim, StringSplitOptions.None);
            LoginName = userFields[1];
            Email     = userFields[2];
            FullName  = userFields[4];

            int index;

            // Get Alias from LoginName
            index = LoginName.IndexOf(@"ANT\", StringComparison.CurrentCultureIgnoreCase);
            if (index > -1)
            {
                Alias = LoginName.Substring(index + 4);
            }

            // Ensure email exists
            if (string.IsNullOrEmpty(Email)) // No email but Alias is present
            {
                if (!string.IsNullOrEmpty(Alias))
                {
                    Email = Alias + "@amazon.com";
                }
            }
            else
            if (string.IsNullOrEmpty(Alias))     // If Email is present, but login name missing
            {
                index = Email.IndexOf("@");
                Alias = Email.Substring(0, index);
            }

            // Remove extra Commas in Full Name Ex/ Ngo,, Billy
            FullName = FullName.Replace(",,", ",");
        }
示例#4
0
        private void ExecuteLoginCommand()
        {
            Message = null;
            IsBusy  = true;

            Action act = () =>
            {
                if (RememberPassword || AutoLogin)
                {
                    IsolatedStorageHelper.Save(LocalData.Transfer(this));
                }
                else if (!RememberPassword)
                {
                    IsolatedStorageHelper.Delete <LocalData>();
                }

                CommunicateManager.Invoke <ILoginService>(p =>
                {
                    var token           = p.Login(Num, LoginName, LoginPwd);
                    LoginInfo.Token     = token;
                    LoginInfo.Code      = Num.Trim();
                    LoginInfo.Account   = LoginName.Trim();
                    LoginInfo.Guid      = Guid.NewGuid();
                    LoginInfo.IsLogined = true;
                    //登录成功
                    IsLogined = true;
                }, ShowErr);
            };

            Task.Factory.StartNew(act).ContinueWith(task =>
            {
                CommunicateManager.StartPushMessage();
                InvokeSetBusy(false);
            });
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserName"] == null)
            {
                //如果Sessions超时,则注销用户
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
            }
            else
            {
                LoginName control = HeadLoginView.FindControl("HeadLoginName") as LoginName;
                if (control != null)
                {
                    control.FormatString = Session["UserName"].ToString();
                }


                //Configuration conf = WebConfigurationManager.OpenWebConfiguration("~");
                //SystemWebSectionGroup swsg = (SystemWebSectionGroup)conf.GetSectionGroup("system.web");
                //AuthorizationRule rule = new AuthorizationRule(AuthorizationRuleAction.Deny);
                //rule.Users.Add("?");
                //swsg.Authorization.Rules.Add(rule);


                //conf.Save(ConfigurationSaveMode.Modified);
            }
        }
        private void PopulateName()
        {
            string ntUser = string.Empty;
            string LANID  = string.Empty;

            ntUser = this.Request.LogonUserIdentity.Name;

            LANID = ntUser.Substring(ntUser.IndexOf("\\") + 1);

            if (LANID != "")
            {
                Session.Add(Global.Parameters.User, LANID);
                // Retrieve First and Last name of user
                User user = new User();
                user.GetByPk(LANID);

                if (user.FirstName.ToString() != "")
                {
                    lblWelcome.Text = "Welcome " + user.FirstName.ToString() + " " + user.LastName.ToString();
                }
                else
                {
                    lblWelcome.Text = "Welcome " + LoginName.ToString();
                }
            }
        }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string urlCurrent                = HttpContext.Current.Request.Url.AbsolutePath;
        string urlChangePassword         = Navigation.User_ChangePassword().GetServerUrl(true);
        string urlChangePasswordFilename = urlChangePassword.Substring(urlChangePassword.LastIndexOf("/") + 1);

        if (Page.User.Identity.IsAuthenticated && !urlCurrent.Contains(urlChangePasswordFilename))
        {
            User currentUser = MembershipManager.GetUserByName(Page.User.Identity.Name);

            LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;

            if (loginName != null)
            {
                loginName.FormatString = Utilities.GetDisplayUserFirstName(currentUser.Name);
            }
            if (currentUser.PasswordChangeRequired)
            {
                Response.Redirect(Navigation.User_ChangePassword().GetServerUrl(true));
            }
        }

        // Retrieve the client version number, add it to lblVersionNumber.
        string fileName = Path.Combine(Server.MapPath("~"), "Version.txt");

        if (File.Exists(fileName))
        {
            lblVersionNumber.Text = File.ReadAllText(fileName);
        }

        Page.Title = "BusiBlocks - " + Page.Title;

        DisplayAnyFeedback();
    }
示例#8
0
        private void Login_Click(object sender, EventArgs e)
        {
            User = new Profile();
            string folderName    = System.IO.Directory.GetCurrentDirectory();
            string subFolder1    = LoginName.Text + LoginPassword.Text;
            string pathString    = System.IO.Path.Combine(folderName, subFolder1);
            string fileName      = LoginName.Text + ".txt";
            string newPathString = System.IO.Path.Combine(pathString, fileName);

            if (System.IO.Directory.Exists(pathString))
            {
                using (StreamReader reader = new StreamReader(newPathString))
                {
                    User.ProfileName = reader.ReadLine();
                    User.Password    = reader.ReadLine();
                    User.UserName    = reader.ReadLine();
                }
                MyApp.SelectedIndex = 3;
                LoginName.Clear();
                LoginPassword.Clear();
            }
            else
            {
                DialogResult result = MessageBox.Show("This Account Does Not Exist, Do You Wish To Signup?", "Login error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (result == DialogResult.Yes)
                {
                    MyApp.SelectedIndex = 2;
                }
                LoginName.Clear();
                LoginPassword.Clear();
            }
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["ServiceUnitID"] == null)
                {
                    Session.Abandon();
                    Session.RemoveAll();
                    FormsAuthentication.SignOut();
                    //FormsAuthentication.RedirectToLoginPage();
                }
            }

            this.Page.Title = "Helpdesk RSCM Kencana V1.0";
            LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;

            if (loginName != null && Session != null)
            {
                AppUser _user = new AppUser();
                _user.es.Connection.Name = "KENCANA";
                //_user.es.Connection.Name = "LOCAL_HIS";
                if (_user.LoadByPrimaryKey(HttpContext.Current.User.Identity.Name))
                {
                    loginName.FormatString = _user.UserName;
                }
            }
        }
示例#10
0
 // Login in
 public void LogIn()
 {
     LoginButton.Click();
     LoginName.SendKeys("guy");
     LoginPassword.SendKeys("guy12345");
     LoginSubmitButton.Click();
 }
示例#11
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((LoginName != null ? LoginName.GetHashCode() : 0) * 397) ^ OracleId.GetHashCode());
     }
 }
        public LoginWindow()
        {
            InitializeComponent();

            MyProject = null;
            ClearValidation();
            LoginName.Focus();
        }
示例#13
0
 public void ToDefault()
 {
     LoginName.Text = "";
     LoginName.Focus();
     login_name.Text = real_name.Text = height.Text = weight.Text = age.Text
                                                                        = driving_age.Text = career.Text = contact.Text = "";
     male.IsChecked          = true;
     LoginForm.Visibility    = System.Windows.Visibility.Visible;
     RegisterForm.Visibility = System.Windows.Visibility.Hidden;
 }
示例#14
0
 public void Trim()
 {
     LoginName = LoginName.Trim();
     LoginPwd  = LoginPwd.Trim();
     Email     = Email.Trim();
     if (!string.IsNullOrEmpty(AppKey))
     {
         AppKey = AppKey.Trim();
     }
 }
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (!LoginName.IsNullOrEmpty())
     {
         if (!LoginName.Equals(AdminEmailAddress) && new ValidationHelper().IsEmail(LoginName))
         {
             yield return(new ValidationResult("Username cannot be an email address unless it's same with your email address !"));
         }
     }
 }
示例#16
0
 public override void WriteToStream(IndentStream stream)
 {
     stream.Write("CREATE USER ");
     UserName.WriteToStream(stream);
     stream.Write(" ");
     LoginName.WriteToStream(stream);
     if (WithExpr != null)
     {
         stream.Write(" ");
         WithExpr.WriteToStream(stream);
     }
 }
示例#17
0
        public void InstantiateIn(Control container)
        {
            LiteralControl l = new LiteralControl("خوش آمديد ");

            container.Controls.Add(l);
            LoginName ln = new LoginName();

            container.Controls.Add(ln);
            l = new LiteralControl(" | ");
            container.Controls.Add(l);
            container.Controls.Add(new LoginStatus());
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetLinkTarget();
            }

            if (WebSecurity.IsAuthenticated)
            {
                LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;
                Guid      UserID    = new CustomerDAC().RetrieveUserGUID(WebSecurity.CurrentUserName);

                if (!string.IsNullOrEmpty((string)Session[SystemConstants.ses_FName]))
                {
                    loginName.FormatString = (string)Session[SystemConstants.ses_FName];
                }
                else
                {
                    var dr = new CustomerDAC().RetrieveUserProfiles(UserID);
                    if (dr != null)
                    {
                        Session[SystemConstants.ses_FName]  = dr.FirstName;
                        Session[SystemConstants.ses_LName]  = dr.LastName;
                        Session[SystemConstants.ses_Role]   = SystemConstants.CustomerRole;
                        Session[SystemConstants.ses_Email]  = dr.Email;
                        Session[SystemConstants.ses_UserID] = dr.UserID;
                        var drr = new CustomerDAC().RetrieveUserRewardDetails(dr.FirstName);
                        if (drr != null)
                        {
                            Session[SystemConstants.ses_Rwdpts] = Convert.ToString(drr.RewardPoint);
                        }
                    }
                    else
                    {
                        var drp = new CustomerDAC().RetrieveProviderProfiles(UserID);
                        if (drp != null)
                        {
                            WebSecurity.Logout();
                        }
                    }
                }
                loginName.FormatString = (string)Session[SystemConstants.ses_FName];
                string path = HttpContext.Current.Request.Url.AbsolutePath;
                if (!path.Contains("Redeem"))
                {
                    updatecartfilter();
                }
                string pts = (String)(Session[SystemConstants.ses_Rwdpts]);
                //HyperLink hlnkRewards = HeadLoginView.FindControl("hlnkRewards") as HyperLink;

                loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " (" + pts + " pts)";
            }
        }
示例#19
0
        protected void Page_Load(object sender, EventArgs e)
        {

            LoginName loginName =HeadLoginView.FindControl("HeadLoginName") as LoginName;

            if (loginName != null && Session != null)
            {
              loginName.FormatString = Session["nombre"].ToString();
            }

            
            
        }
示例#20
0
        public void InstantiateIn(System.Web.UI.Control container)
        {
            LoginName   ln = new LoginName();
            LoginStatus ls = new LoginStatus();
            Literal     lc = new Literal();

            lc.Text         = "<br />";
            ln.FormatString = "Welcome, {0}. This line is from the template.";

            container.Controls.Add(ln);
            container.Controls.Add(lc);
            container.Controls.Add(ls);
        }
示例#21
0
        private void ShowUserContext()
        {
            User user = WebSecurity.GetUserInfo(Page.User.Identity.Name);

            Company company = CxCompany.GetCompany(user.CompanyID);

            if (company != null)
            {
                LoginName loginName = AplLoginView.FindControl("LoginName1") as LoginName;
                loginName.FormatString = "{0} | " + company.Description;

                Session.Add("CompanyID", user.CompanyID);
            }
        }
示例#22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Request.Path.EndsWith("register.aspx"))
        {
            PageBase page = (PageBase)Page;

            login = (System.Web.UI.WebControls.Login)LoginView1.FindControl("Login1");

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                LoginName Lname     = (LoginName)LoginView1.FindControl("ln2");
                Literal   lit       = (Literal)LoginView1.FindControl("Literal1");
                string    separator = _skinid == "LoginTop" ? @"&nbsp;" : @"<br/>";
                lit.Text = separator;
                string lastloggedOn = SnitzTime.TimeAgoTag(page.LastVisitDateTime, page.IsAuthenticated, page.Member);
                if (Lname != null)
                {
                    Lname.FormatString = String.Format(Resources.webResources.lblLoggedOn, HttpContext.Current.User.Identity.Name, separator, lastloggedOn);
                }
            }
            else
            {
                if (login != null)
                {
                    Label uL = (Label)login.FindControl("UserNameLabel");
                    if (uL != null)
                    {
                        uL.Text = Resources.webResources.lblUsername;
                    }
                    uL = (Label)login.FindControl("PasswordLabel");
                    if (uL != null)
                    {
                        uL.Text = Resources.webResources.lblPassword;
                    }
                    CheckBox cbx = (CheckBox)login.FindControl("RememberMe");
                    if (cbx != null)
                    {
                        cbx.Text = Resources.webResources.lblRememberMe;
                    }
                }
            }
            if (login != null)
            {
                RequiredFieldValidator rfv1 = (RequiredFieldValidator)login.FindControl("UserNameRequired");
                rfv1.Text = Resources.webResources.ErrNoUsername;
                RequiredFieldValidator rfv2 = (RequiredFieldValidator)login.FindControl("PasswordRequired");
                rfv2.Text = Resources.webResources.ErrNoPassword;
            }
        }
    }
示例#23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoginView lv = (LoginView)FindControl("HeadLoginView");
         if (lv != null)
         {
             LoginName ln = (LoginName)lv.FindControl("HeadLoginName");
             if (ln != null)
             {
                 ln.FormatString = (string)Session["UserName"];
             }
         }
     }
 }
示例#24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetLinkTarget();
            }
            if (WebSecurity.IsAuthenticated)
            {
                LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;
                Guid      UserID    = new ProviderDAC().RetrieveUserGUID(WebSecurity.CurrentUserName);

                if (!string.IsNullOrEmpty((string)Session[SystemConstants.ses_FName]))
                {
                    loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " " + (string)Session[SystemConstants.ses_LName];
                }
                else
                {
                    var drp = new ProviderDAC().RetrieveProviderProfiles(UserID);
                    if (drp != null)
                    {
                        string name = drp.ProviderName;

                        if (name.Length > 20)
                        {
                            name = name.Remove(20);
                            name = name + "...";
                        }
                        Session[SystemConstants.ses_FName] = name;
                        Session[SystemConstants.ses_LName] = "";
                        Session[SystemConstants.ses_Role]  = SystemConstants.ProviderRole;
                        Session[SystemConstants.ses_Email] = drp.Email;
                    }
                    else
                    {
                        var dr = new ProviderDAC().RetrieveUserProfiles(UserID);
                        if (dr != null)
                        {
                            WebSecurity.Logout();
                            //    Session[SystemConstants.ses_FName] = dr.FirstName;
                            //    Session[SystemConstants.ses_LName] = dr.LastName;
                            //    Session[SystemConstants.ses_Role] = SystemConstants.CustomerRole;
                            //    Session[SystemConstants.ses_Email] = dr.Email;
                        }
                    }
                }
                loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " " + (string)Session[SystemConstants.ses_LName];
            }
        }
示例#25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ASPxLabel2.Text = string.Format(Server.HtmlDecode("{0} &copy; {1}"), DateTime.Now.Year, "Jetus-Soft");
        CheckCurrentUser();
        pnlLeftPanel.Visible = CurrentUser != null;
        LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;     // Page.Master.FindControl("HeadLoginName")

        if (loginName != null && pnlLeftPanel.Visible && Session != null)
        {
            var user = Session["_CurrentUser"] as UserProfile;
            if (user != null)
            {
                loginName.FormatString = user.FullName;
            }
        }
    }
示例#26
0
 public ActionResult Login(LoginName objUser)
 {
     if (ModelState.IsValid)
     {
         using (DB_Entities db = new DB_Entities())
         {
             var obj = db.UserProfiles.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault();
             if (obj != null)
             {
                 Session["UserID"]   = obj.UserId.ToString();
                 Session["UserName"] = obj.UserName.ToString();
                 return(RedirectToAction("UserDashBoard"));
             }
         }
     }
     return(View(objUser));
 }
示例#27
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (LoginName.Length != 0)
        {
            hash ^= LoginName.GetHashCode();
        }
        if (UserId != 0L)
        {
            hash ^= UserId.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoginView lv = (LoginView)FindControl("HeadLoginView");
         if (lv != null)
         {
             LoginName ln = (LoginName)lv.FindControl("HeadLoginName");
             if (ln != null)
             {
                 ln.FormatString = (string)Session["UserName"];
             }
         }
     }
     if (Session["UserId"] == null && Session["CompanyId"] == null)
     {
         Response.Write("~/LoginPage.aspx");
     }
 }
示例#29
0
        public bool Equals(SpUserDetail other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            if (this.GetType() != other.GetType())
            {
                return(false);
            }

            return(LoginName.Equals(other.LoginName, StringComparison.OrdinalIgnoreCase));
        }
示例#30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (CreatedDT.Length != 0)
            {
                hash ^= CreatedDT.GetHashCode();
            }
            if (ModifiedDT.Length != 0)
            {
                hash ^= ModifiedDT.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (LoginName.Length != 0)
            {
                hash ^= LoginName.GetHashCode();
            }
            if (PasswordHash.Length != 0)
            {
                hash ^= PasswordHash.GetHashCode();
            }
            if (AuthenticationToken.Length != 0)
            {
                hash ^= AuthenticationToken.GetHashCode();
            }
            if (IsActive != false)
            {
                hash ^= IsActive.GetHashCode();
            }
            if (IsAdmin != false)
            {
                hash ^= IsAdmin.GetHashCode();
            }
            return(hash);
        }