Login Form

Login Form template for .NET Framework

The Login Form allows users to login to the application using a username and password. The form allows you to easily and quickly authorize both using a local account and using Google, Facebook or Twitter.

Description

Login Form

The login form is an authorization template that allows users to log in to the system. The template consists of a main form and a subform. The form allows you to register a new user, as well as reset the password of an existing user. Also, for security, the function of two-factor authentication is used.

The form can be easily embedded into any project that needs a user login form. The form allows you to use any user data storage system.

System specifications

Login Form includes:

  • Authorization Form
  • Registration Form
  • Reset Password Form
  • Two-Factor Authentication Form

Password Encryption

The following function is used to encrypt the password:

public static string encryptPassword(string password)
        {
            MD5CryptoServiceProvider md5Hash = new MD5CryptoServiceProvider();

            byte[] encrypt;

            UTF8Encoding encode = new UTF8Encoding();
            encrypt = md5Hash.ComputeHash(encode.GetBytes(password));

            StringBuilder encryptdata = new StringBuilder();
             
            for (int i = 0; i < encrypt.Length; i++)
            {
                encryptdata.Append(encrypt[i].ToString());
            }

            GlobalVariables.password = encryptdata.ToString();
            return encryptdata.ToString();
        }

Random Password

The following function is used to generate a random password:

public static string randomPassword(int length)
        {
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#/.!')";
            var stringChars = new char[length];
            var random = new Random();

            for (int i = 0; i < stringChars.Length; i++)
            {
                stringChars[i] = chars[random.Next(chars.Length)];
            }

            var finalString = new String(stringChars);
            return finalString;
        }

Global Variables

In the login form, the Global Variables class is used to store user data. Here you can store both authorization data and data of newly registered users.

public static class GlobalVariables
    {
        //Login Form
        public static string userName { get; set; }
        public static string password { get; set; }


        //Account Registration Form
        public static string firstName { get; set; }
        public static string lastName { get; set; }
        public static string birthDate { get; set; }
        public static string country { get; set; }
        public static string telephone { get; set; }
        public static string email { get; set; }
        public static string newUserName { get; set; }
        public static string newPassword { get; set; }


        //Recover Password
        public static string recover_UserName { get; set; }
        public static string recover_Password { get; set; }
        public static string recover_Email { get; set; }
        public static string recover_AdditionalInfo { get; set; }
    }

Conclusion

The login form template is suitable for small projects that need a quick and easy user login system. The form provides a simple template that is easily scalable and allows you to build in all the features you need.

More about the application
Login Form v0.1.0.zip 423kb

About the Author

I have experience in developing and creating control and automation systems, security systems, internal corporate systems, creating and managing databases, designing IoT and creating programs for managing and monitoring processes.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.