#library #tool #utility

bin+lib login_app

A generic login module for web apps

5 releases

0.1.4 Jul 8, 2020
0.1.3 Jan 13, 2020
0.1.2 Jan 3, 2020
0.1.1 Jan 3, 2020
0.1.0 Jan 3, 2020

#330 in HTTP server

21 downloads per month

MIT license

2.5K SLoC

Login Module / Template

A login module, intended to use as a template, for web applications, that requires user to sign in/sign up. SQLite database is used to store registration data. Cookie is used for Session management. MSMTP, a SMTP Client, is used to send emails.


Developing with the following goals in mind:

  1. Learn Rust language
  2. Re-usable code for Login
  3. Codes to cover login related features, forms, or screens, such as:
    a. Registration form
    b. Send a time bound Token, to registered email, to confirm registration
    c. Registration-confirmation screen to enter token value
    d. Login form
    e. Forgot password form
    f. Send a time bound token, to registered email, to confirm forgot password request
    g. Password reset form
    h. A home page (index page), that shows: Login, Logout, or Cancellation


  1. Rust installation
  2. MSMTP client installation (a quick setup guide can be found in msmtp.md file)

How to use it

  1. Clone or download this app
  2. Edit Settings.toml file to update names of database folder, log folder, email server details, ip address, etc.
  3. Build an executable file using: $Cargo build --release.
  4. Copy the following files/folder into a separate folder say "~/projects":
    a. target/release/login-app file
    b. template folder
    c. two toml files: Settings.toml and Messages.toml.
  5. Edit login_app.service for folder names and follow instructions in it to run this app as a service in linux.
  6. Assuming entries in Settings.toml file for ip-address and port as and 6000, open the web browser and enter url as
  7. Browser then shows a home page with Login | Registration links in it...
  8. Click on Registration link to go to Registration page.
  9. Registration page shows fields such as email, password, and repeat-password. Fill them and submit; on submitting them, a confirmation page opens up.
  10. Get a copy of token sent to email OR in case of development environment, goto DB Browser for SQLite (assuming it is already installed in linux machine)...open the database file, which is most likely named as login_app.db under /login_app/database folder, open app_user table and locate an entry in it, copy data under token field in it. Paste this data into confirmation page.
  11. There is a time limit to enter the token, say 60 seconds, which is customizable in Settings.toml file.
  12. On expiry of the time limit, the registration data is deleted from the database.
  13. On successfully entering the token value, the registration is confirmed.
  14. Go to Login page and try to login with the credentials.
  15. On successful login, an index page is shown, with user email id , logout and Cancellation links
  16. In case of error in login credentials, it remains in login screen, displaying Invalid credentials!
  17. In case of forgotten password, go to Login page, click link on Forgot Password?.
  18. Enter email-id in the forgot-password form.
  19. On submitting this request, an email is sent with a token. Copy it into next screen that looks for it to confirm the request.
  20. On confirming the request with token, a Reset-Password form appears. Enter new password and submit. Now try to login with new password.


A demo application can be found at the following link:
LoginApp Demo


In case of running multiple web applications on different ports, a traffic router can be used. Please refer https://github.com/mohankumaranna/traffic_router




~733K SLoC