Commit 74a48a78 authored by Recteur LP's avatar Recteur LP

Add Gravatar Option default to False

parent e84f99a8
Pipeline #1058 failed with stages
in 6 minutes and 48 seconds
......@@ -35,6 +35,8 @@ pyrmin:
#max_request_body_size: 104857600
#max_request_header_size: 512000
#gravatar: false
# Authentification Module
#auth_module: None
......
......@@ -40,7 +40,17 @@ class Core():
config.update(yaml.load(io.open(os.path.join(config_path, filename)), Loader=PrettySafeLoader))
no_file = False
if not no_file:
config['pyrmin'].update({"config_path": config_path})
config['pyrmin'].update({
"config_path": config_path,
"gravatar": config['pyrmin'].get(
'gravatar',
False
),
"port": config['pyrmin'].get(
'port',
8080
)
})
return config
else:
log.error("No configuration files found in " + config_path)
......@@ -57,12 +67,19 @@ class Core():
"pyrmin": {
"root_url": self.config['pyrmin']['root_url'],
"password": self.config['pyrmin']['password'],
"port": self.config['pyrmin']['port'],
"port": self.config['pyrmin'].get(
'port',
8080
),
"config_path": self.config['pyrmin']['config_path'],
"plugins_path": self.config['pyrmin'].get(
'plugins_path',
'/usr/share/pyrmin/plugins'
),
"gravatar": self.config['pyrmin'].get(
'gravatar',
False
),
"debug": self.config['pyrmin']['debug']
}
}
......
......@@ -12,7 +12,6 @@ import six
from six.moves.urllib.parse import urlencode
from ._log import log
# from .plugins import Plugins
from ._core import Core
from .plugins import Plugins
......@@ -177,9 +176,12 @@ class LogIn(object):
def gravatar_url(self, mail):
""" Return Gravatar url for mail
"""
gravatar_url = __gravatar_url__ + hashlib.md5(mail.encode("utf-8")).hexdigest() + "?"
gravatar_url += urlencode({'d': "identicon", 's': str(50)})
return gravatar_url
if 'pyrmin' in self.config and self.config['pyrmin']['gravatar']:
gravatar_url = __gravatar_url__ + hashlib.md5(mail.encode("utf-8")).hexdigest() + "?"
gravatar_url += urlencode({'d': "identicon", 's': str(50)})
return gravatar_url
else:
return "/img/default-user.png"
def redirect(self):
""" Redirect to Referer if exist otherwise index page
......
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);
/*!
* AdminLTE v2.3.6
* Author: Almsaeed Studio
......
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);/*!
/*!
* AdminLTE v2.3.6
* Author: Almsaeed Studio
* Website: Almsaeed Studio <http://almsaeedstudio.com>
......
This diff is collapsed.
This diff is collapsed.
......@@ -46,7 +46,7 @@ class User():
if 'pyrmin' in self.config:
self.img = self.config['pyrmin']['root_url'] + "/img/default-user.png"
else:
self.img = "https://pyrmin.io/img/default-user.png"
self.img = "/img/default-user.png"
def __set_cli_user(self):
if not hasattr(cherrypy, 'session'):
......@@ -121,7 +121,7 @@ class User():
"auth": False,
"admin": self.admin,
"displayname": user_id,
"img": self.gravatar_url(user_id)
"img": self.img
}
def header_auth(self, realm=None):
......@@ -134,10 +134,3 @@ class User():
if ah is None:
raise cherrypy.HTTPError(400, 'Bad Request')
return LogIn(self.config).login(ah["username"], ah['password'].encode('utf-8'))
def gravatar_url(self, mail):
""" Return Gravatar url for mail
"""
gravatar_url = __gravatar_url__ + hashlib.md5(mail.encode("utf-8")).hexdigest() + "?"
gravatar_url += urlencode({'d': "identicon", 's': str(50)})
return gravatar_url
......@@ -61,13 +61,6 @@ pyrmin.prototype.version = function(version) {
$('#checkversion').html('<i class="fa fa-exclamation-triangle text-danger" data-toggle="tooltip" title="Latest version available is: ' + data.latest + '"></i>');
}
},
error: function(data, status) {
console.log(data);
console.log(status);
}
});
}
......@@ -515,8 +508,8 @@ function global_search_callback(data, status) {
$(document).ready(function() {
$("#loading_fade").removeClass('modal-backdrop fade in');
pyrmin().version(pyrmin().version());
$('[data-toggle="tooltip"]').tooltip();
pyrmin().version(pyrmin().version());
$("#searchform").submit(function(e){
e.preventDefault();
plugins = $("#searchform_plugins").val().split(',');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment