-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
67 lines (53 loc) · 1.88 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# import random
# from twilio.rest import Client
# from flask import session
# # sends confirmation code to customer phone
# def send_confirmation_code(to_number):
# verification_code = generate_code()
# send_sms(to_number, verification_code)
# session['verification_code'] = verification_code
# return verification_code
# # for generating verification code
# def generate_code():
# return str(random.randrange(100000, 999999))
# # for sending SMS
# def send_sms(to_number, body):
# account_sid = app.config['TWILIO_ACCOUNT_SID']
# auth_token = app.config['TWILIO_AUTH_TOKEN']
# twilio_number = app.config['TWILIO_NUMBER']
# client = Client(account_sid, auth_token)
# client.api.messages.create(to_number,
# from_=twilio_number,
# body=body)
# #############################
# from flask import Flask , render_template, request
# from flask_wtf import FlaskForm
# from wtforms.fields.html5 import TelField
# from flask_wtf.csrf import CSRFProtect
# app = Flask(__name__)
# app.config.update(dict(
# SECRET_KEY="powerful secretkey",
# WTF_CSRF_SECRET_KEY="a csrf secret key"
# ))
# class UserForm(FlaskForm):
# phone_number = TelField('sdafsdfasdf')
# @app.route('/test', methods=["POST", "GET"])
# def test():
# form = UserForm()
# print(form.errors, form.validate_on_submit())
# if form.validate_on_submit() and request.method == "POST":
# return "Horayyy!"
# return render_template("test.html",
# form=form)
# if __name__ == "__main__":
# app.run(debug=True)
#
# from app.models import Employee
# from app import db_session
# new_employee = Employee(employee_username='hhh',
# employee_email='hhh@domain.com',
# employee_status='active')
# print(type('hhh'))
# new_employee._set_password = 'hhh'
# db_session.add(new_employee)
# db_session.commit()