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
00154783
Commit
00154783
authored
3 years ago
by
Krish Moodbidri
Browse files
Options
Downloads
Patches
Plain Diff
merge auto-conflict on app/__init__.py
parent
ff481fa2
No related branches found
No related tags found
No related merge requests found
Pipeline
#5886
failed with stage
Stage: lint
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/__init__.py
+7
-2
7 additions, 2 deletions
app/__init__.py
app/static/scripts/function.js
+8
-0
8 additions, 0 deletions
app/static/scripts/function.js
run.py
+11
-0
11 additions, 0 deletions
run.py
tasks.py
+17
-1
17 additions, 1 deletion
tasks.py
with
43 additions
and
3 deletions
app/__init__.py
+
7
−
2
View file @
00154783
...
...
@@ -58,8 +58,13 @@ def create_app(config_name):
return
render_template
(
'
errors/blocked.html
'
)
elif
rc_util
.
check_state
(
session
[
'
user
'
].
get
(
'
username
'
))
==
"
certification
"
:
return
render_template
(
'
errors/certification.html
'
)
return
render_template
(
'
errors/certify.html
'
,
room_id
=
session
[
'
uid
'
],
username
=
session
[
'
user
'
].
get
(
'
username
'
),
fullname
=
session
[
'
user
'
].
get
(
'
fullname
'
),
email
=
session
[
'
user
'
].
get
(
'
email
'
),
referrer
=
session
[
'
return_url
'
],
cancel_url
=
vars
.
default_referrer
,
welcome_msg
=
messages
.
welcome_message
,
cancel_msg
=
messages
.
cancel_message
,
error_msg
=
messages
.
error_message
)
else
:
return
render_template
(
'
auth/SignUp.html
'
,
room_id
=
session
[
'
uid
'
],
username
=
session
[
'
user
'
].
get
(
'
username
'
),
...
...
This diff is collapsed.
Click to expand it.
app/static/scripts/function.js
+
8
−
0
View file @
00154783
...
...
@@ -16,6 +16,14 @@ function request_account() {
})
}
function
certify_account
()
{
socket
.
emit
(
'
request certification
'
,
{
fullname
:
document
.
getElementById
(
"
fullname
"
).
value
,
email
:
document
.
getElementById
(
"
email
"
).
value
,
username
:
document
.
getElementById
(
"
username
"
).
value
})
}
function
renderDom
(
title
,
message
,
error_msg
)
{
document
.
getElementById
(
"
form-wrapper
"
).
innerHTML
=
"
<h3>
"
+
title
+
"
</h3><br>
"
;
document
.
getElementById
(
"
form-wrapper
"
).
innerHTML
+=
"
<p>
"
+
message
+
"
</p><br>
"
;
...
...
This diff is collapsed.
Click to expand it.
run.py
+
11
−
0
View file @
00154783
...
...
@@ -35,5 +35,16 @@ def request_account(json, methods=['GET', 'POST']):
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Error in account creation:
"
,
e
)
socketio
.
emit
(
"
Account creation failed
"
,
room
)
@socketio.on
(
'
request certification
'
)
def
certify_account
(
json
,
methods
=
[
'
GET
'
,
'
POST
'
]):
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
Queue request received:
'
+
str
(
json
))
room
=
str
(
session
[
'
uid
'
])
print
(
"
CERTIFY Room: {}
"
.
format
(
room
))
try
:
tasks
.
celery_certify_account
(
json
,
session
=
room
)
except
Exception
as
e
:
print
(
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
"
\t
Error in account certification:
"
,
e
)
socketio
.
emit
(
"
Account certification failed
"
,
room
)
if
__name__
==
'
__main__
'
:
socketio
.
run
(
app
,
host
=
'
0.0.0.0
'
)
This diff is collapsed.
Click to expand it.
tasks.py
+
17
−
1
View file @
00154783
...
...
@@ -59,4 +59,20 @@ def celery_create_account(json, session):
rc_util
.
add_account
(
username
,
queuename
,
email
,
fullname
,
reason
)
print
(
'
sent account info
'
)
print
(
'
Waiting for completion...
'
)
rc_util
.
consume
(
queuename
,
routing_key
=
f
'
complete.
{
queuename
}
'
,
callback
=
gen_f
(
room
))
rc_util
.
consume
(
queuename
,
routing_key
=
f
'
complete.
{
queuename
}
'
,
callback
=
gen_f
(
room
))
@celery.task
def
celery_certify_account
(
json
,
session
):
room
=
session
username
=
json
[
'
username
'
]
email
=
json
[
'
email
'
]
fullname
=
json
[
'
fullname
'
]
queuename
=
rc_util
.
encode_name
(
username
)
print
(
"
CERTIFY :
"
+
time
.
strftime
(
"
%m-%d-%Y_%H:%M:%S
"
)
+
'
\t
User
'
+
username
+
'
added to queue
'
)
send_msg
(
'
certifying account
'
,
room
)
print
(
username
)
rc_util
.
update_state
(
username
,
'
ok
'
)
print
(
'
sent account info
'
)
print
(
'
Waiting for certification...
'
)
send_msg
(
'
certified
'
,
room
)
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