コード例 #1
0
        public void Evaluate(int SpreadMax)
        {
            client_out.SliceCount  = 1;
            succeed_out.SliceCount = 1;
            if (authorize_in.SliceCount > 0 && authorize_in[0] && app_key_in[0].Length > 0 && app_secret_in[0].Length > 0 && callback_url_in[0].Length > 0)
            {
                //weiboClient = new SinaWeiboClient("1402038860", "62e1ddd4f6bc33077c796d5129047ca2", "http://qcyn.sina.com.cn");
                SinaWeiboClient    weiboClient = new SinaWeiboClient(app_key_in[0], app_secret_in[0], callback_url_in[0]);
                AuthenticationForm form        = weiboClient.GetAuthenticationForm();

                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    client_out[0]  = weiboClient;
                    succeed_out[0] = true;
                    FLogger.Log(LogType.Debug, "Authorize Succeed");
                    FLogger.Log(LogType.Debug, weiboClient.AccessToken);
                }
                else
                {
                    client_out[0]  = null;
                    succeed_out[0] = false;
                    FLogger.Log(LogType.Debug, "Authorize Failed");
                }
            }
        }
コード例 #2
0
        public static void login()
        {
            AuthenticationForm loginScreen = new AuthenticationForm(FBQueryManager.Manager.getLoginURL());

            loginScreen.ShowDialog();
            if (m_loggedIn)
            {
                DataSetManager.Manager.loadFiles();
                m_activeForm.Close();
            }
        }
コード例 #3
0
        /// <summary>
        /// Logins the user into the current mod repository.
        /// </summary>
        /// <param name="p_vmlViewModel">The view model that provides the data and operations for this view.</param>
        /// <returns><c>true</c> if the user was successfully logged in;
        /// <c>false</c> otherwise</returns>
        protected bool Login(AuthenticationFormViewModel p_vmlViewModel)
        {
            if (InvokeRequired)
            {
                return((bool)Invoke((Func <AuthenticationFormViewModel, bool>)Login, p_vmlViewModel));
            }

            var frmLogin = new AuthenticationForm(p_vmlViewModel, null);

            return(frmLogin.ShowDialog(this) == DialogResult.OK);
        }
コード例 #4
0
ファイル: Window.cs プロジェクト: yaoshixin007/migAz
        private void authenticate()
        {
            AuthenticationForm authForm = new AuthenticationForm();

            if (authForm.ShowDialog(this) != DialogResult.OK)
            {
                this.Close();
            }

            accessKeyID = authForm.GetAWSAccessKeyID();
            secretKeyID = authForm.GetAWSSecretKeyID();
        }
コード例 #5
0
ファイル: LoginForm.cs プロジェクト: Jusharra/RMS
        private void UserButton_Click(object sender, EventArgs e)
        {
            CCurrentUser.User_name = ((UserButton)sender).TouchButton.Text;
            AuthenticationForm objAuthentication = AuthenticationForm.CreateInstance(((UserButton)sender).rmsUserName.Text);
            DialogResult       drResult          = objAuthentication.ShowDialog();

            if (drResult == DialogResult.OK)
            {
                RMSAdminMdiForm objParent = new RMSAdminMdiForm();  //Previous
                objParent.Show();
            }
        }
コード例 #6
0
        public static void logout()
        {
            AuthenticationForm loginScreen = new AuthenticationForm(FBQueryManager.Manager.getLogoutURL());

            loginScreen.ShowDialog();


            // Reset states and start over from the Welcome Screen
            m_loggedIn = false;
            m_activeForm.Close();
            m_restart = true;
            FBQueryManager.Manager.setToken(null);
        }
