public Account SignIn(SignInModel obj)
        {
            string sql = "SELECT AccountId, Username, Email FROM Account WHERE Username = @Usr AND Password = @Pwd";

            return(connection.QuerySingleOrDefault <Account>(sql, new { Usr = obj.Usr, Pwd = Hash(obj.Pwd) }));
        }
Beispiel #2
0
        public string verifySignIn(SignInModel model)
        {
            string username, password;

            username = GetFromDb("email", model.email, "username" ,"Usernames");

            if (username == "error")
            {
                Debug.Write(TAG + " GetFromDb(): couldn't get username\n");
                return null;
            }

            if (username == "empty")  return "username not found";

            password = GetFromDb("username", username, "password" ,"Passwords");

            if (password == "error" || password == "empty") // if something strange happed
            {
                Debug.WriteIf(username == "error", TAG + " GetFromDb(): couldn't get password\n");
                return null;
            }

            if (password != GetMD5Hash(model.password))
                return "wrong password";

            return username ;
        }
Beispiel #3
0
        public Member SignIn(SignInModel obj)
        {
            string sql = "SELECT MemberId, Username, Email FROM Member WHERE Username = @Usr AND Password = @Pwd";

            return(connection.QuerySingleOrDefault <Member>(sql, new { Usr = obj.Usr, Pwd = Helper.Hash(obj.Pwd) }));
        }
Beispiel #4
0
 public ActionResult SignIn(SignInModel model)
 {
     string verificationResult = verifySignIn(model);
     if (verificationResult != null && verificationResult != "username not found" && verificationResult != "wrong password")
     {
         Session.Add("username", verificationResult);
         return RedirectToAction("Map", "Map");
     }
     else
     {
         Debug.WriteLine(TAG + " BAD REQUEST\n");
         return RedirectToAction("Index", "Home", verificationResult);
     }
 }