aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-06-24 20:26:06 +0530
committerBobby <[email protected]>2022-06-24 20:26:06 +0530
commit00e99b844c260e0263e5d5403d284ba07450005e (patch)
treeeb314f5abc71b13d61599d3cfac2fd788cdd8c74
parent2e0b8a471289f2e04286494a0a6333976b95e01a (diff)
downloadthatcomputerscientist-00e99b844c260e0263e5d5403d284ba07450005e.tar.xz
thatcomputerscientist-00e99b844c260e0263e5d5403d284ba07450005e.zip
updates to the account page
-rw-r--r--public/css/main.css1
-rw-r--r--routes/account.routes.js6
-rw-r--r--views/account.ejs23
-rw-r--r--views/partials/header.ejs2
4 files changed, 23 insertions, 9 deletions
diff --git a/public/css/main.css b/public/css/main.css
index 42d15011..e83a2709 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -57,6 +57,7 @@ lebel, input, textarea, select {
display: block;
margin: 5px 0px;
font-family: 'TimesPixelated';
+ font-size: 16px;
}
input[type = 'submit'] {
diff --git a/routes/account.routes.js b/routes/account.routes.js
index 8a6a0b21..f2f72e29 100644
--- a/routes/account.routes.js
+++ b/routes/account.routes.js
@@ -42,10 +42,10 @@ router.post('/updateAccount', (req, res) => {
const username = decoded.username;
const firstname = req.body.firstname;
const lastname = req.body.lastname;
- const email = req.body.email;
const location = req.body.location;
const bio = req.body.bio;
const public = req.body.isPublic;
+ const emailPublic = req.body.emailPublic;
const connection = mysql.createPool(connectionString);
connection.getConnection((err, connection) => {
if (err) {
@@ -53,8 +53,8 @@ router.post('/updateAccount', (req, res) => {
error: err.message
});
} else {
- const sql = "UPDATE Profiles SET firstname = ?, lastname = ?, email = ?, location = ?, bio = ?, public = ? WHERE username = ?";
- connection.query(sql, [firstname, lastname, email, location, bio, public, username], (err, results, fields) => {
+ const sql = "UPDATE Profiles SET firstname = ?, lastname = ?, location = ?, bio = ?, public = ?, emailPublic = ? WHERE username = ?";
+ connection.query(sql, [firstname, lastname, location, bio, public, emailPublic, username], (err, results, fields) => {
if (err) {
req.flash('updateaccerror', err.message);
res.redirect(req.get('referer'));
diff --git a/views/account.ejs b/views/account.ejs
index d1b805b0..6649eac4 100644
--- a/views/account.ejs
+++ b/views/account.ejs
@@ -11,6 +11,9 @@
<li>Please note that this is a support request related to your account. Please do not file any bugs here. If you have noticed a bug, please report it to the <a href="https://github.com/luciferreeves/thatcomputerscientist/issues">GitHub Issues</a> page.</li>
</ul>
<p>Your avatar is fetched from gravatar. Update your gravatar email to fetch the avatar. If you don't have an account, you can sign up for one <a href="https://en.gravatar.com/" target="_blank">here</a>.</p>
+ <% if (user.public == 1) { %>
+ <p>Your account is publicly accessible at: <a href="/profile/<%= user.username %>"><span id="accountURL"></span></a>.</p>
+ <% } %>
<div class="account">
<div class="ac-sidebar">
<fieldset>
@@ -41,9 +44,6 @@
</form>
</div>
<div class="ac-main">
- <% if (user.public == 1) { %>
- <p>Account URL: <a href="/profile/<%= user.username %>"><span id="accountURL"></span></a></p>
- <% } %>
<form method="post" action="/account/updateAccount">
<fieldset>
<legend>Account Details</legend>
@@ -51,8 +51,6 @@
<input type="text" name="firstname" id="firstname" value="<%= user.firstname %>" placeholder="First Name" />
<label for="lastname">Last Name</label>
<input type="text" name="lastname" id="lastname" value="<%= user.lastname %>" placeholder="Last Name" />
- <label for="email">Email</label>
- <input type="email" name="email" id="email" value="<%= user.email %>" placeholder="Email" />
<label for="location">Location</label>
<input type="text" name="location" id="location" value="<%= user.location %>" placeholder="Location" />
<label for="bio">Bio</label>
@@ -62,6 +60,13 @@
<option value="0" <% if (user.public == 0) { %>selected="selected"<% } %>>Private</option>
<option value="1" <% if (user.public == 1) { %>selected="selected"<% } %>>Public</option>
</select>
+ <% if (user.public == 1) { %>
+ <label for="emailPublic">Email Visibility</label>
+ <select name="emailPublic" id="emailPublic">
+ <option value="0" <% if (user.emailPublic == 0) { %>selected="selected"<% } %>>Private</option>
+ <option value="1" <% if (user.emailPublic == 1) { %>selected="selected"<% } %>>Public</option>
+ </select>
+ <% } %>
<input type="submit" value="Update Account" />
<% if (locals.messages.updateaccsuccess) { %>
<p class="success"><%= messages.updateaccsuccess %></p>
@@ -71,6 +76,14 @@
<% } %>
</fieldset>
</form>
+ <form method="post" action="">
+ <fieldset>
+ <legend>Change Email</legend>
+ <label for="email">Your current registered email is <em><u><%= user.email %></u></em>. Please note that a verification email will be sent to the new email address in order to update the current email address. Please provide the new email address in the box below:</label>
+ <input type="email" name="email" id="email" placeholder="New Email" />
+ <input type="submit" value="Change Email" />
+ </fieldset>
+ </form>
</div>
</div>
</div>
diff --git a/views/partials/header.ejs b/views/partials/header.ejs
index 74d9e117..dd0817ca 100644
--- a/views/partials/header.ejs
+++ b/views/partials/header.ejs
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Welcome to the home of That Computer Scientist. I am Kumar Priyansh. This is my personal website where I share all of my thoughts, ideas, and experiences.">
<title>That Computer Scientist - <%= title %></title>
- <link rel="stylesheet" href="css/fonts.css">
+ <!-- <link rel="stylesheet" href="css/fonts.css"> -->
<link preload rel="stylesheet" href="css/main.css">
</head>
<body> \ No newline at end of file