Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
9b611b46
Commit
9b611b46
authored
Oct 14, 2013
by
Jean Michel Rouly
Browse files
Ensure that only registered users can log in.
parent
747d460e
Changes
1
Hide whitespace changes
Inline
Side-by-side
wsgi/library.py
View file @
9b611b46
...
...
@@ -36,6 +36,10 @@ def user_logged_in( environ ):
return
False
def
get_username
(
environ
):
pass
# Determine if the user has posting permissions via the registration
# datbase.
def
user_registered
(
username
):
...
...
@@ -80,11 +84,18 @@ def eat_cookie():
# Register the user in the table of active users.
def
activate_user
(
hash_value
,
user
):
output
=
False
mdb
,
cursor
=
connect_to_mysql
()
sql
=
"""INSERT INTO `%s` (`user_hash`,`user`) VALUES (%s,%s);"""
cursor
.
execute
(
sql
,
(
goconfig
.
sql_usr_table
,
hash_value
,
user
)
)
mdb
.
commit
()
mdb
.
close
()
try
:
sql
=
"""INSERT INTO `%s` (`user_hash`,`user`) VALUES (%s,%s);"""
cursor
.
execute
(
sql
,
(
goconfig
.
sql_usr_table
,
hash_value
,
user
)
)
mdb
.
commit
()
output
=
True
except
MySQLdb
.
IntegrityError
:
output
=
False
finally
:
mdb
.
close
()
return
True
# Unregister the user in the table of active users.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment