public void SaveAndReadTest()
        {
            LoginElement login = new LoginElement("jdoe");

            entry.Login = login;

            NicknameElement nickname = new NicknameElement("john");

            entry.Nickname = nickname;

            StringBuilder sb     = new StringBuilder();
            XmlWriter     writer = new XmlTextWriter(new StringWriter(sb));

            entry.SaveToXml(writer);
            writer.Close();

            XmlDocument document = new XmlDocument();

            document.LoadXml(sb.ToString());

            NicknameEntry newEntry = new NicknameEntry();

            foreach (XmlNode node in document.FirstChild.ChildNodes)
            {
                ExtensionElementEventArgs args = new ExtensionElementEventArgs();
                args.ExtensionElement = node;
                args.Base             = newEntry;
                newEntry.Parse(args, new AtomFeedParser());
            }

            Assert.AreEqual(login.UserName, newEntry.Login.UserName,
                            "Parsed entry should have same username as original entry");
            Assert.AreEqual(nickname.Name, newEntry.Nickname.Name,
                            "Parsed entry should have same nickname as original entry");
        }
        public void SetLoginTest()
        {
            LoginElement login = new LoginElement("jdoe");

            entry.Login = login;
            Assert.AreEqual(login, entry.Login, "Login should be updated after setting");
        }
Esempio n. 3
0
        public ILogin GetLogin()
        {
            LoginElement loginSection = ZyGameBaseConfigManager.GetLogin();

            if (loginSection == null)
            {
                return(null);
            }

            RetailElement retail = loginSection.RetailList[retailID];

            object[] args     = new object[0];
            string   typeName = string.Empty;

            if (retail != null)
            {
                typeName = retail.TypeName;
                args     = GetArgs(retail.Args);
            }
            else
            {
                typeName = loginSection.DefaultTypeName;
                args     = GetArgs(defaultArgs);
            }
            return((ILogin)Activator.CreateInstance(Type.GetType(typeName), args));
        }
        public void SaveAndReadTest()
        {
            LoginElement login = new LoginElement("jdoe");

            login.Admin            = true;
            login.HashFunctionName = "SHA-1";
            entry.Login            = login;

            QuotaElement quota = new QuotaElement(2048);

            entry.Quota = quota;

            NameElement name = new NameElement("Doe", "John");

            entry.Name = name;

            StringBuilder sb     = new StringBuilder();
            XmlWriter     writer = new XmlTextWriter(new StringWriter(sb));

            entry.SaveToXml(writer);
            writer.Close();

            XmlDocument document = new XmlDocument();

            document.LoadXml(sb.ToString());

            UserEntry newEntry = new UserEntry();

            foreach (XmlNode node in document.FirstChild.ChildNodes)
            {
                ExtensionElementEventArgs args = new ExtensionElementEventArgs();
                args.ExtensionElement = node;
                args.Base             = newEntry;
                newEntry.Parse(args, new AtomFeedParser());
            }

            Assert.AreEqual(login.UserName, newEntry.Login.UserName,
                            "Parsed entry should have same username as original entry");
            Assert.IsTrue(newEntry.Login.Admin,
                          "Parsed entry should have admin property set to true");
            Assert.AreEqual(login.HashFunctionName, newEntry.Login.HashFunctionName,
                            "Parsed entry should have same hash function name as original entry");
            Assert.AreEqual(quota.Limit, newEntry.Quota.Limit,
                            "Parsed entry should have same quota as original entry");
            Assert.AreEqual(name.FamilyName, newEntry.Name.FamilyName,
                            "Parsed entry should have same family name as original entry");
            Assert.AreEqual(name.GivenName, newEntry.Name.GivenName,
                            "Parsed entry should have same given name as original entry");
        }
Esempio n. 5
0
        public async Task <IActionResult> LoginUser([FromBody] LoginElement loginElement)
        {
            // Permission Level Everyone
            var email    = loginElement.Email;
            var password = loginElement.Password;

            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var authProvider = new FirebaseAuthProvider(new FirebaseConfig(this.apikey));

            try
            {
                var result = new LoginResult();
                var auth   = await authProvider.SignInWithEmailAndPasswordAsync(email, password);

                List <Conference> allconf = this._context.Conference.Where(c => c.Invalid == false).ToList();

                if (!auth.IsExpired() && !string.IsNullOrEmpty(auth.User.LocalId))
                {
                    result.User = await this._context.User.FindAsync(auth.User.LocalId);

                    result.TokenString = this.jwtService.CreateKey(result.User.UID, result.User.CouncilID);
                    result.Conferences = allconf;

                    // set values in result whether the user has already applied to the conference or not
                    result = this.SetAppliedAndAdminStatus(auth, result);

                    return(this.Ok(result));
                }
                else
                {
                    return(this.BadRequest(this.ModelState));
                }
            }
            catch (Exception)
            {
                return(this.BadRequest(this.ModelState));
            }
        }
Esempio n. 6
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            String ID = IDTextBox.Text;
            String PW = PasswordTextBox.Password;

            var Doc = PixivBrowser.Document as HTMLDocument;

            var LoginElementCollection = Doc.getElementsByTagName("input");


            foreach (IHTMLElement LoginElement in LoginElementCollection)
            {
                int i = 0;
                if (LoginElement.id == "login_pixiv_id")
                {
                    LoginElement.setAttribute("value", ID);
                }
                else if (LoginElement.id == "login_password")
                {
                    LoginElement.setAttribute("value", PW);
                    //break;
                }
                else if (LoginElement.getAttribute("name") == "skip")
                {
                    //LoginElement.setAttribute("checked", "unchecked");
                    LoginElement.click();
                    //MessageBox.Show(LoginElement.outerHTML);
                }
            }
            LoginElementCollection = Doc.getElementsByTagName("button");
            foreach (IHTMLElement LoginElement in LoginElementCollection)
            {
                if (LoginElement.id == "login_submit")
                {
                    LoginElement.click();
                }
            }
            PixivBrowser.LoadCompleted += CheckLogin;
        }
Esempio n. 7
0
 public void GoToLoginPage()
 {
     LoginElement.Click();
 }
Esempio n. 8
0
        //private void SetInputDataClear(elementGet inputGet, string data)
        //{
        //    inputGet().Click();
        //    inputGet().Clear();
        //    inputGet().SendKeys(data);
        //}

        private void SetLoginInputClear(string data)
        {
            LoginElement.Click();
            LoginElement.Clear();
            LoginElement.SendKeys(data);
        }
 public void Init()
 {
     login = new LoginElement("userName", "password", true, true);
 }