Esempio n. 1
0
def generatePassword(clientId):
    client = Client.query.get_or_404(clientId)
    password = uuid4().hex[:6]
    client.setPasswordHash(Client.generateHash(password))
    db.session.commit()
    sendEmail.delay(
        client.email, "Востановление пароля от личного кабинета",
        recoveryPhrase.format(client.number[:-2], client.number[-2:], password,
                              current_app.config["SITE_URL"]))
    return render_template("fond/successGeneratePassword.tpl", client=client)
Esempio n. 2
0
def processEmailPage():
    message = request.form.get("message", None)
    if message:
        clients = Client.query.filter(Client.email != "").all()
        for client in clients:
            msg = messageTemplate.format(fio=client.fio,
                                         number=client.number,
                                         site=current_app.config["SITE_URL"],
                                         message=message)
            sendEmail.delay(client.email,
                            "Информационное сообщение от УЖК Наш дом", msg)
    return render_template("email_success.tpl")
Esempio n. 3
0
def recoveryPassword():
    login = request.form.get("login", "").strip().replace("-", "")
    client = Client.query.filter_by(number=login).one_or_none()
    if client:
        if len(client.email) > 0:
            password = uuid4().hex[:6]
            client.setPasswordHash(Client.generateHash(password))
            db.session.commit()
            sendEmail.delay(
                client.email, "Восcтановление пароля от личного кабинета",
                recoveryPhrase.format(client.number[:-2], client.number[-2:],
                                      password,
                                      current_app.config["SITE_URL"]))
            return render_template("recovery/successRecoveryPassword.tpl")
        else:
            return render_template(
                "recovery/notFoundEmailRecoveryPassword.tpl")
    else:
        return render_template("recovery/notFoundClientRecoveryPassword.tpl")
Esempio n. 4
0
def get_mail():
    from app.tasks import sendEmail
    job = sendEmail.delay("test")
    return jsonify({"task": job.id})
Esempio n. 5
0
def get_mail():
    job = sendEmail.delay("test")
    return jsonify({"task": job.id})