2015-12-19 13:56:40 +03:00
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
import uuid
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import timedelta
|
|
|
|
from flask import g
|
|
|
|
from flask import render_template
|
|
|
|
from flask import session
|
|
|
|
from flask import redirect
|
|
|
|
from flask import url_for
|
|
|
|
from flask import request
|
|
|
|
from flask import Blueprint
|
|
|
|
from flask import jsonify
|
|
|
|
from app import models
|
|
|
|
from app.cloud.controllers.common import ControllerCommon
|
|
|
|
from app.cloud.controllers.common import ControllerMessagesEmail
|
|
|
|
from app.cloud.controllers.users import ControllerUsers
|
|
|
|
from app.cloud.controllers.users import ControllerSSHKey
|
|
|
|
from app.cloud.controllers.billing import ControllerBilling
|
|
|
|
from app.cloud.controllers.datacenters import ControllerDataCenters
|
|
|
|
from app.cloud.controllers.containers import ControllerContainers
|
|
|
|
from app.cloud.controllers.containers import ControllerContainersStatisticsState
|
|
|
|
from app.cloud.controllers.tasks import ControllerTasks
|
|
|
|
|
|
|
|
viewSupport = Blueprint('support', __name__, url_prefix='/support')
|
|
|
|
|
|
|
|
|
|
|
|
@viewSupport.route('/', methods=['GET', 'POST'])
|
|
|
|
def index():
|
|
|
|
# ControllerMessagesEmail().send()
|
|
|
|
# print session
|
|
|
|
|
|
|
|
if request.method == "POST":
|
|
|
|
print request.form
|
|
|
|
# TODO: validate
|
|
|
|
ticket_title = request.form['title']
|
|
|
|
ticket_message = request.form['message']
|
|
|
|
ticket_email = request.form['email']
|
|
|
|
|
|
|
|
# send mail message with recovery code
|
|
|
|
subject = ticket_title
|
|
|
|
message = ticket_message
|
2015-12-19 14:11:16 +03:00
|
|
|
lead = u'Отправитель: %s' % ticket_email
|
2015-12-19 13:56:40 +03:00
|
|
|
callout = u''
|
|
|
|
|
|
|
|
email = ControllerMessagesEmail()
|
2015-12-19 14:11:16 +03:00
|
|
|
# email.send(title=subject, to=ticket_email, lead=lead, message=message, callout=callout)
|
2015-12-19 13:56:40 +03:00
|
|
|
email.send(title=subject, to=g.settings['contacts.email'], lead=lead, message=message, callout=callout)
|
|
|
|
|
|
|
|
return redirect(url_for('support.thank'))
|
|
|
|
return render_template('default/support/index.html')
|
|
|
|
|
|
|
|
|
|
|
|
@viewSupport.route('/thank')
|
|
|
|
def thank():
|
|
|
|
return render_template('default/support/thank.html')
|