summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/style.css7
-rw-r--r--server.js17
-rw-r--r--views/profile.pug18
-rw-r--r--views/user.pug14
-rw-r--r--views/user_list.pug5
5 files changed, 22 insertions, 39 deletions
diff --git a/public/style.css b/public/style.css
index 330e8f4..6298195 100644
--- a/public/style.css
+++ b/public/style.css
@@ -35,13 +35,6 @@ header nav a:hover { color: blue; }
article { margin: 2em; }
article p, article dl, article ul { max-width: 50rem; }
-img.avatar {
- float: left; margin: 0 20px 5px 0;
- box-shadow: 1px 2px 4px rgba(0,0,0,0.3);
- width: 80px;
- height: 80px;
-}
-
div.logo {
float: left;
margin: 0 20px 5px 0;
diff --git a/server.js b/server.js
index d95b33c..48310d8 100644
--- a/server.js
+++ b/server.js
@@ -216,13 +216,6 @@ function hash_password(password, salt) {
return hash.digest('hex')
}
-function get_avatar(mail) {
- if (!mail)
- mail = "foo@example.com"
- let digest = crypto.createHash('md5').update(mail.trim().toLowerCase()).digest('hex')
- return '//www.gravatar.com/avatar/' + digest + '?d=mp'
-}
-
/*
* USER AUTHENTICATION
*/
@@ -377,7 +370,7 @@ app.get('/about', function (req, res) {
res.render('about.pug', { user: req.user })
})
-app.get('/logout', function (req, res) {
+app.post('/logout', function (req, res) {
let sid = login_cookie(req)
if (sid)
login_delete(res, sid)
@@ -590,7 +583,6 @@ app.post('/change-about', must_be_logged_in, function (req, res) {
app.get('/user/:who_name', function (req, res) {
let who = SQL_SELECT_USER_PROFILE.get(req.params.who_name)
if (who) {
- who.avatar = get_avatar(who.mail)
who.ctime = human_date(who.ctime)
who.atime = human_date(who.atime)
let games = QUERY_LIST_ACTIVE_GAMES_OF_USER.all({ user_id: who.user_id })
@@ -604,7 +596,6 @@ app.get('/user/:who_name', function (req, res) {
app.get('/users', function (req, res) {
let rows = SQL("SELECT * FROM user_profile_view ORDER BY atime DESC").all()
rows.forEach(row => {
- row.avatar = get_avatar(row.mail)
row.ctime = human_date(row.ctime)
row.atime = human_date(row.atime)
})
@@ -1123,11 +1114,7 @@ function annotate_games(games, user_id) {
app.get('/profile', must_be_logged_in, function (req, res) {
req.user.notify = SQL_SELECT_USER_NOTIFY.get(req.user.user_id)
- let avatar = get_avatar(req.user.mail)
- res.render('profile.pug', {
- user: req.user,
- avatar: avatar,
- })
+ res.render('profile.pug', { user: req.user })
})
app.get('/games', function (req, res) {
diff --git a/views/profile.pug b/views/profile.pug
index ca6295c..52bb0c0 100644
--- a/views/profile.pug
+++ b/views/profile.pug
@@ -8,22 +8,26 @@ html
include header
article
h1= SITE_NAME
- a(href="https://gravatar.com/"): img.avatar(src=avatar)
p Welcome, #{user.name}!
p Your mail address is #{user.mail}
- br(clear="left")
if user.notify
p <a href="/unsubscribe">Disable mail notifications</a>
else
p <a href="/subscribe">Enable mail notifications</a>
- p <a href="/change-password">Change password</a>
- p <a href="/change-mail">Change mail address</a>
- p <a href="/change-name">Change user name</a>
- p <a href="/change-about">Change profile text</a>
+ p
+ | <a href="/change-password">Change password</a>
+ br
+ | <a href="/change-mail">Change mail address</a>
+ br
+ | <a href="/change-name">Change user name</a>
+ br
+ | <a href="/change-about">Change profile text</a>
p <a href="/chat">Chat log</a>
- p <a href="/logout">Logout</a>
+ p
+ form(action="/logout" method="post")
+ button(type="submit") Logout
diff --git a/views/user.pug b/views/user.pug
index c28fbd0..4c26716 100644
--- a/views/user.pug
+++ b/views/user.pug
@@ -7,17 +7,21 @@ html
head
include head
title= who.name
+ style.
+ .about {
+ white-space: pre-wrap;
+ font-style: italic;
+ padding: 8px 12px;
+ border-left: 4px solid silver;
+ background-color: whitesmoke;
+ }
body
include header
article
h1= who.name
- img.avatar(src=who.avatar width=80 height=80)
-
if who.about
- p(style="white-space:pre-wrap;font-style:italic")= who.about
- else
- br(clear="left")
+ p.about= who.about
p Member since #{who.ctime}.
p Last seen #{who.atime}.
diff --git a/views/user_list.pug b/views/user_list.pug
index 26c3f82..703ee4d 100644
--- a/views/user_list.pug
+++ b/views/user_list.pug
@@ -4,9 +4,6 @@ html
head
include head
title User List
- style.
- td.avatar { padding: 0; width: 80px; }
- td.avatar img { display: block; width: 80px; height: 80px; }
body
include header
article
@@ -15,14 +12,12 @@ html
table
thead
tr
- th Avatar
th Name
th Member since
th Last seen
tbody
each row in user_list
tr
- td.avatar: img(src=row.avatar)
td.name: a(href="/user/"+row.name)= row.name
td= row.ctime
td= row.atime