Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #137 from MasonScarbro/main
Browse files Browse the repository at this point in the history
Issue #120 Mobile Verification Steps 1.
  • Loading branch information
SID262000 authored Oct 8, 2023
2 parents b85bc65 + bfe8373 commit d6d66dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Django==4.2.3
sqlparse==0.4.4
typing_extensions==4.7.1
tzdata==2023.3
twilio==8.9.1
24 changes: 24 additions & 0 deletions userAuth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
from django.http import HttpResponseRedirect
from django.contrib import messages
from .models import Buyer, Seller
from twilio.rest import Client
from random import randrange


#This is what will send the message top the phone
def send_message_verification(number, code):
account_sid = 'YOUR ACCOUNT SID'
auth_token = 'YOUR AUTH TOKEN'
client = Client(account_sid, auth_token)

message = client.messages.create(
from_='YOUR TWILIO NUMBER',
body='Verification Code: ' + str(code),
to='+1' + number #+1 assumes they are in the us if not just tell them to add an area code
)



def check_user_exists(email):
Expand Down Expand Up @@ -132,6 +148,9 @@ def buyer_signup(request):
email = request.POST["email"]
address = request.POST["address"]
# register the buyer on our web
#send a verification code, DESIGN TBA
code = randrange(1001, 5000)
send_message_verification(phone_no, code)
try:
url, message = user_signup(
username=username,
Expand Down Expand Up @@ -174,6 +193,11 @@ def seller_signup(request):
email = request.POST["email"]
work_experience = request.POST["work_experience"]
address = request.POST["address"]

#send a verification code
code = randrange(1001, 5000)
send_message_verification(phone_no, code)

try:
url, message = user_signup(
username=username,
Expand Down

0 comments on commit d6d66dd

Please sign in to comment.