예제 #1
0
def req_send_restore():
    """Отправка сообщения для активации"""
    temp = User.find_link(request.get_json())
    data = {
        'title': 'Восстановление пароля',
        'button': 'Изменить',
        'login': temp[0],
        'link': "http://127.0.0.1:5000/restore/" + get_link(temp[1]),
        'color': col[temp[2]]
    }
    msg = Message(data['title'], recipients=[temp[1]])
    msg.html = render_template('mail.html', **data)
    thr = Thread(target=async_send_mail, args=[tm, msg])
    thr.start()
    return jsonify(temp[1])
예제 #2
0
def req_send_activation(now):
    """Отправка сообщения для активации"""
    if now.activated: return jsonify('active')
    else:
        data = {
            'title': 'Подтверждение почты',
            'button': 'Активировать',
            'login': now.log,
            'link': "http://127.0.0.1:5000/activate/" + get_link(now.email),
            'color': col[now.color]
        }
        msg = Message(data['title'], recipients=[now.email])
        msg.html = render_template('mail.html', **data)
        thr = Thread(target=async_send_mail, args=[tm, msg])
        thr.start()
        return jsonify(now.email)
예제 #3
0
 def registration(log, email, pswsalt, theme, color):
     """Регистрация"""
     _log = escepinator(log)
     psw, salt = decrypt(pswsalt)
     hashed_psw = generate_password_hash(psw + salt[:-1])
     User.__exe(
         """INSERT INTO users (login, email, password, theme, color, salt, link, hash_sum, activated)
          VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)""",
         (log, email, hashed_psw, theme, color, salt, get_link(email),
          set_sum(psw), False))
     User.__com()
     User.__scr(f"""
         CREATE TABLE IF NOT EXISTS 'month_{_log}' (digit INTEGER, month INTEGER, task TEXT);
         CREATE TABLE IF NOT EXISTS 'day_{_log}' (hour INTEGER, minute INTEGER, task TEXT);
         CREATE TABLE IF NOT EXISTS 'list_{_log}' (name TEXT, task TEXT, number INTEGER)
     """)
예제 #4
0
 def change_email(self, email):
     User.__exe(
         "UPDATE users SET email = ?, link =?, activated = ? WHERE login = ?",
         (email, get_link(email), False, self.log))
     User.__com()
     self.email, self.activated = email, 0