Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ServicePoints
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
aebopp
ServicePoints
Commits
f1e3daf2
Commit
f1e3daf2
authored
4 years ago
by
mrschnei
Browse files
Options
Downloads
Patches
Plain Diff
Users no longer need to sign up with an Org and can change Org in User Profile
parent
8adc4c22
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
servicePoints/templates/create.html
+35
-30
35 additions, 30 deletions
servicePoints/templates/create.html
servicePoints/templates/userProfile.html
+11
-1
11 additions, 1 deletion
servicePoints/templates/userProfile.html
servicePoints/views/accounts.py
+21
-9
21 additions, 9 deletions
servicePoints/views/accounts.py
with
67 additions
and
40 deletions
servicePoints/templates/create.html
+
35
−
30
View file @
f1e3daf2
<!DOCTYPE html>
<html>
<body>
<title>
ServicePoints
</title>
<p>
Want to register an organization with your new account account?
<a
href=
"/accounts/createOrg/"
>
Register as organization leader
</a>
</p>
<form
action=
"/accounts/create/"
method=
"post"
enctype=
"multipart/form-data"
>
<p>
Student Organization
<input
type=
"text"
name=
"orgName"
/>
</p>
<p>
Your Name
<input
type=
"text"
name=
"fullname"
/>
</p>
<title>
ServicePoints
</title>
<p>
Username
<input
type=
"text"
name=
"username"
/>
</p>
<p>
Email
<input
type=
"text"
name=
"email"
/>
</p>
Want to register an organization with your new account account?
<a
href=
"/accounts/createOrg/"
>
Register as organization leader
</a>
</p>
<form
action=
"/accounts/create/"
method=
"post"
enctype=
"multipart/form-data"
>
<p>
<label
for=
"orgName"
>
Select an Organization:
</label>
<select
name=
"orgName"
id=
"orgName"
>
<option
value=
"NONE"
>
Choose Later
</option>
{% for org in orgs %}
<option
value=
"{{org.orgName}}"
>
{{org.orgName}}
</option>
{% endfor %}
</select>
</p>
<p>
Your Name
<input
type=
"text"
name=
"fullname"
/>
</p>
<p>
Username
<input
type=
"text"
name=
"username"
/>
</p>
<p>
Email
<input
type=
"text"
name=
"email"
/>
</p>
<p>
Password
<input
type=
"password"
name=
"password"
/>
</p>
<input
type=
"submit"
name=
"signup"
value=
"sign up"
/>
</form>
<p>
Password
<
input
type=
"password"
name=
"password"
/
>
Have an account?
<
a
href=
"/accounts/login/"
>
Log in
</a
>
</p>
<input
type=
"submit"
name=
"signup"
value=
"sign up"
/>
</form>
<p>
Have an account?
<a
href=
"/accounts/login/"
>
Log in
</a>
</p>
</body>
</html>
This diff is collapsed.
Click to expand it.
servicePoints/templates/userProfile.html
+
11
−
1
View file @
f1e3daf2
...
...
@@ -12,7 +12,17 @@
<a
href=
"/accounts/logout/"
>
logout
</a>
<a
href=
"/accounts/delete/"
>
delete
</a>
<form
action=
"/accounts/profile/"
method=
"post"
>
<p>
<label
for=
"orgName"
>
Select an Organization:
</label>
<select
name=
"orgName"
id=
"orgName"
>
{% for org in orgs %}
<option
value=
"{{org.orgName}}"
>
{{org.orgName}}
</option>
{% endfor %}
</select>
</p>
<input
type=
"submit"
name=
"signup"
value=
"Update Org"
/>
</form>
</body>
...
...
This diff is collapsed.
Click to expand it.
servicePoints/views/accounts.py
+
21
−
9
View file @
f1e3daf2
...
...
@@ -73,11 +73,8 @@ def create():
if
len
(
str
(
flask
.
request
.
form
[
'
password
'
]))
is
0
or
len
(
str
(
flask
.
request
.
form
[
'
fullname
'
]))
is
0
:
return
flask
.
redirect
(
flask
.
url_for
(
'
incompleteForm
'
,
prev
=
"
create
"
))
if
len
(
str
(
flask
.
request
.
form
[
'
orgN
ame
'
]))
is
0
or
len
(
str
(
flask
.
request
.
form
[
'
email
'
]))
is
0
:
if
len
(
str
(
flask
.
request
.
form
[
'
usern
ame
'
]))
is
0
or
len
(
str
(
flask
.
request
.
form
[
'
email
'
]))
is
0
:
return
flask
.
redirect
(
flask
.
url_for
(
'
incompleteForm
'
,
prev
=
"
create
"
))
if
len
(
str
(
flask
.
request
.
form
[
'
username
'
]))
is
0
:
return
flask
.
redirect
(
flask
.
url_for
(
'
incompleteForm
'
,
prev
=
"
create
"
))
flask
.
session
[
'
username
'
]
=
flask
.
request
.
form
[
'
username
'
]
flask
.
session
[
'
fullname
'
]
=
flask
.
request
.
form
[
'
fullname
'
]
...
...
@@ -95,7 +92,11 @@ def create():
return
flask
.
redirect
(
flask
.
url_for
(
'
index
'
))
context
=
{}
cursor
=
servicePoints
.
model
.
get_db
()
cur
=
cursor
.
execute
(
"
SELECT * FROM orgs
"
)
orgs
=
cur
.
fetchall
()
context
=
{
"
orgs
"
:
orgs
}
return
render_template
(
'
create.html
'
,
**
context
)
@servicePoints.app.route
(
'
/accounts/createOrg/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
...
...
@@ -263,9 +264,21 @@ def food():
context
=
{}
return
render_template
(
'
food.html
'
,
**
context
)
@servicePoints.app.route
(
'
/accounts/profile/
'
)
@servicePoints.app.route
(
'
/accounts/profile/
'
,
methods
=
[
'
GET
'
,
'
POST
'
]
)
def
profile
():
context
=
{}
if
flask
.
request
.
method
==
'
POST
'
:
orgName
=
str
(
flask
.
request
.
form
[
'
orgName
'
])
cur
=
servicePoints
.
model
.
get_db
()
cur
.
execute
(
'
UPDATE users SET orgName = ? WHERE username = ?
'
,
(
orgName
,
flask
.
session
[
'
username
'
]))
return
flask
.
redirect
(
flask
.
url_for
(
'
index
'
))
cursor
=
servicePoints
.
model
.
get_db
()
cur
=
cursor
.
execute
(
"
SELECT * FROM orgs
"
)
orgs
=
cur
.
fetchall
()
context
=
{
"
orgs
"
:
orgs
}
return
render_template
(
'
userProfile.html
'
,
**
context
)
@servicePoints.app.route
(
'
/images/<path:filename>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
...
...
@@ -310,8 +323,7 @@ def tutorsu():
username
=
flask
.
session
[
"
username
"
]
cur2
=
cursor
.
execute
(
'
SELECT email FROM users WHERE
'
'
username =:who
'
,
{
"
who
"
:
username
})
'
username =:who
'
,
{
"
who
"
:
username
})
emails
=
cur2
.
fetchall
()
# Add database info to context
...
...
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