Ajp FM
Ajp FM
login page
1
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION
Certificate
This is to certify that Mr. Omkar Chandrakant Jamdar Roll No: 54 of 5th Semester diploma
in Computer Engineering of Institute, D.Y. Patil Polytechnic (Instt.Code: 0996) has
completed the Micro-Project in course Advance Java Programming (22517) for the academic
year 2024-2025 as prescribed in the curriculum.
2
Sr.
No Index Page no
1 Introduction 4
2 Technology used 5
4 Implementation pictures 10
5 Conclusion 11
6 Bibliography 12
8 Annexure II 15
3
***Introduction***
Functional Requirements
1. Validate user input (check for empty fields)
2. Authenticate user credentials (compare with stored data)
3. Display error messages for invalid credentials
4. Redirect to a dashboard or home page upon successful login
Non-Functional Requirements:
1. Security (encrypt passwords, use HTTPS)
2. Usability (simple and intuitive design)
3. Performance (fast login process)
4
***Technologies Used:***
Java swing
Swing is a Java Foundation Classes [JFC] library and an extension of the Abstract
Window Toolkit [AWT]. Java Swing offers much-improved functionality over AWT,
new components, expanded components features, and excellent event handling with
drag-and-drop support.
Swing has about four times the number of User Interface [UI] components as AWT
and is part of the standard Java distribution. By today’s application GUI requirements,
AWT is a limited implementation, not quite capable of providing the components
required for developing complex GUIs required in modern commercial applications.
The AWT component set has quite a few bugs and does take up a lot of system
resources when compared to equivalent Swing resources. Netscape introduced its
Internet Foundation Classes [IFC] library for use with Java. Its Classes became very
popular with programmers creating GUI’s for commercial applications.
5
***Implementation***
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.RandomAccessFile;
public class Login extends JFrame implements ActionListener {
JLabel l1, l2, l3; //label for email and password
JTextField tf1; // email field
JButton btn1; // login button
JPasswordField p1; // password field
file f = new File(“C:\\Files”); //file path
int ln;
// create folder in which record is save
void createFolder() {
if (!f.exists()) {
f.mkdirs();
}
}
//check file is exist or not
void readFile() {
try {
FileReader fr = new FileReader(f + \\logins.txt);
System.out.println(“file exists!”);
} catch (FileNotFoundException ex) {
try {
6
FileWriter fw = new FileWriter(f + \\logins.txt);
System.out.println(“File created”);
} catch (IOException ex1) {
}
}
}
// login logic
void logic(String usr, String pswd) {
try {
RandomAccessFile raf = new RandomAccessFile(f + \\logins.txt, “rw”);
for (int i = 0; i < ln; i += 7) {
System.out.println(“count “ + i);
String forUser = raf.readLine().substring(6);
String forPswd = raf.readLine().substring(9);
System.out.println(forUser + forPswd);
if (usr.equals(forUser) & pswd.equals(forPswd)) {
JOptionPane.showMessageDialog(null, “Login Successfully!!”);
break;
} else if (i == (ln – 6)) {
JOptionPane.showMessageDialog(null, “incorrect username/password”);
break;
}
for (int k = 1; k <= 5; k++) {
Raf.readLine();
}
}
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
7
//count the number of lines from file
void countLines() {
try {
ln = 0;
RandomAccessFile raf = new RandomAccessFile(f + \\logins.txt, “rw”);
for (int i = 0; raf.readLine() != null; i++) {
ln++;
}
System.out.println(“number of lines:” + ln);
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
Login() {
setTitle(“Login Form in Windows Form”);
setVisible(true);
setSize(800, 800);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
l1 = new JLabel(“Login Form in Windows Form:”);
l1.setForeground(Color.blue);
l1.setFont(new Font(“Serif”, Font.BOLD, 20));
l2 = new JLabel(“Enter Email:”);
l3 = new JLabel(“Enter Password:”);
tf1 = new JTextField();
p1 = new JPasswordField();
btn1 = new JButton(“Submit”);
l1.setBounds(100, 30, 400, 30);
l2.setBounds(80, 70, 200, 30);
l3.setBounds(80, 110, 200, 30);
8
tf1.setBounds(300, 70, 200, 30);
p1.setBounds(300, 110, 200, 30);
btn1.setBounds(150, 160, 100, 30);
add(l1);
add(l2);
add(tf1);
add(l3);
add(p1);
add(btn1);
btn1.addActionListener(this);
} public void actionPerformed(ActionEvent e) {
showData();
} public void showData() {
JFrame f1 = new JFrame();
JLabel l, l0;
String str1 = tf1.getText();
char[] p = p1.getPassword();
String str2 = new String(p);
atry {
createFolder();
readFile();
countLines();
logic(str1, str2);
} catch (Exception ex) {
System.out.println(ex);
}
} public static void main(String arr[]) {
new Login();
}
}
9
***Implementation pictures***
10
***Conclusion***
Developing a simple login page micro project is a great way to practice web development
skills, including HTML, CSS, JavaScript, and backend programming languages like PHP or
Python. This micro project helps you understand the basics of user authentication, validation,
and session management.
❖ Key Takeaways:
1) Understand the importance of user authentication and validation.
2) Learn HTML, CSS, and JavaScript for frontend development.
3) Familiarize yourself with backend programming languages (PHP/Python).
4) Implement database connectivity (MySQL/PostgreSQL).
5) Understand security best practices (password hashing, salting).
❖ Skills Acquired:
1) Frontend development (HTML, CSS, JavaScript)
2) Backend development (PHP/Python)
3) Database management (MySQL/PostgreSQL)
4) User authentication and validation
5) Security practices
❖ Future Enhancements:
1) Implement password recovery and reset functionality.
2) Add two-factor authentication.
3) Use more secure password hashing algorithms.
4) Integrate social media login options.
5) Develop a more robust and scalable architecture.
❖ Lessons Learned:
1) Importance of secure coding practices.
2) Balancing functionality and usability.
3) Debugging and troubleshooting techniques.
4) Collaboration and version control (Git).
5) Continuous learning and improvement.
11
***Bibliography***
❖ Books:
❖ Online Resources:
❖ Articles:
12
❖ Research Papers:
❖ Websites:
❖ Journals:
This bibliography provides a comprehensive list of resources for further learning and research
on developing a simple login page microproject.
13
***Weekly Progress Report***
10 10th Seminar
14
***ANEEXURE II***
54 Omkar Chandrakant
Jamdar
15