Exemple #1
0
        /// <summary>
        /// We need a username and a password, raise an event to fetch it.
        /// </summary>
        /// <param name="pwType">
        /// name of the username/password (e.g. 'Auth')
        /// </param>
        /// <returns>the given username and password, null if none</returns>
        internal string[] getLoginPass(string pwType)
        {
            if (NoEvents)
            {
                return(null);
            }

            m_logs.logDebugLine(1, "Asking user for username and password \"" + pwType + "\"");
            NeedLoginAndPasswordEventArgs args =
                new NeedLoginAndPasswordEventArgs(pwType);

            if (NeedLoginAndPassword != null)
            {
                NeedLoginAndPassword(this, args);
            }
            else
            {
                return(null);
            }

            return(new string[] { args.UserName, args.Password });
        }
Exemple #2
0
        /// <summary>
        /// We need a username and a password, raise an event to fetch it.
        /// </summary>
        /// <param name="pwType">
        /// name of the username/password (e.g. 'Auth')
        /// </param>
        /// <returns>the given username and password, null if none</returns>
        internal string[] getLoginPass(string pwType)
        {
            if (NoEvents) return null;

            m_logs.logDebugLine(1, "Asking user for username and password \"" + pwType + "\"");
            NeedLoginAndPasswordEventArgs args =
                new NeedLoginAndPasswordEventArgs(pwType);

            if(NeedLoginAndPassword != null)
                NeedLoginAndPassword(this, args);
            else
                return null;

            return new string[] { args.UserName, args.Password };
        }
Exemple #3
0
        /// <summary>
        /// OVPN requests a username and password <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the username and password</param>
        /// <param name="e">Information, what is needed</param>
        private void m_vpn_needLoginAndPassword(object sender, NeedLoginAndPasswordEventArgs e)
        {
            m_frmlpw = new FrmLoginAndPasswd();
            string[] loginfo = null;
            loginfo = m_frmlpw.AskLoginAndPass(e.PasswordType, Name);
            if (loginfo != null)
            {
                e.UserName = loginfo[0];
                e.Password = loginfo[1];
            }

            // if no password was entered, disconnect
            if ((e.Password == null || e.UserName == null) &&
                VPNConnection.State.CreateSnapshot().ConnectionState ==
                VPNConnectionState.Initializing)
            {
                m_disconnectTimer.Start();
            }

            m_frmlpw = null;
        }