Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
146d429b
Commit
146d429b
authored
Apr 28, 2017
by
Robin Sonnabend
Browse files
Merge branch 'master' of git.fsmpi.rwth-aachen.de:protokollsystem/proto3
parents
b03b40da
bbc6c3f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
auth.py
View file @
146d429b
...
...
@@ -161,7 +161,10 @@ class SecurityManager:
summary
,
hash
=
map
(
lambda
s
:
s
.
encode
(
"utf-8"
),
parts
)
maccer
=
self
.
maccer
.
copy
()
maccer
.
update
(
summary
)
session_duration
=
datetime
.
now
()
-
User
.
from_hashstring
(
string
).
timestamp
user
=
User
.
from_hashstring
(
string
)
if
user
is
None
:
return
False
session_duration
=
datetime
.
now
()
-
user
.
timestamp
macs_equal
=
hmac
.
compare_digest
(
maccer
.
hexdigest
().
encode
(
"utf-8"
),
hash
)
time_short
=
int
(
session_duration
.
total_seconds
())
<
self
.
max_duration
return
macs_equal
and
time_short
...
...
migrations/versions/70547c924023_.py
View file @
146d429b
...
...
@@ -18,8 +18,10 @@ depends_on = None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'defaultmetas'
,
sa
.
Column
(
'prior'
,
sa
.
Boolean
(),
nullable
=
Fals
e
))
op
.
add_column
(
'defaultmetas'
,
sa
.
Column
(
'prior'
,
sa
.
Boolean
(),
nullable
=
Tru
e
))
op
.
add_column
(
'defaultmetas'
,
sa
.
Column
(
'value'
,
sa
.
String
(),
nullable
=
True
))
op
.
execute
(
"UPDATE defaultmetas SET prior=FALSE"
)
op
.
alter_column
(
"defaultmetas"
,
"prior"
,
nullable
=
False
)
# ### end Alembic commands ###
...
...
server.py
View file @
146d429b
...
...
@@ -1327,7 +1327,7 @@ def new_like():
@
app
.
route
(
"/login"
,
methods
=
[
"GET"
,
"POST"
])
def
login
():
if
"auth"
in
session
:
if
"auth"
in
session
and
current_user
()
is
not
None
:
flash
(
"You are already logged in."
,
"alert-success"
)
return
redirect
(
request
.
args
.
get
(
"next"
)
or
url_for
(
"index"
))
form
=
LoginForm
()
...
...
Write
Preview
Supports
Markdown
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