Esempio n. 1
0
        //// GET: IPTSELogin/Edit/5
        //public ActionResult Edit(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    login_table login_table = db.login_table.Find(id);
        //    if (login_table == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(login_table);
        //}

        //// POST: IPTSELogin/Edit/5
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Edit([Bind(Include = "Id,password")] login_table login_table)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(login_table).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }
        //    return View(login_table);
        //}

        //// GET: IPTSELogin/Delete/5
        //public ActionResult Delete(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    login_table login_table = db.login_table.Find(id);
        //    if (login_table == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(login_table);
        //}

        //// POST: IPTSELogin/Delete/5
        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        //public ActionResult DeleteConfirmed(int id)
        //{
        //    login_table login_table = db.login_table.Find(id);
        //    db.login_table.Remove(login_table);
        //    db.SaveChanges();
        //    return RedirectToAction("Index");
        //}

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
Esempio n. 2
0
        public bool CheckLogin(LoginDataModel loginData)
        {
            bool isMatched = false;

            string passwordHash = _dataAccess.GetLoginHandler().getPasswordHash(loginData.Username);

            //comparing the password to the hash Value from the DB
            if (passwordHash != null)
            {
                isMatched = BCrypt.Net.BCrypt.Verify(SecureStringToString(loginData.Password), passwordHash);
            }

            //getting rid of the password
            loginData.Dispose();

            return(isMatched);
        }