Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
e862c486
Commit
e862c486
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Přejmenování auth na acct
Jak ve jméně modulu mo.web.auth, tak v prefixu URL. Closes
#231
.
parent
99abbb98
Branches
Branches containing commit
No related tags found
1 merge request
!86
Registrace
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
mo/email.py
+2
-2
2 additions, 2 deletions
mo/email.py
mo/web/__init__.py
+2
-2
2 additions, 2 deletions
mo/web/__init__.py
mo/web/acct.py
+8
-8
8 additions, 8 deletions
mo/web/acct.py
mo/web/menu.py
+1
-1
1 addition, 1 deletion
mo/web/menu.py
with
13 additions
and
13 deletions
mo/email.py
+
2
−
2
View file @
e862c486
...
...
@@ -66,11 +66,11 @@ def send_user_email(user: db.User, subject: str, body: str) -> bool:
def
activate_url
(
token
:
str
)
->
str
:
return
config
.
WEB_ROOT
+
'
a
uth
/activate?
'
+
urllib
.
parse
.
urlencode
({
'
token
'
:
token
},
safe
=
'
:
'
)
return
config
.
WEB_ROOT
+
'
a
cct
/activate?
'
+
urllib
.
parse
.
urlencode
({
'
token
'
:
token
},
safe
=
'
:
'
)
def
confirm_url
(
type
:
str
,
token
:
str
)
->
str
:
return
config
.
WEB_ROOT
+
f
'
a
uth
/confirm/
{
type
}
?
'
+
urllib
.
parse
.
urlencode
({
'
token
'
:
token
},
safe
=
'
:
'
)
return
config
.
WEB_ROOT
+
f
'
a
cct
/confirm/
{
type
}
?
'
+
urllib
.
parse
.
urlencode
({
'
token
'
:
token
},
safe
=
'
:
'
)
def
contestant_list_url
(
contest
:
db
.
Contest
,
registered_only
:
bool
)
->
str
:
...
...
This diff is collapsed.
Click to expand it.
mo/web/__init__.py
+
2
−
2
View file @
e862c486
...
...
@@ -142,7 +142,7 @@ def init_request():
if
not
user
:
# Uživatel mezitím přestal existovat
app
.
logger
.
error
(
'
Zrušena session pro neexistujícího uživatele uid=%s
'
,
session
[
'
uid
'
])
return
mo
.
web
.
a
uth
.
logout
()
return
mo
.
web
.
a
cct
.
logout
()
else
:
user
=
None
...
...
@@ -217,7 +217,7 @@ except ImportError:
# Většina webu je v samostatných modulech
import
mo.web.api
import
mo.web.a
uth
import
mo.web.a
cct
import
mo.web.jinja
import
mo.web.menu
import
mo.web.misc
...
...
This diff is collapsed.
Click to expand it.
mo/web/a
uth
.py
→
mo/web/a
cct
.py
+
8
−
8
View file @
e862c486
...
...
@@ -48,7 +48,7 @@ def login_and_redirect(user: db.User, flash_msg: Optional[str] = None, url: Opti
return
redirect
(
url
)
@app.route
(
'
/a
uth
/login
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/login
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
login
():
form
=
LoginForm
(
email
=
request
.
args
.
get
(
'
email
'
))
...
...
@@ -89,13 +89,13 @@ def login():
return
render_template
(
'
login.html
'
,
form
=
form
)
@app.route
(
'
/a
uth
/logout
'
,
methods
=
(
'
POST
'
,))
@app.route
(
'
/a
cct
/logout
'
,
methods
=
(
'
POST
'
,))
def
logout
():
session
.
clear
()
return
redirect
(
url_for
(
'
index
'
))
@app.route
(
'
/a
uth
/incarnate/<int:id>
'
,
methods
=
(
'
POST
'
,))
@app.route
(
'
/a
cct
/incarnate/<int:id>
'
,
methods
=
(
'
POST
'
,))
def
incarnate
(
id
):
if
not
g
.
user
.
is_admin
:
raise
werkzeug
.
exceptions
.
Forbidden
()
...
...
@@ -195,7 +195,7 @@ class ResetForm(FlaskForm):
# URL je explicitně uvedeno v mo.email.activate_url
@app.route
(
'
/a
uth
/activate
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/activate
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
activate
():
token
=
request
.
args
.
get
(
'
token
'
)
if
not
token
:
...
...
@@ -358,7 +358,7 @@ class Reg1Form(FlaskForm):
submit
=
wtforms
.
SubmitField
(
'
Vytvořit účet
'
)
@app.route
(
'
/a
uth
/create
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/create
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
create_acct
():
form
=
Reg1Form
()
reg1
=
Reg1
(
form
.
token
.
data
)
...
...
@@ -543,7 +543,7 @@ class Reg2Form(FlaskForm):
# URL je explicitně uvedeno v mo.email.activate_url
@app.route
(
'
/a
uth
/confirm/r
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/confirm/r
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
confirm_reg
():
token
=
request
.
args
.
get
(
'
token
'
)
if
token
is
None
:
...
...
@@ -575,7 +575,7 @@ class ConfirmEmailForm(FlaskForm):
# URL je explicitně uvedeno v mo.email.activate_url
@app.route
(
'
/a
uth
/confirm/e
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/confirm/e
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
confirm_email
():
reg2
=
Reg2
(
request
.
args
.
get
(
'
token
'
),
db
.
RegReqType
.
change_email
)
if
reg2
.
status
!=
RegStatus
.
ok
:
...
...
@@ -603,7 +603,7 @@ class CancelResetForm(FlaskForm):
# URL je explicitně uvedeno v mo.email.activate_url
@app.route
(
'
/a
uth
/confirm/p
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
@app.route
(
'
/a
cct
/confirm/p
'
,
methods
=
(
'
GET
'
,
'
POST
'
))
def
confirm_reset
():
reg2
=
Reg2
(
request
.
args
.
get
(
'
token
'
),
db
.
RegReqType
.
reset_passwd
)
if
reg2
.
status
!=
RegStatus
.
ok
:
...
...
This diff is collapsed.
Click to expand it.
mo/web/menu.py
+
1
−
1
View file @
e862c486
...
...
@@ -44,7 +44,7 @@ def get_menu():
items
.
append
(
MenuItem
(
url_for
(
'
user_settings
'
),
name
,
classes
=
[
"
right
"
]))
else
:
items
.
append
(
MenuItem
(
url_for
(
'
create_acct
'
),
"
Založit účet
"
,
classes
=
[
"
right
"
]))
items
.
append
(
MenuItem
(
url_for
(
'
login
'
),
"
Přihlásit se
"
,
active_prefix
=
"
/a
uth
/
"
,
classes
=
[
"
right
"
]))
items
.
append
(
MenuItem
(
url_for
(
'
login
'
),
"
Přihlásit se
"
,
active_prefix
=
"
/a
cct
/
"
,
classes
=
[
"
right
"
]))
active
=
None
for
item
in
items
:
...
...
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