|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
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:
- Learn Rust language
- Re-usable code for Login
- 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
- Rust installation
- MSMTP client installation (a quick setup guide can be found in msmtp.md file)
- Clone or download this app
- Edit Settings.toml file to update names of database folder, log folder, email server details, ip address, etc.
- Build an executable file using: $Cargo build --release.
- 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.
- Edit login_app.service for folder names and follow instructions in it to run this app as a service in linux.
- Assuming entries in Settings.toml file for ip-address and port as 127.0.0.1 and 6000, open the web browser and enter url as http://127.0.0.1:6000.
- Browser then shows a home page with Login | Registration links in it...
- Click on Registration link to go to Registration page.
- Registration page shows fields such as email, password, and repeat-password. Fill them and submit; on submitting them, a confirmation page opens up.
- 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.
- There is a time limit to enter the token, say 60 seconds, which is customizable in Settings.toml file.
- On expiry of the time limit, the registration data is deleted from the database.
- On successfully entering the token value, the registration is confirmed.
- Go to Login page and try to login with the credentials.
- On successful login, an index page is shown, with user email id , logout and Cancellation links
- In case of error in login credentials, it remains in login screen, displaying Invalid credentials!
- In case of forgotten password, go to Login page, click link on Forgot Password?.
- Enter email-id in the forgot-password form.
- On submitting this request, an email is sent with a token. Copy it into next screen that looks for it to confirm the request.
- 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:
In case of running multiple web applications on different ports, a traffic router can be used. Please refer https://github.com/mohankumaranna/traffic_router