Troubleshooting automatic login problem in VB 2013 settings

For my application, I am utilizing the most recent version of Awesomium's WebControl. The goal is for it to automatically log in when it reaches "accounts.google.com/ServiceLogin" by executing some Javascript. In my.settings.java file, I have the following code:

"document.getElementById('Email').value='1'; document.getElementById('Passwd').value='2'; document.getElementById('signIn').click();"

The email is represented by '1' and the password by '2. When the document is ready, this code is triggered:

Private Sub WebBrowser1_DocumentReady(sender As Object, e As Awesomium.Core.UrlEventArgs) Handles WebBrowser1.DocumentReady
    If WebBrowser1.Source.ToString.Contains("accounts.google.com/ServiceLogin") = True Then
        WebBrowser1.ExecuteJavascript(My.Settings.java.ToString)
    Else

    End If

I'm unsure why this implementation isn't functioning as expected. Copying the script directly like so works perfectly:

WebBrowser1.ExecuteJavascript("document.getElementById('Email').value='1'; document.getElementById('Passwd').value='2'; document.getElementById('signIn').click();")

The reason behind saving the code in my.settings is that I start with it in a textbox. After prompting the user for their credentials, I replace '1' and '2' with the inputted email and password, respectively. This modified text is then saved in my.settings.java. By doing this, the application can retrieve the customized Javascript for each user instead of hardcoding it. Is there an error in my code or an alternative method using Awesomium? Additionally, I usually refer to Awesomium's WebControl1 but changed it to WebBrowser1 for consistency. Apologies if this question seems basic, I'm still learning and have limited experience with Javascript.

Answer №1

When it comes to sensitive data like passwords or emails, I never rely on my.settings. Instead, I always encrypt them in an XML file using a secure encryption method. Here is a simple yet dynamic encryption function that I use:

Public Function Encrypt(ByVal plainText As String) As String
    Dim passPhrase As String = **My.Computer.Name.ToString**
    Dim saltValue As String = **My.Computer.Info.OSFullName.ToString**
    (...)
End Function

Public Function Decrypt(ByVal cipherText As String) As String
    Dim passPhrase As String = **My.Computer.Name.ToString**
    Dim saltValue As String = **My.Computer.Info.OSFullName.ToString**
    (...)
End Function

Although this method adds a layer of security, it's still not foolproof. The best practice is to have the user input their password directly. Regarding your query, if I grasp it correctly, you should create profiles and store them in files or a database instead of relying solely on settings or registries. This allows users like "John" to select their specific profile when using your program.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trigger the fire event on .click() except when text is being selected

I am currently working on a chat box project and I want the input field within the message area to automatically get focused when the user clicks anywhere in the chat box. However, I don't want this functionality to interfere with text selection for c ...

How can I position text below a ticked checkbox?

Having an issue with my HTML and jQuery code. Everything is working fine, but when I click on a checkbox, the text "FINISHED" appears below all checkboxes instead of just the one I clicked on. This is my html code: $('.label__checkbox').cli ...

AngularJS- numerous unique directives featured on a single page each with its distinctive state

Regarding the query about Calling a method in a directive controller from another controller. Is there a way to have multiple separate directives of the same type on a page? Since they share a common API (singleton), the state is also shared. Therefore, i ...

What are some ways to direct users from one page to another without relying on server-side programming?

Is there a way to create a redirect page using jQuery or JavaScript? What is the process of writing client-side scripting code to redirect the browser from one page (page1) to another page (page n)? ...

Leveraging the power of Map and Sort to display the items containing image URLs alongside their respective timestamps

I'm diving into firebase and utilizing react, and currently I've come across this snippet of code: {photos.map(url => ( <div key={url} style={card}> <img src={url} style={image} /> <div s ...

Is there a way to stop the dropdown from automatically appearing in a DropDownList?

Seeking a solution to use a custom table as the dropdown portion for a DropDownList in my project. My goal is for users to see the custom table when they click on the DropDownList, rather than the default dropdown menu. I expected to be able to achieve th ...

Unleash the power of jQuery by incorporating the Ajax functionality with a hover option to enhance user interactivity. Utilize the .ajax

On my website, I have a calendar displayed with dates like "11/29/2014" stored in an attribute called "data-date". The goal is to check the server for a log file corresponding to that date and change the CSS of the div on mouse hover. Here is the current ...

What is the method for sending a CSV file as Form Data through a REST API?

I am currently struggling with encoding my uploaded CSV file to Form Data. My approach is to pass the actual file to be processed on the backend using the post method of my API. However, I keep encountering an error message saying "TypeError: Failed to con ...

Having trouble receiving JSON/JSONP correctly

I've been exploring the world of APIs and I'm facing a roadblock right at the beginning. My goal is to extract data from the Fever Public API in order to retrieve a list of subscribed RSS feeds. The API appears to be straightforward - check it ou ...

Building a React.js application and fetching information with Ajax

In my quest to create a high-speed React.js application that functions as a game, I find myself in need of displaying real-time data. However, the traditional method of loading this data from the server using Ajax doesn't quite align with the reactive ...

What is the best way to assign default values when destructuring interfaces within interfaces in TypeScript?

My goal here is to create a function that can be used with or without arguments. If arguments are provided, it should work with those values; if not, default values should be used. The issue I'm facing is that although there are no TypeScript errors ...

Utilizing the datepicker options function within a different function

I'm working on a function that utilizes a promise to retrieve data from an asynchronous ajax call: $("#mySelect").on('change', function() { var mySelectValue = $('#mySelect').val(); var promise = getAvailableDates(mySe ...

Breeze js requests metadata without needing to make a second call to the server

Currently, I am developing an Angular application that utilizes Breeze JS and ASP.NET OData controller. While testing, I encountered an issue where Breeze JS successfully makes the initial call to retrieve metadata from the server but fails to make the sec ...

The redirect function is failing to carry the "req" parameter

Express Routes Troubleshooting app.get('/auth/google/redirect', passport.authenticate('google'), (req, res) => { console.log('req.user:', req.user) //>>>>>Outputs {username: 'bob', id: '.. ...

Validating numbers in React JS input fields component

I need assistance with implementing number validation for 3 Textfields in my application. Currently, the code displays an error message if a Textfield is empty, but I am stuck on validating whether the input is text or numbers. import React from 'rea ...

How to effectively utilize multiple Vue instances in your project?

My inquiry is somewhat linked to a similar question on Stack Overflow, but I am uncertain about the level of discouragement towards the approach discussed in relation to Vue. In my situation, I am working on a project where the DOM is generated entirely b ...

JavaScript getting overshadowed by other JavaScript libraries

My current CMS, Liferay, heavily relies on jQuery for various functions. Recently, I introduced a new feature to our website using fancybox. However, I realized that this new addition was causing issues with other jQuery functionalities on the page. Remov ...

Trying to call an applet method using JavaScript will not be successful

When trying to invoke methods of a Java applet using JavaScript, I encounter an issue that requires the site to be added to trusted sites and security set to low in order for it to work properly. Otherwise, an error is thrown: Microsoft JScript runtime ...

What is the best way to delete comments from the config.js file?

I'm looking for a way to remove comments from my config.js file, which is acting as a JSON file in my project. The config file has both single line comments like this: //comment goes here and multi-line comments like this: /* comments goes here */ ...

Guide on generating a video thumbnail using JavaScript Application

Searching for a way to easily create a thumbnail from a video for uploading alongside the video itself to a server? I've been looking for JavaScript libraries to simplify the process without much luck. The scenario involves the user selecting a video ...