Ejemplo n.º 1
0
        public ActionResult UpdatePWDPending(int?id)
        {
            Pwd c = db.Pwds.FirstOrDefault(s => s.PwdId == id);

            if (c == null)
            {
                return(HttpNotFound());
            }
            else
            {
                c.Status = "Pending";
                db.SaveChanges();

                #region SMS NOTIF
                if (c.Client.MobileNumbers != null)
                {
                    MobileNumber mb = c.Client.MobileNumbers.FirstOrDefault(m => m.IsDisabled == false && m.Token != null);

                    if (mb != null)
                    {
                        try
                        {
                            SMS(mb.MobileNo, "Hello " + c.Client.GivenName + ", your PWD Application is now Pending.");
                        }
                        catch (Exception e)
                        {
                            Trace.TraceInformation(e.Message);
                        }
                    }
                }
                #endregion

                return(RedirectToAction("Index", new { }));
            }
        }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Login_btn  = GameObject.Find("Button_Login");
        Reg_btn    = GameObject.Find("Button_Reg");
        Logout_btn = GameObject.Find("Button_Logout");
        ID         = GameObject.Find("Input_ID");
        Pwd        = GameObject.Find("Input_PW");
        PlayerPrefs.GetInt("LogStat", 0);

        Login_btn.GetComponent <Button>().onClick.AddListener(Button_Login);
        Reg_btn.GetComponent <Button>().onClick.AddListener(Button_Reg);
        Logout_btn.GetComponent <Button>().onClick.AddListener(Button_Logout);

        if (PlayerPrefs.GetInt("LogStat") == 0)
        {
            Login_btn.SetActive(true);
            Reg_btn.SetActive(true);
            Logout_btn.SetActive(false);
            ID.SetActive(true);
            Pwd.SetActive(true);
        }
        else
        {
            Login_btn.SetActive(false);
            Reg_btn.SetActive(false);
            Logout_btn.SetActive(true);
            ID.SetActive(false);
            Pwd.SetActive(false);
        }
    }
