Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Flask_User_Reg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mitchell Moore
Flask_User_Reg
Commits
b1a714ca
Commit
b1a714ca
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
add detection of account creation
parent
0bb5ad0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!35
Version 1b openstack rabbitmq
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/__init__.py
+1
-1
1 addition, 1 deletion
app/__init__.py
app/templates/auth/SignUp.html
+6
-3
6 additions, 3 deletions
app/templates/auth/SignUp.html
run.py
+37
-3
37 additions, 3 deletions
run.py
with
44 additions
and
7 deletions
app/__init__.py
+
1
−
1
View file @
b1a714ca
...
...
@@ -28,7 +28,7 @@ def create_app(config_name):
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
# initial route to display the reg page
def
index
():
global
return_url
username
=
"
mmoo97
"
username
=
"
name_test
"
if
"
redir
"
in
request
.
args
and
return_url
==
""
:
# check for redir arg in url
return_url
=
request
.
args
.
get
(
"
redir
"
)
or
"
/pun/sys/dashboard
"
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/SignUp.html
+
6
−
3
View file @
b1a714ca
...
...
@@ -11,12 +11,15 @@
socket
.
on
(
'
connect
'
,
function
()
{
socket
.
emit
(
'
user connect
'
,
{
data
:
'
User Connected
'
user
:
document
.
getElementById
(
"
username
"
).
innerText
}
)
socket
.
on
(
'
creating account
'
,
function
(
msg
)
{
document
.
getElementById
(
"
error
"
).
innerText
=
""
;
displayloading
();
socket
.
emit
(
"
validate creation
"
,
{
username
:
document
.
getElementById
(
"
username
"
).
innerText
})
})
socket
.
on
(
'
Account creation failed
'
,
function
(
msg
)
{
...
...
@@ -24,8 +27,8 @@
})
socket
.
on
(
'
a
ccount created
'
,
function
(
msg
)
{
document
.
getElementById
(
"
test
"
).
innerHTML
=
"
Account
C
reat
ed
!
"
;
socket
.
on
(
'
A
ccount created
'
,
function
(
msg
)
{
alert
(
"
Account
c
reat
ion successful
!
"
)
;
})
...
...
This diff is collapsed.
Click to expand it.
run.py
+
37
−
3
View file @
b1a714ca
...
...
@@ -17,14 +17,35 @@ def messageReceived(methods=['GET', 'POST']):
print
(
'
message was received!!!
'
)
def
check_dir
(
user
,
interval
):
"""
:param user: (string) username to check for in DB.
:param interval: (int) Frequency to check in seconds.
:return: (boolean) if account has been registered.
"""
seconds
=
0
while
seconds
<
600
:
querystring
=
"
_
"
+
user
+
"
.done
"
for
filename
in
os
.
listdir
(
"
flat_db/
"
):
if
filename
.
endswith
(
querystring
):
return
True
time
.
sleep
(
interval
)
seconds
=
seconds
+
interval
return
False
@socketio.on
(
'
user connect
'
)
def
handle_my_custom_event
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
'
received my event:
'
+
str
(
json
))
username
=
json
[
"
user
"
]
print
(
'
User
'
+
username
+
'
connected.
'
)
@socketio.on
(
'
user data
'
)
def
confirm
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
'
request received:
'
,
str
(
json
))
def
ingest_data
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
'
Queue
request received:
'
,
str
(
json
))
try
:
fullname
=
json
[
"
fullname
"
]
...
...
@@ -44,12 +65,25 @@ def confirm(json, methods=['GET', 'POST']):
file
.
write
(
reason
)
file
.
close
()
print
(
'
User
'
+
username
+
'
added to queue
'
)
socketio
.
emit
(
"
creating account
"
)
except
Exception
as
e
:
print
(
"
Error in directory creation:
"
,
e
)
socketio
.
emit
(
"
Account creation failed
"
)
@socketio.on
(
"
validate creation
"
)
def
creation_confirmation
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
username
=
json
[
"
username
"
]
if
check_dir
(
username
,
10
):
print
(
'
Account successfully created for
'
+
username
)
socketio
.
emit
(
"
Account created
"
)
else
:
socketio
.
emit
(
"
Account creation failed
"
)
if
__name__
==
'
__main__
'
:
# app.run()
socketio
.
run
(
app
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment