Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
self-reg-form
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
self-reg-form
Commits
3638497e
Commit
3638497e
authored
3 years ago
by
Ravi Tripathi
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'louistw/fix-linting' into fix-linting
parents
bcf85bc6
f3b314c4
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
+15
-2
15 additions, 2 deletions
app/__init__.py
config.py
+4
-0
4 additions, 0 deletions
config.py
messages.py
+4
-0
4 additions, 0 deletions
messages.py
run.py
+27
-0
27 additions, 0 deletions
run.py
with
50 additions
and
2 deletions
app/__init__.py
+
15
−
2
View file @
3638497e
"""
Initialize the main flask app
"""
# app/__init__.py
# app/__init__.py
# standard imports
# standard imports
...
@@ -15,11 +18,21 @@ from flask_cors import CORS
...
@@ -15,11 +18,21 @@ from flask_cors import CORS
# local imports
# local imports
import
messages
import
messages
import
vars
import
vars
sys
.
path
.
append
(
vars
.
rabbitmq_agents_loc
)
sys
.
path
.
append
(
vars
.
rabbitmq_agents_loc
)
import
rc_util
# noqa: E402
import
rc_util
# noqa: E402
def
create_app
(
config_name
):
def
create_app
(
config_name
):
"""
Create main flask app
input:
config_name: environment of the app running
output:
Flask instance
"""
app
=
Flask
(
app
=
Flask
(
__name__
,
static_folder
=
"
static
"
__name__
,
static_folder
=
"
static
"
)
# initialization of the flask app
)
# initialization of the flask app
...
@@ -87,10 +100,10 @@ def create_app(config_name):
...
@@ -87,10 +100,10 @@ def create_app(config_name):
pre_certification_msg
=
messages
.
pre_certification_message
,
pre_certification_msg
=
messages
.
pre_certification_message
,
certification_msg
=
messages
.
certification_message
,
certification_msg
=
messages
.
certification_message
,
)
)
elif
rc_util
.
check_state
(
session
[
'
user
'
].
get
(
'
username
'
))
==
"
ok
"
:
elif
rc_util
.
check_state
(
session
[
"
user
"
].
get
(
"
username
"
))
==
"
ok
"
:
return
render_template
(
return
render_template
(
"
account/good_standing.html
"
,
"
account/good_standing.html
"
,
good_standing_msg
=
messages
.
good_standing_message
good_standing_msg
=
messages
.
good_standing_message
,
)
)
else
:
else
:
return
render_template
(
return
render_template
(
...
...
This diff is collapsed.
Click to expand it.
config.py
+
4
−
0
View file @
3638497e
"""
Define different environment running the app
"""
# config.py
# config.py
...
...
This diff is collapsed.
Click to expand it.
messages.py
+
4
−
0
View file @
3638497e
"""
Messages used in account management app
"""
welcome_message
=
(
welcome_message
=
(
"
The information below will be used to create your account. Please fill in
"
"
The information below will be used to create your account. Please fill in
"
"
the reason for requesting your account as this helps us understand our
"
"
the reason for requesting your account as this helps us understand our
"
...
...
This diff is collapsed.
Click to expand it.
run.py
+
27
−
0
View file @
3638497e
"""
This python script conatins functions that talk with Flask frontend over socketio.
It has functions to join a unique room, creating an account and certifying an account.
"""
# run.py
# run.py
# standard imports
# standard imports
...
@@ -28,6 +32,13 @@ socketio = SocketIO(
...
@@ -28,6 +32,13 @@ socketio = SocketIO(
@socketio.on
(
"
join_room
"
)
@socketio.on
(
"
join_room
"
)
def
on_room
(
json
):
def
on_room
(
json
):
"""
This function creates a unique room/flask session id, and joins it
Input:
json: conatins config information for the flask session
Output:
Join the unique room.
"""
room
=
str
(
session
[
"
uid
"
])
room
=
str
(
session
[
"
uid
"
])
referrer
=
json
[
"
referrer
"
]
referrer
=
json
[
"
referrer
"
]
join_room
(
room
)
join_room
(
room
)
...
@@ -37,6 +48,14 @@ def on_room(json):
...
@@ -37,6 +48,14 @@ def on_room(json):
@socketio.on
(
"
request account
"
)
@socketio.on
(
"
request account
"
)
def
request_account
(
json
,
methods
=
[
"
GET
"
,
"
POST
"
]):
def
request_account
(
json
,
methods
=
[
"
GET
"
,
"
POST
"
]):
"""
This function is called by the Flask frontend on an account request.
Input:
json: This contains information needed for the user that needs to be created from the frontend.
methods: Defaults to [
"
GET
"
,
"
POST
"
].
Output:
Send the json to Celery tasks file for account creation.
"""
print
(
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Queue request received:
"
+
"
\t
Queue request received:
"
...
@@ -57,6 +76,14 @@ def request_account(json, methods=["GET", "POST"]):
...
@@ -57,6 +76,14 @@ def request_account(json, methods=["GET", "POST"]):
@socketio.on
(
"
request certification
"
)
@socketio.on
(
"
request certification
"
)
def
certify_account
(
json
,
methods
=
[
"
GET
"
,
"
POST
"
]):
def
certify_account
(
json
,
methods
=
[
"
GET
"
,
"
POST
"
]):
"""
This function is called by the Flask frontend from self certification page.
Inputs:
json: Conatins information about the user that needs to be certified from the frontend.
methods: Defaults to [
"
GET
"
,
"
POST
"
].
Outputs:
Send the json to Celery tasks file for user certification.
"""
print
(
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Queue request received:
"
+
"
\t
Queue request received:
"
...
...
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