Ejemplo n.º 3
0
        public void TestRegPagewithInvalidValues()
        {
            string        firstName = "J";
            string        lastName = "K";
            string        department = "Engineering";
            string        userName = "******";
            string        password = "******";
            string        eMail = "johncom";
            string        contact = "98675647a";
            IWebElement   FName, LName, UName, Pwd, confirmPwd, Email, Phone, Submit;
            SelectElement Department;

            regPage.elements(Browser, out FName, out LName, out UName, out Pwd, out confirmPwd, out Email, out Phone, out Department, out Submit);
            FName.SendKeys(firstName);
            //var isValidIcon = FName.FindElement(By.ClassName("glyphicon-ok"));
            Assert.IsTrue((isInvalidDataIcon(FName)), "Invalid data icon is not displayed on entering the incorrect data on First Name" + FName.Text);
            LName.SendKeys(lastName);
            Assert.IsTrue((isInvalidDataIcon(LName)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + LName.Text);
            Department.SelectByText(department);
            UName.SendKeys(userName);
            Assert.IsTrue((isInvalidDataIcon(UName)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + UName.Text);
            Pwd.SendKeys(password);
            Assert.IsTrue((isInvalidDataIcon(Pwd)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + Pwd.Text);
            confirmPwd.SendKeys(password);
            Assert.IsTrue((isInvalidDataIcon(confirmPwd)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + confirmPwd.Text);
            Phone.SendKeys(contact);
            Assert.IsTrue((isInvalidDataIcon(Phone)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + Phone.Text);
            Email.SendKeys(eMail);
            Assert.IsTrue((isInvalidDataIcon(Email)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + Email.Text);
            Assert.IsFalse((Submit.Enabled), "The form has incorrect data but Submit is enabled");
        }
Ejemplo n.º 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Account.Length != 0)
            {
                hash ^= Account.GetHashCode();
            }
            if (Pwd.Length != 0)
            {
                hash ^= Pwd.GetHashCode();
            }
            if (Servernumber != 0)
            {
                hash ^= Servernumber.GetHashCode();
            }
            if (Mac.Length != 0)
            {
                hash ^= Mac.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 5
0
        public void TestRegPagewithBlankFieldsonCompulsaryDataFields()
        {
            string        firstName = "";
            string        lastName = "";
            string        department = "Engineering";
            string        userName = "";
            string        password = "";
            string        eMail = "";
            string        contact = "9867564790";
            IWebElement   FName, LName, UName, Pwd, confirmPwd, Email, Phone, Submit;
            SelectElement Department;

            regPage.elements(Browser, out FName, out LName, out UName, out Pwd, out confirmPwd, out Email, out Phone, out Department, out Submit);
            FName.SendKeys(firstName);
            LName.SendKeys(lastName);
            Department.SelectByText(department);
            UName.SendKeys(userName);
            Pwd.SendKeys(password);
            confirmPwd.SendKeys(password);
            Phone.SendKeys(contact);
            Email.SendKeys(eMail);
            if (Submit.Displayed && Submit.Enabled)
            {
                Submit.Click();
            }
            Assert.IsTrue((isInvalidDataIcon(FName)), "Invalid data icon is not displayed on entering the incorrect data on First Name" + FName.Text);
            Assert.IsTrue((isInvalidDataIcon(LName)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + LName.Text);
            Assert.IsTrue((isInvalidDataIcon(UName)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + UName.Text);
            Assert.IsTrue((isInvalidDataIcon(Pwd)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + Pwd.Text);
            Assert.IsTrue((isInvalidDataIcon(confirmPwd)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + confirmPwd.Text);
            Assert.IsTrue((isInvalidDataIcon(Email)), "Invalid data icon is not displayed on entering the incorrect data on Last Name" + Email.Text);
            Assert.IsFalse((Submit.Enabled), "The form has blank data in required fields but Submit is enabled");
        }
Ejemplo n.º 6
0
        public void TestRegPageWithValidValues()
        {
            string        firstName = "John";
            string        lastName = "Kerry";
            string        department = "Engineering";
            string        userName = "******";
            string        password = "******";
            string        eMail = "*****@*****.**";
            string        contact = "9867564789";
            IWebElement   FName, LName, UName, Pwd, confirmPwd, Email, Phone, Submit;
            SelectElement Department;

            regPage.elements(Browser, out FName, out LName, out UName, out Pwd, out confirmPwd, out Email, out Phone, out Department, out Submit);
            FName.SendKeys(firstName);
            //var isValidIcon = FName.FindElement(By.ClassName("glyphicon-ok"));
            Assert.IsTrue((isValidDataIcon(FName)), "valid data icon is not displayed on entering the correct data on First Name" + FName.Text);
            LName.SendKeys(lastName);
            Assert.IsTrue((isValidDataIcon(LName)), "valid data icon is not displayed on entering the correct data on Last Name" + LName.Text);
            Department.SelectByText(department);
            UName.SendKeys(userName);
            Assert.IsTrue((isValidDataIcon(UName)), "valid data icon is not displayed on entering the correct data on Last Name" + UName.Text);
            Pwd.SendKeys(password);
            Assert.IsTrue((isValidDataIcon(Pwd)), "valid data icon is not displayed on entering the correct data on Last Name" + Pwd.Text);
            confirmPwd.SendKeys(password);
            Assert.IsTrue((isValidDataIcon(confirmPwd)), "valid data icon is not displayed on entering the correct data on Last Name" + confirmPwd.Text);
            Phone.SendKeys(contact);
            Assert.IsTrue((isValidDataIcon(Phone)), "valid data icon is not displayed on entering the correct data on Last Name" + Phone.Text);
            Email.SendKeys(eMail);
            Assert.IsTrue((isValidDataIcon(Email)), "valid data icon is not displayed on entering the correct data on Last Name" + Email.Text);
            Submit.Click();
            var success = Browser.FindElement(By.Id("contact_form"));

            Assert.True((success.Text == "Thanks"), "Registration was unsuccessful");
        }
Ejemplo n.º 7
0
        private async void ExecuteNewUserCommand(object obj)
        {
            this.DemandeurIdentite.Id = Guid.NewGuid().ToString();
            var loader = await MaterialDialog.Instance.LoadingDialogAsync("Veuillez patienter svp ...");

            try
            {
                if (PwdConfirm.Trim() != Pwd.Trim())
                {
                    throw new Exception("Mot de passe saisi ne correspond pas");
                }
                if (IsError)
                {
                    throw new Exception("Verifiez vos données");
                }
                this.DemandeurIdentite.Password = Pwd.HashPassword();
                await RestService.For <IBackendService>(Configurations.ServerConfig.Host).Inscription(JsonConvert.SerializeObject(this.DemandeurIdentite));

                await loader.DismissAsync();

                await MaterialDialog.Instance.AlertAsync($"Un e-mail de verification a été envoyé à {this.DemandeurIdentite.Email}");
            }
            catch (Exception e)
            {
                await loader.DismissAsync();

                await MaterialDialog.Instance.SnackbarAsync("Error: " + e.Message, 3000, Configurations.MaterialConfig.MaterialSnackbarConfiguration);
            }
        }
Ejemplo n.º 8
0
        public void Unpack(BinaryReader reader)
        {
            uint PackedAmount = reader.ReadUInt32();

            if ((PackedAmount & 0x800000) != 0) // Is the subvalue negative?
            {
                Amount = (int)(PackedAmount & 0xFFFFFF | 0xFF000000);
            }
            else
            {
                Amount = (int)(PackedAmount & 0xFFFFFF);
            }
            PwdType  = (sbyte)(PackedAmount >> 24);
            ObjectID = reader.ReadUInt32();
            switch (PwdType)
            {
            case -1:
                Pwd.Unpack(reader);
                break;

            case 1:
                Opwd.Unpack(reader);
                break;
            }
        }
Ejemplo n.º 9
0
        private async Task <HttpResponseMessage> RunAsync(string URI, HttpMethod verbe, HttpContent content)
        {
            // string pwdHash = sha256.getHashSha256(Pwd);
            string pwdHash     = Pwd.sha256();
            var    credentials = new NetworkCredential(User, pwdHash);

            using (HttpClientHandler handler = new HttpClientHandler {
                PreAuthenticate = true, Credentials = credentials
            })
                using (HttpClient clientREST = new HttpClient(handler)
                {
                    MaxResponseContentBufferSize = 1000000
                }) {
                    clientREST.BaseAddress = new Uri(this.BaseURI);
                    clientREST.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    var byteArray = Encoding.ASCII.GetBytes(User + ":" + pwdHash);
                    HttpRequestMessage request = new HttpRequestMessage(verbe, URI);
                    request.Headers.CacheControl = new CacheControlHeaderValue()
                    {
                        NoCache = true
                    };
                    clientREST.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                    if (content != null)
                    {
                        request.Content = content;
                    }
                    var stp = request.ToString();
                    HttpResponseMessage response = clientREST.SendAsync(request).Result;
                    //retourne le contenu de la réponse, si il s'agit d'une erreur, elle doit être traîtée
                    return(response);
                }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public override void Validate()
 {
     base.Validate();
     if (Pwd != null)
     {
         Pwd.Validate();
     }
 }
Ejemplo n.º 11
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pwd pwd = db.Pwds.Find(id);

            db.Pwds.Remove(pwd);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 12
0
        public void PwdTest()
        {
            Directory.SetCurrentDirectory("test files");
            var lines = new Pwd().RunCommand(new string[0]);

            Directory.SetCurrentDirectory("..");
            Assert.AreEqual(lines[1], "test.txt");
            Assert.Pass();
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Pwd fp = new Pwd();

            fp.Userid   = txtUserId.Text;
            fp.Password = txtNewPwd.Text;
            bl.ForgotPwd(fp.Userid, fp.Password);
            Response.Redirect("~/Home/LoginPage.aspx");
        }
Ejemplo n.º 14
0
 public IActionResult ChangePwd(int id, string pwd, string newpwd, bool isAdmin = false)
 {
     if (isAdmin)
     {
         UserTable _ut = _repository.Get(p => p.Id == id);
         _ut.LoginPwd = Pwd.Ecoding(newpwd);
         if (_repository.Update(_ut))
         {
             return(Json(new
             {
                 state = "0",
                 msg = "密码修改成功!"
             }));
         }
         else
         {
             return(Json(new
             {
                 state = "-1",
                 msg = "密码修改失败!"
             }));
         }
     }
     else
     {
         UserTable _ut = _repository.Get(p => p.Id == id && p.LoginPwd == Pwd.Ecoding(pwd));
         if (_ut is null)
         {
             return(Json(new
             {
                 state = "-1",
                 msg = "原始密码错误!"
             }));
         }
         else
         {
             _ut.LoginPwd = Pwd.Ecoding(newpwd);
             if (_repository.Update(_ut))
             {
                 return(Json(new
                 {
                     state = "0",
                     msg = "密码修改成功!"
                 }));
             }
             else
             {
                 return(Json(new
                 {
                     state = "-1",
                     msg = "密码修改失败!"
                 }));
             }
         }
     }
 }
Ejemplo n.º 15
0
 public ActionResult Edit([Bind(Include = "PwdId,DateCreated,DateTimeStamp,Completed,Category,SubCategory,Account_Name,URI,Location,Password_1,Account_Holder_First_Name,Account_Holder_Last_Name,Email_Address_Main,DOB,Tel,Mobile,Address_1,Address_2,Town,Region,Country,Post_Code_Zip,Question_1,Answer_1,Question_2,Answer_2,Question_3,Answer_3,Question_4,Answer_4,Question_5,Answer_5,Mother_Maiden_Name,Notes,Misc")] Pwd pwd)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pwd).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pwd));
 }
Ejemplo n.º 16
0
        public void ValidPwd_Compare_Success(string value01, string value02, string salt)
        {
            Pwd pwd01 = value01;
            Pwd pwd02 = value02;

            pwd01.GetHash(salt);
            pwd02.GetHash(salt);

            Assert.Equal(pwd01.Value, pwd02.Value);
        }
Ejemplo n.º 17
0
 private void commandLink5_Click(object sender, EventArgs e)
 {
     Pwd.Credentials cred = Pwd.askCred("Creek Login", "Please Login to use Creek");
     if (cred.Success)
     {
         if (cred.Username == "filmee24" && cred.Password == "123456c")
         {
             MessageBox.Show("logged in :D");
         }
     }
 }
Ejemplo n.º 18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Channel.Length != 0)
            {
                hash ^= Channel.GetHashCode();
            }
            if (ChannelInfo.Length != 0)
            {
                hash ^= ChannelInfo.GetHashCode();
            }
            if (Account.Length != 0)
            {
                hash ^= Account.GetHashCode();
            }
            if (Pwd.Length != 0)
            {
                hash ^= Pwd.GetHashCode();
            }
            if (MobileOs != 0)
            {
                hash ^= MobileOs.GetHashCode();
            }
            if (ClientVersion.Length != 0)
            {
                hash ^= ClientVersion.GetHashCode();
            }
            if (Language != 0)
            {
                hash ^= Language.GetHashCode();
            }
            if (ServerId.Length != 0)
            {
                hash ^= ServerId.GetHashCode();
            }
            if (Mac.Length != 0)
            {
                hash ^= Mac.GetHashCode();
            }
            if (Idfa.Length != 0)
            {
                hash ^= Idfa.GetHashCode();
            }
            if (Driver.Length != 0)
            {
                hash ^= Driver.GetHashCode();
            }
            if (Ts.Length != 0)
            {
                hash ^= Ts.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 19
0
        public ActionResult Create([Bind(Include = "PwdId,Status,CreatedByUserId,VerifiedByUserId,PsychosocialMentalDisability,VisualDisability,CommunicationDisability,LearningDisability,OrthopedicDisability,IntellectualDisability,Inborn,Acquired,AgeAcquired,InterviewDate,ApplicationDate,ApprovalDate,ReleaseDate")] Pwd pwd)
        {
            if (ModelState.IsValid)
            {
                db.Pwds.Add(pwd);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pwd));
        }
Ejemplo n.º 20
0
        public void ValidPwd_Compare_Fail(string value01, string value02)
        {
            var salt01 = "12345678";
            var salt02 = "12345679";
            Pwd pwd01  = value01;
            Pwd pwd02  = value02;

            pwd01.GetHash(salt01);
            pwd02.GetHash(salt02);

            Assert.NotEqual(pwd01.Value, pwd02.Value);
        }
Ejemplo n.º 21
0
        public LoginPage()
        {
            InitializeComponent();
            BindingContext = new LoginViewModel();

            user.Focus();

            user.Completed += (sender, e) => {
                Pwd.Focus();
            };
            NavigationPage.SetHasNavigationBar(this, false);
        }
Ejemplo n.º 22
0
 public void Button_Reg()
 {
     ShowText.text = "reg";
     action        = false;
     if (ID.GetComponent <InputField>().text != "")
     {
         CreateMainForm(ID.GetComponent <InputField>().text, Pwd.GetComponent <InputField>().text, action);
     }
     else
     {
         ShowText.text = "The user name cannot be NULL";
     }
 }
Ejemplo n.º 23
0
 void Keyboard_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (sender == UserName)
         {
             Pwd.Focus();
         }
         else
         {
             LoginBtn_Click(this, null);
         }
     }
 }
Ejemplo n.º 24
0
        // GET: Pwds/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pwd pwd = db.Pwds.Find(id);

            if (pwd == null)
            {
                return(HttpNotFound());
            }
            return(View(pwd));
        }
Ejemplo n.º 25
0
        public static string ChoosePasswordMenu()
        {
            string choose = "-1";
            int    result = -1;

            do
            {
                Console.Clear();
                Pwd.Menu();
                Console.Write("Faite votre choix : ");
                choose = Console.ReadLine();
                int.TryParse(choose, out result);
            }while (result > 5 && result < 1);
            return(choose);
        }
Ejemplo n.º 26
0
 public IActionResult Add([FromBody] UserTable _user)
 {
     try
     {
         if (_user == null)
         {
             return(Json(new
             {
                 state = "-1",
                 msg = "请输入用户!"
             }));
         }
         if (_repository.IsExist(p => p.LoginName == _user.LoginName))
         {
             return(Json(new
             {
                 state = "-1",
                 msg = "帐号已存在!"
             }));
         }
         if (_repository.IsExist(p => p.ViewName == _user.ViewName))
         {
             return(Json(new
             {
                 state = "-1",
                 msg = "昵称已存在!"
             }));
         }
         _user.RegTime  = DateTime.Now;
         _user.LoginPwd = Pwd.Ecoding(_user.LoginPwd);
         int id = _repository.SaveGetId(_user);
         return(Json(new
         {
             id,
             state = "0",
             msg = "添加成功!"
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             state = "-1",
             msg = "非法操作!"
         }));
     }
 }
Ejemplo n.º 27
0
        public void Pack(BinaryWriter writer)
        {
            uint PackedAmount = 0;

            PackedAmount |= (uint)(PwdType << 24);
            writer.Write(PackedAmount);
            writer.Write(ObjectID);
            switch (PwdType)
            {
            case -1:
                Pwd.Pack(writer);
                break;

            case 1:
                Opwd.Pack(writer);
                break;
            }
        }
Ejemplo n.º 28
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Uid.Length != 0)
            {
                hash ^= Uid.GetHashCode();
            }
            if (Pwd.Length != 0)
            {
                hash ^= Pwd.GetHashCode();
            }
            if (VerCode.Length != 0)
            {
                hash ^= VerCode.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 29
0
 public override int GetHashCode()
 {
     return
         (((Id == null) ? 0 : Id.GetHashCode())
          ^ ((Username == null) ? 0 : Username.GetHashCode())
          ^ ((Pwd == null) ? 0 : Pwd.GetHashCode())
          ^ ((DtStart == null) ? 0 : DtStart.Value.GetHashCode())
          ^ ((DtEnd == null) ? 0 : DtEnd.Value.GetHashCode())
          ^ Active.GetHashCode()
          ^ ((AuthModeId == null) ? 0 : AuthModeId.GetHashCode())
          ^ ((FirstName == null) ? 0 : FirstName.GetHashCode())
          ^ ((LastName == null) ? 0 : LastName.GetHashCode())
          ^ ((MiddleName == null) ? 0 : MiddleName.GetHashCode())
          ^ ((Telephone1 == null) ? 0 : Telephone1.GetHashCode())
          ^ ((Telephone2 == null) ? 0 : Telephone2.GetHashCode())
          ^ ((Email == null) ? 0 : Email.GetHashCode())
          ^ ((SessionId == null) ? 0 : SessionId.GetHashCode())
         );
 }
Ejemplo n.º 30
0
    public ShareModule()
    {
        /*密碼驗證: (1)長度大於8 (2)大小寫 (3)英數字*/
        Boolean gfunCheckPwd(string Pwd)
        {
            Boolean Check = false;

            char  [] Character;
            int      UpperSum = 0;
            int      LowerSum = 0;
            int      NumSum   = 0;

            if (Pwd.Length >= 8)
            {
                Character = new char[Pwd.Length];

                for (int i = 0; i < Pwd.Length; i++)
                {
                    Character[i] = Convert.ToChar(Pwd.Substring(i, 1));
                    if (Char.IsUpper(Character[i]) == true)
                    {
                        UpperSum += 1;
                    }
                    if (Char.IsLower(Character[i]) == true)
                    {
                        LowerSum += 1;
                    }
                    if (Char.IsNumber(Character[i]) == true)
                    {
                        NumSum += 1;
                    }
                }

                if (UpperSum > 0 && LowerSum > 0 && NumSum > 0)
                {
                    Check = true;
                }
            }

            return(Check);
        }
    }
Ejemplo n.º 31
0
        public bool ShowData(Pwd.Att att)
        {
            _Att = att;

            if (_Att != null)
            {
                TbText.Text = _Att.Text;
                TbData.Text = _Att.Data;
            }

            return true;
        }