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
709254c0
Commit
709254c0
authored
Oct 29, 2013
by
Jean Michel Rouly
Browse files
Added user registration function. Defaults to requiring mod approval.
parent
8fc67cc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
wsgi/library.py
View file @
709254c0
...
...
@@ -86,6 +86,22 @@ def user_registered( username ):
return
num_rows
>
0
# Register a user --- that is, enter them in the registered database with a
# false (default=0) approval flag.
def
register_user
(
user
,
name
,
desc
):
mdb
,
cursor
=
connect_to_mysql
()
output
=
False
try
:
sql
=
"""INSERT INTO `%s`(`user`, `name`, `comment`) VALUES (%s, %s, %s)"""
cursor
.
execute
(
sql
,
(
goconfig
.
sql_registration_table
,
user
,
name
,
desc
)
)
output
=
True
except
MySQLdb
.
IntegrityError
:
pass
mdb
.
commit
()
mdb
.
close
()
return
output
# Log in a user by placing a cookie on their machine and entering
# the related hash in a SQL database.
def
generate_cookie
(
user
):
...
...
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