Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account_init_cleanup
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
Mitchell Moore
account_init_cleanup
Commits
c3a6a760
Commit
c3a6a760
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Feat redirect
parent
0deec4c5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
app/__init__.py
+3
-2
3 additions, 2 deletions
app/__init__.py
app/templates/auth/SignUp.html
+8
-5
8 additions, 5 deletions
app/templates/auth/SignUp.html
run.py
+4
-2
4 additions, 2 deletions
run.py
tasks.py
+2
-0
2 additions, 0 deletions
tasks.py
vars.py
+1
-0
1 addition, 0 deletions
vars.py
with
18 additions
and
9 deletions
app/__init__.py
+
3
−
2
View file @
c3a6a760
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# local imports
# local imports
from
__future__
import
print_function
from
__future__
import
print_function
import
vars
# third-party imports
# third-party imports
import
uuid
import
uuid
...
@@ -21,9 +22,9 @@ def create_app(config_name):
...
@@ -21,9 +22,9 @@ def create_app(config_name):
session
[
'
uid
'
]
=
str
(
uuid
.
uuid4
())
session
[
'
uid
'
]
=
str
(
uuid
.
uuid4
())
if
"
redir
"
in
request
.
args
and
'
return_url
'
not
in
session
:
# check for redir arg in url
if
"
redir
"
in
request
.
args
and
'
return_url
'
not
in
session
:
# check for redir arg in url
session
[
'
return_url
'
]
=
request
.
args
.
get
(
"
redir
"
)
or
"
/pun/sys/dashboard
"
session
[
'
return_url
'
]
=
request
.
args
.
get
(
"
redir
"
)
or
vars
.
default_referrer
or
request
.
referrer
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
])
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
]
,
referrer
=
session
[
'
return_url
'
]
)
# misc page error catching
# misc page error catching
@app.errorhandler
(
403
)
@app.errorhandler
(
403
)
...
...
This diff is collapsed.
Click to expand it.
app/templates/auth/SignUp.html
+
8
−
5
View file @
c3a6a760
...
@@ -11,23 +11,26 @@
...
@@ -11,23 +11,26 @@
var
socket
=
io
.
connect
(
'
http://
'
+
document
.
domain
+
'
:
'
+
location
.
port
);
var
socket
=
io
.
connect
(
'
http://
'
+
document
.
domain
+
'
:
'
+
location
.
port
);
socket
.
on
(
'
connect
'
,
function
()
{
socket
.
on
(
'
connect
'
,
function
()
{
socket
.
emit
(
'
join_room
'
)
socket
.
emit
(
'
join_room
'
,
{
referrer
:
'
{{ referrer }}
'
});
socket
.
on
(
'
creating account
'
,
function
(
msg
)
{
socket
.
on
(
'
creating account
'
,
function
(
msg
)
{
document
.
getElementById
(
"
error
"
).
innerText
=
""
;
document
.
getElementById
(
"
error
"
).
innerText
=
""
;
displayloading
();
displayloading
();
})
})
;
socket
.
on
(
'
account ready
'
,
function
(
msg
)
{
socket
.
on
(
'
account ready
'
,
function
(
msg
)
{
$
(
'
#myModal
'
).
modal
(
'
hide
'
);
$
(
'
#myModal
'
).
modal
(
'
hide
'
);
alert
(
"
Account has been created!
"
);
alert
(
"
Account has been created!
"
);
})
window
.
location
.
replace
(
'
{{ referrer }}
'
);
});
socket
.
on
(
'
Account creation failed
'
,
function
(
msg
)
{
socket
.
on
(
'
Account creation failed
'
,
function
(
msg
)
{
document
.
getElementById
(
"
error
"
).
innerText
=
"
Registration Failed. Please try again.
"
;
document
.
getElementById
(
"
error
"
).
innerText
=
"
Registration Failed. Please try again.
"
;
})
})
;
})
})
;
</script>
</script>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
...
...
This diff is collapsed.
Click to expand it.
run.py
+
4
−
2
View file @
c3a6a760
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
import
os
import
os
import
time
import
time
import
signal
import
tasks
import
tasks
import
vars
import
vars
...
@@ -23,12 +22,15 @@ socketio = SocketIO(app, message_queue= vars.message_queue)
...
@@ -23,12 +22,15 @@ socketio = SocketIO(app, message_queue= vars.message_queue)
def
socket_connect
():
def
socket_connect
():
pass
pass
@socketio.on
(
'
join_room
'
)
@socketio.on
(
'
join_room
'
)
def
on_room
():
def
on_room
(
json
):
room
=
str
(
session
[
'
uid
'
])
room
=
str
(
session
[
'
uid
'
])
referrer
=
json
[
'
referrer
'
]
join_room
(
room
)
join_room
(
room
)
print
(
'
\t\t\t
|-----Room ID:
'
+
room
)
print
(
'
\t\t\t
|-----Room ID:
'
+
room
)
print
(
'
\t\t\t
|-----Referrer:
'
+
referrer
)
@socketio.on
(
'
request account
'
)
@socketio.on
(
'
request account
'
)
...
...
This diff is collapsed.
Click to expand it.
tasks.py
+
2
−
0
View file @
c3a6a760
...
@@ -12,10 +12,12 @@ celery = Celery('flask_user_reg', broker=broker_url)
...
@@ -12,10 +12,12 @@ celery = Celery('flask_user_reg', broker=broker_url)
socketio
=
SocketIO
(
message_queue
=
vars
.
message_queue
)
socketio
=
SocketIO
(
message_queue
=
vars
.
message_queue
)
def
send_msg
(
event
,
room
):
def
send_msg
(
event
,
room
):
print
(
"
Post
'
{}
'
to room
'
{}
'"
.
format
(
event
,
room
))
print
(
"
Post
'
{}
'
to room
'
{}
'"
.
format
(
event
,
room
))
socketio
.
emit
(
event
,
room
=
room
)
socketio
.
emit
(
event
,
room
=
room
)
@celery.task
@celery.task
def
celery_create_account
(
username
,
fullname
,
reason
,
session
):
def
celery_create_account
(
username
,
fullname
,
reason
,
session
):
room
=
session
room
=
session
...
...
This diff is collapsed.
Click to expand it.
vars.py
+
1
−
0
View file @
c3a6a760
...
@@ -3,3 +3,4 @@ password = 'reggie'
...
@@ -3,3 +3,4 @@ password = 'reggie'
key
=
'
vnkdjnfjknfl1232
'
key
=
'
vnkdjnfjknfl1232
'
broker_url
=
'
amqp://
'
+
id
+
'
:
'
+
password
+
'
@ohpc:5672/
'
broker_url
=
'
amqp://
'
+
id
+
'
:
'
+
password
+
'
@ohpc:5672/
'
message_queue
=
broker_url
+
'
socketio
'
message_queue
=
broker_url
+
'
socketio
'
default_referrer
=
"
https://docs.uabgrid.uab.edu/wiki/Cheaha_Quick_Start
"
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