Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
d07b2804
Commit
d07b2804
authored
Jul 14, 2016
by
Benjamin Fischer
Browse files
Platform/Login: fixed direct linking for normal login
fixes
parent
de8adc66
Changes
3
Hide whitespace changes
Inline
Side-by-side
vispa/controller/root.py
View file @
d07b2804
...
...
@@ -75,19 +75,6 @@ class RootController(AbstractController):
logger
.
info
(
"Mounting controller '%s'"
%
os
.
path
.
join
(
os
.
sep
,
mountpoint
))
setattr
(
self
.
extensions
,
mountpoint
,
controller
)
def
requested_path
(
self
,
delete
=
True
):
path
=
""
if
"requested_path"
in
cherrypy
.
session
.
keys
():
path
+=
cherrypy
.
session
[
"requested_path"
]
if
delete
:
del
cherrypy
.
session
[
"requested_path"
]
if
"query_string"
in
cherrypy
.
session
.
keys
():
if
cherrypy
.
session
[
"query_string"
]:
path
+=
"?"
+
cherrypy
.
session
[
"query_string"
]
if
delete
:
del
cherrypy
.
session
[
"query_string"
]
return
path
def
get_preferences
(
self
,
db
,
user_id
,
parse_json
=
False
):
preferences
=
{}
preferences
[
"vispa_preferences"
]
=
VispaPreference
.
get_data_by_user_id
(
db
,
user_id
)
...
...
@@ -185,9 +172,12 @@ class RootController(AbstractController):
@
cherrypy
.
tools
.
render
(
template
=
"sites/login.mako"
)
@
cherrypy
.
tools
.
method
(
accept
=
"GET"
)
def
login
(
self
,
*
args
,
**
kwargs
):
path
=
self
.
requested_path
()
path
=
vispa
.
url
.
dynamic
(
"?"
+
cherrypy
.
request
.
query_string
)
db
=
cherrypy
.
request
.
db
if
"user_id"
in
cherrypy
.
session
:
raise
cherrypy
.
HTTPRedirect
(
path
)
login
=
cherrypy
.
request
.
login
if
login
and
vispa
.
config
(
"user"
,
"remote.enabled"
,
False
):
user
=
User
.
get_by_name
(
db
,
login
)
...
...
@@ -218,7 +208,6 @@ class RootController(AbstractController):
disclaimer_text
=
vispa
.
config
(
"web"
,
"text.disclaimer"
,
""
)
use_forgot
=
vispa
.
config
(
"web"
,
"forgot.use"
,
False
)
return
{
"requested_path"
:
path
,
"welcome_phrase"
:
welcome_phrase
,
"login_text"
:
login_text
,
"registration_text"
:
registration_text
,
...
...
@@ -232,17 +221,16 @@ class RootController(AbstractController):
@
cherrypy
.
tools
.
user
(
on
=
False
)
@
cherrypy
.
tools
.
method
(
accept
=
"GET"
)
def
guest_login
(
self
,
*
args
,
**
kwargs
):
# return an error when guest logins are disabled
if
vispa
.
config
(
"web"
,
"enable_guest_login"
,
False
)
is
False
:
raise
cherrypy
.
HTTPError
(
403
,
"Guest login not allowed!"
)
req
=
cherrypy
.
request
path
=
vispa
.
url
.
dynamic
(
"?"
+
req
.
query_string
)
path
=
vispa
.
url
.
dynamic
(
"?"
+
cherrypy
.
request
.
query_string
)
# redirect when the user is already logged in
if
"user_id"
in
cherrypy
.
session
:
raise
cherrypy
.
HTTPRedirect
(
path
)
# return an error when guest logins are disabled
if
vispa
.
config
(
"web"
,
"enable_guest_login"
,
False
)
is
False
:
raise
cherrypy
.
HTTPError
(
403
,
"Guest login not allowed!"
)
# actual guest login
user
,
password
=
User
.
guest_login
(
req
.
db
)
...
...
vispa/static/js/login.js
View file @
d07b2804
...
...
@@ -77,7 +77,7 @@ define([
var
d
=
new
Date
();
d
.
setTime
(
d
.
getTime
()
+
60
e3
);
$
.
cookie
(
"
tmpPass
"
,
pass
,
{
expires
:
d
});
window
.
location
.
href
=
self
.
url
.
dynamic
(
self
.
config
.
requestedPat
h
);
window
.
location
.
href
=
self
.
url
.
dynamic
(
location
.
searc
h
);
}
});
...
...
vispa/templates/sites/login.mako
View file @
d07b2804
...
...
@@ -14,10 +14,9 @@
// use template variables to create the vispa config
var vispaConfig = {
url: {
dynamicBase: "${base_dynamic}",
staticBase : "${base_static}"
dynamicBase: "${base_dynamic}",
staticBase : "${base_static}"
},
requestedPath: "${requested_path}",
useForgot : ${"true" if use_forgot else "false"}
};
...
...
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