some more things

This commit is contained in:
Evert Prants 2017-11-30 23:45:21 +02:00
parent f76135f00f
commit 34a81d7923
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
4 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import config from '../../scripts/load-config' import config from '../../scripts/load-config'
import http from '../../scripts/http' import http from '../../scripts/http'
import models from './models' import models from './models'
import image from './image' import Image from './image'
import UAPI from './index' import UAPI from './index'
import qs from 'querystring' import qs from 'querystring'
import oauth from 'oauth-libre' import oauth from 'oauth-libre'
@ -173,7 +173,7 @@ const API = {
if (rawData.picture) { if (rawData.picture) {
if (rawData.picture.is_silhouette === false && rawData.picture.url) { if (rawData.picture.is_silhouette === false && rawData.picture.url) {
let imgdata = await image.downloadImage(rawData.picture.url) let imgdata = await Image.downloadImage(rawData.picture.url)
if (imgdata && imgdata.fileName) { if (imgdata && imgdata.fileName) {
profilepic = imgdata.fileName profilepic = imgdata.fileName
} }
@ -224,7 +224,7 @@ const API = {
let profilepic = null let profilepic = null
if (rawData.profile_image_url_https) { if (rawData.profile_image_url_https) {
let imgdata = await image.downloadImage(rawData.profile_image_url_https) let imgdata = await Image.downloadImage(rawData.profile_image_url_https)
if (imgdata && imgdata.fileName) { if (imgdata && imgdata.fileName) {
profilepic = imgdata.fileName profilepic = imgdata.fileName
} }
@ -303,7 +303,7 @@ const API = {
getAvatar: async (rawData) => { getAvatar: async (rawData) => {
let profilepic = null let profilepic = null
if (rawData.image) { if (rawData.image) {
let imgdata = await image.downloadImage(rawData.image) let imgdata = await Image.downloadImage(rawData.image)
if (imgdata && imgdata.fileName) { if (imgdata && imgdata.fileName) {
profilepic = imgdata.fileName profilepic = imgdata.fileName
} }
@ -345,7 +345,7 @@ const API = {
let aviSnowflake = rawData.avatar let aviSnowflake = rawData.avatar
if (aviSnowflake) { if (aviSnowflake) {
try { try {
let avpt = await image.downloadImage('https://cdn.discordapp.com/avatars/' + rawData.id + '/' + aviSnowflake + '.png') let avpt = await Image.downloadImage('https://cdn.discordapp.com/avatars/' + rawData.id + '/' + aviSnowflake + '.png')
if (avpt && avpt.fileName) { if (avpt && avpt.fileName) {
profilepic = avpt.fileName profilepic = avpt.fileName
} }

View File

@ -210,7 +210,7 @@ const API = {
let file = path.join(uploadsDir, user.avatar_file) let file = path.join(uploadsDir, user.avatar_file)
if (await fs.exists(file)) { if (await fs.exists(file)) {
await fs.unlinkAsync(file) await fs.unlink(file)
} }
return API.User.update(user, {avatar_file: null}) return API.User.update(user, {avatar_file: null})

View File

@ -452,6 +452,8 @@ router.post('/reset/:token', csrfValidation, wrap(async (req, res) => {
try { try {
await API.User.Reset.changePassword(user, password, token) await API.User.Reset.changePassword(user, password, token)
console.warn('[SECURITY AUDIT] User \'%s\' password has been changed from %s', user.username, req.realIP)
req.flash('message', {error: false, text: 'Your password has been changed successfully. You may now log in!'}) req.flash('message', {error: false, text: 'Your password has been changed successfully. You may now log in!'})
res.redirect('/login') res.redirect('/login')
} catch (e) { } catch (e) {

View File

@ -2,5 +2,5 @@ h1 Hello, #{display_name}!
p You've requested to reset your password on Icy Network. p You've requested to reset your password on Icy Network.
p Click on or copy the following link into your URL bar in order to reset your Icy Network account password: p Click on or copy the following link into your URL bar in order to reset your Icy Network account password:
a.activate(href=domain + "/reset/" + reset_token, target="_blank", rel="nofollow")= domain + "/reset/" + reset_token a.activate(href=domain + "/reset/" + reset_token, target="_blank", rel="nofollow")= domain + "/reset/" + reset_token
p If you did not request for a password reset on Icy Network, please ignore this email. p If you did not request a password reset on Icy Network, please ignore this email.
small This email has been sent to you because of an action performed on the IcyNet.eu website. small This email has been sent to you because of an action performed on the IcyNet.eu website.