Exemple #1
0
        private void btn_Login_Click_1(object sender, EventArgs e)
        {
            Account_Service service     = new Account_Service();
            Account         currentUser = new Account();

            currentUser.Gebruikersnaam = txtbox_Gebruikersnaam.Text;
            string salt = service.GetSalt(currentUser);

            HashAndSalt retrieve = new HashAndSalt();
            string      hash     = retrieve.GenerateHash(txtbox_Wachtwoord.Text, salt);

            SqlConnection  con = new SqlConnection(@"Data Source=den1.mssql8.gear.host;Initial Catalog=pdb1920f6;Persist Security Info=True;User ID=pdb1920f6;Password=Lc9e~P-O3L2d");
            SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM ACCOUNT WHERE Gebruikersnaam ='" + txtbox_Gebruikersnaam.Text + "' AND Hash ='" + hash + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                SomerenUI UI = new SomerenUI();
                UI.Show();

                UI.GetUserName(txtbox_Gebruikersnaam.Text);
            }
            else
            {
                MessageBox.Show("Foute gebruikersnaam en/of wachtwoord..");
            }
        }
        public ActionResult AddEditUser(AddUserRequest request)
        {
            Account_Service _accountService = new Account_Service();
            BaseResponse    response        = _accountService.AddEditUser(request);

            return(Json(response));
        }
        public ActionResult GetUsers()
        {
            Account_Service        _acoountService = new Account_Service();
            List <GetUserResponse> response        = new List <GetUserResponse>();

            response = _acoountService.GetUsers();

            return(View(response));
        }
Exemple #4
0
        public ActionResult Login(LoginRequest request)
        {
            Account_Service account_Service = new Account_Service();
            LoginResponse   response        = account_Service.Login(request);

            if (response.IsSucceed)
            {
                CustomPrincipal.Login(response);
                if (response.UserView.RoleName == Role.User.ToString())
                {
                    return(RedirectToUserHomePage());
                }
                if (response.UserView.RoleName == Role.Developer.ToString() || response.UserView.RoleName == Role.Senior.ToString())
                {
                    return(RedirectToDeveloperHomePage());
                }
                if (response.UserView.RoleName == Role.Admin.ToString())
                {
                    return(RedirectToAdminHomePage());
                }
            }
            return(View(response.Message));
        }