コード例 #7
0
ファイル: GetOptusUsage.cs プロジェクト: zhouzu/cs-script
 static public bool GetCredentials(ref string userName, ref string password, string title)
 {
     using (AuthenticationForm dlg = new AuthenticationForm(userName, password, title))
     {
         if (DialogResult.OK == dlg.ShowDialog())
         {
             userName = dlg.userName;
             password = dlg.password;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #8
0
        private void AuthenticateUser()
        {
            var authenticationForm = new AuthenticationForm();

            authenticationForm.Focus();
            if (authenticationForm.ShowDialog() == DialogResult.OK)
            {
                Focus();
                var userType = authenticationForm.UserType;
                _userLogin = authenticationForm.UserLogin;
                authenticationForm.Dispose();
                switch (userType)
                {
                case AuthenticationForm.UserTypes.Admin:
                {
                    SetGui(true, true);
                    SetUserStatus(MainLocalization.AdminRole);
                    break;
                }

                case AuthenticationForm.UserTypes.User:
                {
                    SetGui(false, true);
                    SetUserStatus(MainLocalization.OperatorRole);
                    break;
                }

                case AuthenticationForm.UserTypes.Guest:
                {
                    SetGui(false, false);
                    SetUserStatus(MainLocalization.GuestRole);
                    break;
                }
                }
            }
            else
            {
                Close();
            }
        }
コード例 #9
0
        public bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
        {
            using (AuthenticationForm auth = new AuthenticationForm())
            {
                auth.TopMost = true; //this isn't always setting to top, need to check

                //use attempts counter to stop basic auth dialog popping up in continually incorrect un and pass entered.
                //test here: https://www.httpwatch.com/httpgallery/authentication/
                DialogResult dr = auth.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    callback.Continue(auth.UserName, auth.Password);
                    return(true);
                }
                else
                {
                    callback.Dispose();
                    return(false);
                }
            }
            //callback.Dispose();
            //return false;
        }
コード例 #10
0
        private void ConnectEventHandler(object sender, EventArgs e)
        {
            AuthenticationModeEnum  mode       = AuthenticationModeEnum.UsernameAndPassword;
            RemoteDesktopClientForm clientForm = new RemoteDesktopClientForm();

            try
            {
                clientForm.Connect(connectControl.Locator.ChannelId, connectControl.SelectedProvider.RemoteEndPoint);
                mode = clientForm.GetAuthenticationMode();
            }
            catch (Exception)
            {
                clientForm.Dispose();
                MessageBox.Show(this, "Failed to connect to the remote host.", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            mActiveWindows.Add(clientForm);
            clientForm.FormClosed += new FormClosedEventHandler(ClientForm_FormClosed);
            clientForm.Show(this);

            while (true)
            {
                switch (mode)
                {
                case AuthenticationModeEnum.OnlyPassword:
                case AuthenticationModeEnum.UsernameAndPassword:
                    using (AuthenticationForm authForm = new AuthenticationForm(mode))
                    {
                        if (authForm.ShowDialog(clientForm) == System.Windows.Forms.DialogResult.OK)
                        {
                            try
                            {
                                if (HandleLoginResult(clientForm, clientForm.Login(authForm.Username, authForm.Password)))
                                {
                                    return;
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(clientForm, string.Format("Failed to login. Reason: {0}", ex.Message), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                if (!clientForm.IsConnected)
                                {
                                    clientForm.Close();
                                    //clientForm.Dispose();
                                    return;
                                }
                            }
                        }
                        else
                        {
                            clientForm.Close();
                            clientForm.Dispose();
                            return;
                        }
                    }
                    break;

                case AuthenticationModeEnum.Off:
                {
                    try
                    {
                        if (HandleLoginResult(clientForm, clientForm.Login(string.Empty, string.Empty)))
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        clientForm.Close();
                        clientForm.Dispose();
                        MessageBox.Show(clientForm, string.Format("Failed to login. Reason: {0}", ex.Message), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                break;
                }
            }
        }
コード例 #11
0
ファイル: getUrl.cs プロジェクト: Diullei/Storm
 public static bool GetCredentials(ref string userName, ref string password, string title)
 {
     using(AuthenticationForm dlg = new AuthenticationForm(userName, password, title))
     {
     if (DialogResult.OK == dlg.ShowDialog())
     {
         userName = dlg.userName;
         password = dlg.password;
         return true;
     }
     else
     {
         return false;
     }
     }
 }