Merge pull request #231 from PedroLiu/master

Fix a bug that only root's info can be modified in /user/list
This commit is contained in:
PedroLiu 2017-05-09 01:20:13 +08:00 committed by GitHub
commit 1e2a7528d6
5 changed files with 16 additions and 27 deletions

View File

@ -130,17 +130,6 @@
# default: authenticate local and PAM users
# EXTERNAL_LOGIN=False
# EMAIL_FROM_ADDRESS : the e-mail address to send activating e-mail to user
# If this address is "", no email will be sent out.
# default: ""
# EMAIL_FROM_ADDRESS=""
# ADMIN_EMAIL_ADDRESS : when an activating request is sent, an e-mail will
# be sent to this address to remind the admin.
# If this address i "", no email will be sent to admin.
# default: ""
# ADMIN_EMAIL_ADDRESS=""
# DATA_QUOTA : whether enable the quota of data volume or not
# True or False, default: False
# DATA_QUOTA=False

View File

@ -18,12 +18,12 @@ import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
from settings import settings
email_from_address = env.getenv('EMAIL_FROM_ADDRESS')
# send email to remind users of their beans
def send_beans_email(to_address, username, beans):
global email_from_address
email_from_address = settings.get('EMAIL_FROM_ADDRESS')
if (email_from_address in ['\'\'', '\"\"', '']):
return
#text = 'Dear '+ username + ':\n' + ' Your beans in docklet are less than' + beans + '.'

View File

@ -50,10 +50,6 @@ def getenv(key):
return os.environ.get("STORAGE", "file")
elif key =="EXTERNAL_LOGIN":
return os.environ.get("EXTERNAL_LOGIN", "False")
elif key =="EMAIL_FROM_ADDRESS":
return os.environ.get("EMAIL_FROM_ADDRESS", "")
elif key =="ADMIN_EMAIL_ADDRESS":
return os.environ.get("ADMIN_EMAIL_ADDRESS", "")
elif key =="DATA_QUOTA":
return os.environ.get("DATA_QUOTA", "False")
elif key =="DATA_QUOTA_CMD":

View File

@ -9,6 +9,7 @@ from email.mime.multipart import MIMEMultipart
from email.header import Header
from datetime import datetime
import env
from settings import settings
class NotificationMgr:
def __init__(self):
@ -36,7 +37,7 @@ class NotificationMgr:
return [Notification.query.filter_by(id=notify_id).first() for notify_id in notify_ids]
def mail_notification(self, notify_id):
email_from_address = env.getenv('EMAIL_FROM_ADDRESS')
email_from_address = settings.get('EMAIL_FROM_ADDRESS')
if (email_from_address in ['\'\'', '\"\"', '']):
return {'success' : 'true'}
notify = Notification.query.filter_by(id=notify_id).first()

View File

@ -218,6 +218,9 @@ def query_user(cur_user, user, form):
global G_usermgr
logger.info("handle request: user/query/")
#result = G_usermgr.query(ID = form.get("ID"), cur_user = cur_user)
if (form.get("ID", None) != None):
result = G_usermgr.query(ID = form.get("ID"), cur_user = cur_user)
else:
result = G_usermgr.query(username = user, cur_user = cur_user)
if (result.get('success', None) == None or result.get('success', None) == "false"):
return json.dumps(result)