Skip to content

Commit

Permalink
Update v1.0.2
Browse files Browse the repository at this point in the history
Updated UI
Added Theme Feature 
Made changes in database schema.
Added individual encryption feature.
Added lockout policy.
Added 2FA for login.
  • Loading branch information
anyapupranav authored Sep 30, 2023
1 parent 3d8bb74 commit 63aed20
Show file tree
Hide file tree
Showing 22 changed files with 1,238 additions and 1,718 deletions.
493 changes: 240 additions & 253 deletions add_password.php

Large diffs are not rendered by default.

29 changes: 1 addition & 28 deletions change_password.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Change Password | Password Manager</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
.navbar-nav {
Expand All @@ -85,7 +84,7 @@
</style>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="index.html"><i style="font-size:24px" class="fa">&#xf023;</i> Password Manager</a>
<a class="navbar-brand" href="index.html">Password Manager</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down Expand Up @@ -147,32 +146,6 @@
</div>
</div>
</div>
<hr>

<footer>
<div class="container">
<div class="row">
<div class="col-md-6">
<p> Password Manager </p>
</div>
<div class="col-md-6">
<p>
<?php
$sqlversion = "SELECT AppVersion FROM version ORDER BY AppVersion DESC LIMIT 1";
$resultversion = $conn->query($sqlversion);

if ($resultversion->num_rows > 0) {
while ($row = $resultversion->fetch_assoc()) {
$AppVersion = $row['AppVersion'];
}
}
echo $AppVersion;
?>
</p>
</div>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
Expand Down
185 changes: 89 additions & 96 deletions database.sql
Original file line number Diff line number Diff line change
@@ -1,96 +1,89 @@
CREATE DATABASE password_manager;
USE password_manager;

CREATE TABLE `login` (
`sno` int NOT NULL AUTO_INCREMENT,
`EmailId` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ResetToken` text COLLATE utf8mb4_general_ci,
`ResetTokenExpiration` text COLLATE utf8mb4_general_ci,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

CREATE TABLE `message_templates` (
`sno` int NOT NULL AUTO_INCREMENT,
`TemplateName` varchar(100) NOT NULL,
`Subject` text NOT NULL,
`Body1` text NOT NULL,
`Body2` text,
`DeleteFlag` tinyint(1) DEFAULT '0',
`createdon` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `sno` (`sno`),
UNIQUE KEY `TemplateName` (`TemplateName`)
);

INSERT INTO `message_templates` VALUES (1,'welcome mail','Welcome to Password Manager','<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"><tr><td align=\"center\" bgcolor=\"#f0f0f0\"><img src=\"web-a.safesearch.co.in/password_manager/img/mailbanner.png\" alt=\"Your Company Logo\" width=\"600\" height=\"165\"></td></tr><tr><td bgcolor=\"#ffffff\" style=\"padding: 40px 30px 40px 30px;\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td style=\"color: #333; font-family: Arial, sans-serif; font-size: 24px;\"><b>Welcome to Password Manager </b></td></tr><tr><td style=\"padding: 20px 0 30px 0; color: #666; font-family: Arial, sans-serif; font-size: 16px; line-height: 1.6;\">Thank you for signing up for an account in our password manager web app. We\'re excited to have you as a member of our community! <br><br> Your account has been successfully created in password manager web app with the following details: <br><br> <ul><li><b>First Name:</b> ','</li></ul><p> <a href=\"web-a.safesearch.co.in/password_manager/\"> Click</a> here to login into your account.</p><br><p> If you have any questions or need assistance, please refer to our <a href=\"web-a.safesearch.co.in/password_manager/documentation\">documentation</a> or check our FAQ\'s section. </p></td></tr></table></td></tr><tr><td bgcolor=\"#f0f0f0\" style=\"padding: 20px 30px 20px 30px;\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td style=\"color: #888; font-family: Arial, sans-serif; font-size: 12px; text-align: center;\"><?php echo date(\'Y\'); ?> Password Manager V1.0</td></tr></table></td></tr></table>',0,'2023-09-14 17:38:24'),(2,'otp mail','OTP','<div style=\"margin:0;padding:10px\"><div class=\"adM\"></div><table style=\"max-width:600px;background:#fff;margin:auto\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tbody><tr> <td align=\"left\" style=\"font-family:Arial,Helvetica,sans-serif\"> <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td>&nbsp;</td> </tr><tr> <td><p style=\"font-size:16px\">Hi,<br></p><p>You are trying to reset your login password for Password Manager Website to verify this is actually you, ','</p><p>This link is valid for 1 hour, please do not share this mail with anybody.</p></td> </tr><tr><td><p style=\"font-size:12px\">This email is auto-generated so please do not reply to this email as we will be unable to respond from this email address. Please connect with us on <span> <a href=\"mailto:[email protected]\" style=\"color:#bc0069;font-size:12px;text-decoration:none\" target=\"_blank\">[email protected]</a></span> for any queries. </p></td> </tr> <tr><td> <h3 style=\"font-size:16px\">Thank You!<br>Mail Bot<br>Password Manager </h3></td> </tr> <tr><td>&nbsp;</td></tr></tbody></table></td></tr></tbody></table></div>',0,'2023-09-14 19:26:51');

CREATE TABLE `shared_accounts` (
`sno` int NOT NULL AUTO_INCREMENT,
`sharedaccountuniqueid` text,
`fromsharedemailid` text,
`tosharedemailid` text,
`deleteflag` tinyint(1) DEFAULT '0',
`sharedon` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `sno` (`sno`)
);

CREATE TABLE `users` (
`sno` int NOT NULL AUTO_INCREMENT,
`FirstName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`LastName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`EmailId` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`MobileNumber` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

CREATE TABLE `vault` (
`sno` int NOT NULL AUTO_INCREMENT,
`UniqueId` char(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`GroupName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`AppName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`UserName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`CurrentPasswordVersion` int NOT NULL DEFAULT '1',
`Url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`Notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`UserEmailId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vault_BEFORE_INSERT` BEFORE INSERT ON `vault` FOR EACH ROW SET NEW.UniqueId = UUID() */;;
DELIMITER ;

CREATE TABLE `vault_history` (
`sno` int NOT NULL AUTO_INCREMENT,
`UniqueId` char(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`PasswordVersion` int NOT NULL,
`datecreated` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`GroupName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`AppName` text COLLATE utf8mb4_general_ci,
`UserName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`Url` text COLLATE utf8mb4_general_ci,
`Notes` text COLLATE utf8mb4_general_ci,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

CREATE TABLE `version` (
`Sno` int NOT NULL AUTO_INCREMENT,
`AppVersion` varchar(10) NOT NULL,
`DeleteFlag` tinyint(1) DEFAULT '0',
`CreatedOn` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `Sno` (`Sno`),
UNIQUE KEY `Version` (`AppVersion`)
);

INSERT INTO `version` VALUES (1,'v1.0.0',0,'2023-09-14 07:01:09'),(2,'v1.0.1',0,'2023-09-19 16:56:54');

create database password_manager;
use password_manager;

CREATE TABLE `login` (
`sno` int NOT NULL AUTO_INCREMENT,
`EmailId` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ResetToken` text COLLATE utf8mb4_general_ci,
`ResetTokenExpiration` text COLLATE utf8mb4_general_ci,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

CREATE TABLE `message_templates` (
`sno` int NOT NULL AUTO_INCREMENT,
`TemplateName` varchar(100) NOT NULL,
`Subject` text NOT NULL,
`Body1` text NOT NULL,
`Body2` text,
`DeleteFlag` tinyint(1) DEFAULT '0',
`createdon` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `sno` (`sno`),
UNIQUE KEY `TemplateName` (`TemplateName`)
);

CREATE TABLE `shared_accounts` (
`sno` int NOT NULL AUTO_INCREMENT,
`sharedaccountuniqueid` text,
`fromsharedemailid` text,
`tosharedemailid` text,
`deleteflag` tinyint(1) DEFAULT '0',
`sharedon` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `sno` (`sno`)
);

CREATE TABLE `users` (
`sno` int NOT NULL AUTO_INCREMENT,
`FirstName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`LastName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`EmailId` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`MobileNumber` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);

CREATE TABLE `vault` (
`sno` int NOT NULL AUTO_INCREMENT,
`UniqueId` char(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`GroupName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`AppName` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`UserName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`CurrentPasswordVersion` int NOT NULL DEFAULT '1',
`Url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`Notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
`ActiveFlag` tinyint(1) DEFAULT '1',
`DeleteFlag` tinyint(1) DEFAULT '0',
`UserEmailId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
UNIQUE KEY `sno_UNIQUE` (`sno`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vault_BEFORE_INSERT` BEFORE INSERT ON `vault` FOR EACH ROW SET NEW.UniqueId = UUID() */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;

CREATE TABLE `vault_history` (
`sno` int NOT NULL AUTO_INCREMENT,
`UniqueId` char(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`Password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`PasswordVersion` int NOT NULL,
`datecreated` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY `sno_UNIQUE` (`sno`)
);
67 changes: 33 additions & 34 deletions delete_password.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
<?php
// Database connection
include 'sql_conn.php';

// Check if the ID is provided in the query parameter
if (isset($_GET['id'])) {
$UniqueId = $_GET['id'];

$loggedinusermailid = $_SESSION['passed_user_email'];

// Perform the deletion
$sql = "update vault set deleteflag = 1 where UniqueId = '$UniqueId' and UserEmailId = '$loggedinusermailid' ";

if ($conn->query($sql) === TRUE) {
// Deletion successful
echo '<script type="text/javascript">';
echo 'alert("Account has been deleted successfully.");';
echo 'window.location.href = "home.php";';
echo '</script>';
} else {
// Error during deletion
echo '<script type="text/javascript">';
echo 'alert("An error occured while deleting Account.");';
echo 'window.location.href = "home.php";';
echo '</script>';
}
} else {
echo include 'error/400.html';
exit;
}

// Close the database connection
$conn->close();
?>
<?php
// Database connection
include 'sql_conn.php';

// Check if the ID is provided in the query parameter
if (isset($_GET['id'])) {
$UniqueId = $_GET['id'];

$loggedinusermailid = $_SESSION['passed_user_email'];

// Perform the deletion
$sql = "update vault set deleteflag = 1 where UniqueId = '$UniqueId' and UserEmailId = '$loggedinusermailid' ";

if ($conn->query($sql) === TRUE) {
// Deletion successful
echo '<script type="text/javascript">';
echo 'alert("Account has been deleted successfully.");';
echo 'window.location.href = "home.php";';
echo '</script>';
} else {
// Error during deletion
echo '<script type="text/javascript">';
echo 'alert("An error occured while deleting Account.");';
echo 'window.location.href = "home.php";';
echo '</script>';
}
} else {
echo "Invalid request. No ID provided.";
}

// Close the database connection
$conn->close();
?>
3 changes: 1 addition & 2 deletions delete_share.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
echo '</script>';
}
} else {
echo include 'error/400.html';
exit;
echo "Invalid request. No ID provided.";
}

// Close the database connection
Expand Down
Loading

0 comments on commit 63aed20

Please sign in to comment.