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
0
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
Krish Moodbidri
Flask_User_Reg
Commits
912da48a
Commit
912da48a
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Clear text when response recieved
parent
244b4006
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/__init__.py
+1
-1
1 addition, 1 deletion
app/__init__.py
app/static/scripts/function.js
+1
-1
1 addition, 1 deletion
app/static/scripts/function.js
app/templates/auth/SignUp.html
+5
-8
5 additions, 8 deletions
app/templates/auth/SignUp.html
run.py
+20
-9
20 additions, 9 deletions
run.py
with
27 additions
and
19 deletions
app/__init__.py
+
1
−
1
View file @
912da48a
...
...
@@ -16,7 +16,7 @@ from wtforms import StringField, SubmitField, TextAreaField, validators
from
flask_socketio
import
SocketIO
# global declarations
global
time_stamp
def
create_app
(
config_name
):
...
...
This diff is collapsed.
Click to expand it.
app/static/scripts/function.js
+
1
−
1
View file @
912da48a
...
...
@@ -17,7 +17,7 @@ function displayloading() {
}
function
socketIO
()
{
socket
.
emit
(
'
user
connect
'
,
{
socket
.
emit
(
'
user
data
'
,
{
fullname
:
document
.
getElementById
(
"
fullname
"
).
value
,
reason
:
document
.
getElementById
(
"
reason
"
).
value
})
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/SignUp.html
+
5
−
8
View file @
912da48a
...
...
@@ -14,12 +14,8 @@
data
:
'
User Connected
'
}
)
socket
.
on
(
'
my response
'
,
function
(
msg
)
{
console
.
log
(
msg
)
if
(
typeof
msg
.
user_name
!==
'
undefined
'
)
{
$
(
'
h3
'
).
remove
()
$
(
'
div.message_holder
'
).
append
(
'
<div><b style="color: #002">
'
+
msg
.
user_name
+
'
</b> creating</div>
'
)
}
socket
.
on
(
'
creating account
'
,
function
(
msg
)
{
document
.
getElementById
(
"
test
"
).
innerHTML
=
"
Account is being Created!
"
;
})
...
...
@@ -87,14 +83,14 @@
</div>
<h2>
Hello, {{ user }}!
</h2>
<div
id=
"test"
>
<form
action=
"."
method=
"post"
onsubmit=
""
>
<div
class=
"signUpContainer"
>
<label><b><label
for=
"fullname"
>
Full Name:
</label><br></b></label>
<input
class=
"form-control"
id=
"fullname"
name=
"fullname"
placeholder=
"Enter Full Name"
required=
""
type=
"text"
>
<label><b><label
for=
"reason"
>
Reason for Requesting Account:
</label><br></b></label>
<textarea
class=
"form-control"
id=
"reason"
name=
"reason"
placeholder=
"Enter Reason for Account Request"
required=
""
></textarea>
<input
class=
"btn btn-primary btn-block"
id=
"submit"
name=
"submit"
type=
"button"
value=
"Submit"
onclick=
"
displayloading();
socketIO()"
>
<input
class=
"btn btn-primary btn-block"
id=
"submit"
name=
"submit"
type=
"button"
value=
"Submit"
onclick=
"socketIO()"
>
{% with messages = get_flashed_messages() %}
{% if messages %}
...
...
@@ -109,6 +105,7 @@
</div>
</form>
</div>
</div>
<div
id=
"notification_window"
>
...
...
This diff is collapsed.
Click to expand it.
run.py
+
20
−
9
View file @
912da48a
# run.py
import
os
import
time
from
app
import
create_app
from
flask_socketio
import
SocketIO
...
...
@@ -20,18 +21,28 @@ def handle_my_custom_event(json, methods=['GET', 'POST']):
print
(
'
received my event:
'
+
str
(
json
))
@socketio.on
(
'
user data
'
)
def
confirm
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
str
(
json
))
socketio
.
emit
(
"
creating account
"
)
@socketio.on
(
'
my event
'
)
def
handle_my_custom_event
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
'
received my event:
'
+
str
(
json
))
socketio
.
emit
(
'
my response
'
,
json
,
callback
=
messageReceived
)
# time_stamp = time.strftime("%m-%d-%Y_%H:%M:%S")
# complete_file_name = os.path.join(directory, time_stamp + ".txt")
# file = open(complete_file_name, "w")
# file.close()
# time.sleep(5)
#
# pre, ext = os.path.splitext(complete_file_name)
# os.rename(complete_file_name, pre + ".done")
socketio
.
emit
(
'
my response
'
,
json
,
callback
=
"
test worked
"
)
time_stamp
=
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
directory
=
"
flat_db/
"
complete_file_name
=
os
.
path
.
join
(
directory
,
time_stamp
+
"
.txt
"
)
file
=
open
(
complete_file_name
,
"
w
"
)
file
.
close
()
time
.
sleep
(
5
)
pre
,
ext
=
os
.
path
.
splitext
(
complete_file_name
)
os
.
rename
(
complete_file_name
,
pre
+
"
.done
"
)
socketio
.
emit
(
'
create response
'
,
json
,
callback
=
messageReceived
)
...
...
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