private void ButtonSetTarget_Click(object sender, RoutedEventArgs e)
        {
            this.cbTarget.SelectedValue = null;
            var dataContext = this.DataContext as PublishProfileEditorResources;

            if (dataContext == null)
            {
                throw new InvalidOperationException("DataContext is not a valid PublishProfileEditorResources");
            }

            var loginForm = new LogOnForm(Application.Current.MainWindow);

            var result = loginForm.ShowDialog();

            if (result == true)
            {
                var target = loginForm.CloudTarget;

                dataContext.LoggedIn = true;

                dataContext.SelectedPublishProfile.User     = loginForm.Credentials.User;
                dataContext.SelectedPublishProfile.Password = loginForm.Credentials.Password;
                this.cbTarget.SelectedValue = target;
            }
        }
Beispiel #2
0
        public ActionResult LogOn(LogOnForm model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (userManager.ValidateUser(model.Nickname, model.Password))
                {
                    userManager.SignIn(model.Nickname, model.RememberMe);
                    Session["nickname"] = model.Nickname;
                    Session.Timeout     = 100000;
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Beispiel #3
0
 private void FormMain_Load(object sender, EventArgs e)
 {
     m_bIsLogIn  = false;
     m_LoginForm = new LogOnForm(Connect, Reconnect);
     m_LoginForm.ShowDialog();
     if (m_bIsLogIn == false)
     {
         Close();
     }
 }
        public ActionResult LogOn(LogOnForm form)
        {
            if (!_users.Any(n => n.Username == form.Username && n.Password == form.Password))
            {
                return(View());
            }

            FormsAuthentication.SetAuthCookie(form.Username, false);
            return(RedirectToAction("Index", "Home"));
        }
Beispiel #5
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     this.DisableUI();
     try
     {
         using (LogOnForm f = new LogOnForm())
         {
             f.ManagerFactory = this.currentManagerFactory;
             f.ShowDialog();
             this.currentUserToken = f.UserIdToken;
         }
     }
     finally
     {
         this.RefreshActivationStorageInformation();
         this.RefreshLogOnInformation();
         this.RefreshUI();
     }
 }
Beispiel #6
0
        private void ButtonSetTarget_Click(object sender, RoutedEventArgs e)
        {
            var dataContext = this.DataContext as PublishProfileEditorResources;

            if (dataContext == null)
            {
                throw new InvalidOperationException("DataContext is not a valid PublishProfileEditorResources");
            }

            var loginForm = new LogOnForm();

            var result = loginForm.ShowDialog();

            if (result == true)
            {
                var target = loginForm.CloudTarget;
                this.cbTarget.SelectedValue = target;
            }
        }
Beispiel #7
0
        private void AddTargetButton_Click(object sender, RoutedEventArgs e)
        {
            var loginForm = new LogOnForm();

            var result = loginForm.ShowDialog();

            if (result == true)
            {
                var target = loginForm.CloudTarget;

                if (target != null)
                {
                    CloudTargetManager.SaveTarget(target);
                    CloudCredentialsManager.Save(target.TargetUrl, target.Email, loginForm.Credentials.Password);

                    this.ReloadTargets();
                }
            }
        }
 public MyFancyContext()
 {
     this.logOnForm = new LogOnForm();
     this.MainForm  = this.logOnForm;
 }