Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
slapos.toolbox
Commits
1e9dd387
Commit
1e9dd387
authored
Jun 21, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Webrunner session management
parent
f0bbe128
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
38 deletions
+57
-38
slapos/runner/static/css/jqueryTabs.css
slapos/runner/static/css/jqueryTabs.css
+1
-1
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+3
-2
slapos/runner/static/js/scripts/folder.js
slapos/runner/static/js/scripts/folder.js
+8
-8
slapos/runner/utils.py
slapos/runner/utils.py
+31
-5
slapos/runner/views.py
slapos/runner/views.py
+14
-22
No files found.
slapos/runner/static/css/jqueryTabs.css
View file @
1e9dd387
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
width
:
702px
;
width
:
702px
;
}
}
#tabContaier
textarea
.slap
{
white-space
:
pre-wrap
;
word-wrap
:
break-word
;
overflow
:
hidden
;
color
:
#6F6F6F
;
width
:
430px
;
max-height
:
120px
;
#tabContaier
textarea
.slap
{
white-space
:
pre-wrap
;
word-wrap
:
break-word
;
overflow
:
hidden
;
color
:
#6F6F6F
;
width
:
430px
;
max-height
:
120px
;
resize
:
none
;
height
:
18px
;
padding
:
3px
;
min-height
:
18px
;}
resize
:
none
;
height
:
18px
;
padding
:
3px
;
min-height
:
18px
;
font-size
:
13px
;
}
#tabContaier
>
ul
{
#tabContaier
>
ul
{
overflow
:
hidden
;
overflow
:
hidden
;
height
:
34px
;
height
:
34px
;
...
...
slapos/runner/static/css/styles.css
View file @
1e9dd387
...
@@ -39,6 +39,7 @@ th{
...
@@ -39,6 +39,7 @@ th{
table
.small
th
{
padding
:
4px
;
font-size
:
16px
;}
table
.small
th
{
padding
:
4px
;
font-size
:
16px
;}
textarea
{
textarea
{
width
:
762px
;
width
:
762px
;
font-family
:
'Helvetica Neue'
,
Tahoma
,
Helvetica
,
Arial
,
sans-serif
;
}
}
body
{
body
{
...
@@ -650,8 +651,8 @@ a.lshare img{
...
@@ -650,8 +651,8 @@ a.lshare img{
.form
{
padding
:
10px
;
padding-left
:
20px
;}
.form
{
padding
:
10px
;
padding-left
:
20px
;}
.form
label
{
display
:
block
;
float
:
left
;
width
:
150px
;
padding-top
:
10px
;}
.form
label
{
display
:
block
;
float
:
left
;
width
:
150px
;
padding-top
:
10px
;}
.form
input
[
type
=
text
]
,
.form
input
[
type
=
password
]
{
float
:
left
;
width
:
190px
;
margin
:
5px
;}
.form
input
[
type
=
text
]
,
.form
input
[
type
=
password
]
{
float
:
left
;
width
:
190px
;
margin
:
5px
;}
.hiddendiv
{
display
:
none
;
white-space
:
pre-wrap
;
min-height
:
18px
;
font-
family
:
Arial
,
sans-serif
;
font-
size
:
13px
;
.hiddendiv
{
display
:
none
;
white-space
:
pre-wrap
;
min-height
:
18px
;
font-size
:
13px
;
padding
:
3px
;
word-wrap
:
break-word
;
width
:
430px
;
max-height
:
120px
;}
padding
:
3px
;
word-wrap
:
break-word
;
width
:
430px
;
max-height
:
120px
;
font-family
:
'Helvetica Neue'
,
Tahoma
,
Helvetica
,
Arial
,
sans-serif
;
}
.list
{
background
:
url(../images/menu_dropdown.png)
left
center
no-repeat
;
padding-left
:
10px
;}
.list
{
background
:
url(../images/menu_dropdown.png)
left
center
no-repeat
;
padding-left
:
10px
;}
.slidebox
{
padding
:
10px
;
}
.slidebox
{
padding
:
10px
;
}
.alert_message
{
background
:
url(../images/alert.png)
center
no-repeat
;
height
:
26px
;}
.alert_message
{
background
:
url(../images/alert.png)
center
no-repeat
;
height
:
26px
;}
...
...
slapos/runner/static/js/scripts/folder.js
View file @
1e9dd387
...
@@ -35,7 +35,7 @@ $(document).ready( function() {
...
@@ -35,7 +35,7 @@ $(document).ready( function() {
$
(
"
#error
"
).
Popup
(
"
Invalid project name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#error
"
).
Popup
(
"
Invalid project name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
return
false
;
}
}
if
(
$
(
"
input#user
"
).
val
()
!=
""
&&
$
(
"
input#user
"
).
val
()
!=
"
Enter your name...
"
){
if
(
$
(
"
input#user
"
).
val
()
!=
=
"
"
){
name
=
$
(
"
input#user
"
).
val
();
name
=
$
(
"
input#user
"
).
val
();
}
}
if
(
$
(
"
input#email
"
).
val
()
!=
""
&&
$
(
"
input#email
"
).
val
()
!=
"
Enter your email adress...
"
){
if
(
$
(
"
input#email
"
).
val
()
!=
""
&&
$
(
"
input#email
"
).
val
()
!=
"
Enter your email adress...
"
){
...
...
slapos/runner/utils.py
View file @
1e9dd387
...
@@ -41,6 +41,14 @@ def html_escape(text):
...
@@ -41,6 +41,14 @@ def html_escape(text):
return
""
.
join
(
html_escape_table
.
get
(
c
,
c
)
for
c
in
text
)
return
""
.
join
(
html_escape_table
.
get
(
c
,
c
)
for
c
in
text
)
def
checkLogin
(
config
,
login
,
pwd
):
def
checkLogin
(
config
,
login
,
pwd
):
user
=
getSession
(
config
)
salt
=
"runner81"
#to be changed
current_pwd
=
hashlib
.
md5
(
salt
+
pwd
).
hexdigest
()
if
current_pwd
==
user
[
1
]:
return
user
return
False
def
getSession
(
config
):
user_path
=
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
)
user_path
=
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
)
user
=
""
user
=
""
if
os
.
path
.
exists
(
user_path
):
if
os
.
path
.
exists
(
user_path
):
...
@@ -52,11 +60,29 @@ def checkLogin(config, login, pwd):
...
@@ -52,11 +60,29 @@ def checkLogin(config, login, pwd):
user
=
open
(
user_path
,
'r'
).
read
().
split
(
';'
)
user
=
open
(
user_path
,
'r'
).
read
().
split
(
';'
)
else
:
else
:
return
False
return
False
salt
=
"runner81"
#to be changed
current_pwd
=
hashlib
.
md5
(
salt
+
pwd
).
hexdigest
()
if
current_pwd
==
user
[
1
]:
return
user
return
user
return
False
def
saveSession
(
config
,
session
,
account
):
user
=
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
)
try
:
if
account
[
1
]:
salt
=
"runner81"
#to be changed
account
[
1
]
=
hashlib
.
md5
(
salt
+
account
[
1
]).
hexdigest
()
else
:
account
[
1
]
=
session
[
'account'
][
1
]
#backup previous data
open
(
user
+
'.back'
,
'w'
).
write
(
';'
.
join
(
session
[
'account'
]))
#save new account data
open
(
user
,
'w'
).
write
((
';'
.
join
(
account
)).
encode
(
"utf-8"
))
session
[
'account'
]
=
account
return
True
except
Exception
,
e
:
try
:
os
.
remove
(
user
)
os
.
rename
(
user
+
'.back'
,
user
)
except
:
pass
return
str
(
e
)
def
updateProxy
(
config
):
def
updateProxy
(
config
):
if
not
os
.
path
.
exists
(
config
[
'instance_root'
]):
if
not
os
.
path
.
exists
(
config
[
'instance_root'
]):
...
...
slapos/runner/views.py
View file @
1e9dd387
...
@@ -19,8 +19,7 @@ def before_request():
...
@@ -19,8 +19,7 @@ def before_request():
return
redirect
(
url_for
(
'login'
))
return
redirect
(
url_for
(
'login'
))
if
session
.
has_key
(
'account'
)
and
session
[
'account'
]:
if
session
.
has_key
(
'account'
)
and
session
[
'account'
]:
session
[
'title'
]
=
getProjectTitle
(
app
.
config
)
session
[
'title'
]
=
getProjectTitle
(
app
.
config
)
session
[
'account'
]
=
open
(
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
),
session
[
'account'
]
=
getSession
(
app
.
config
)
'r'
).
read
().
split
(
';'
)
# general views
# general views
@
app
.
route
(
'/'
)
@
app
.
route
(
'/'
)
...
@@ -46,7 +45,9 @@ def logout():
...
@@ -46,7 +45,9 @@ def logout():
@
app
.
route
(
'/configRepo'
)
@
app
.
route
(
'/configRepo'
)
def
configRepo
():
def
configRepo
():
public_key
=
open
(
app
.
config
[
'public_key'
],
'r'
).
read
()
public_key
=
open
(
app
.
config
[
'public_key'
],
'r'
).
read
()
return
render_template
(
'cloneRepository.html'
,
workDir
=
'workspace'
,
public_key
=
public_key
)
return
render_template
(
'cloneRepository.html'
,
workDir
=
'workspace'
,
public_key
=
public_key
,
name
=
session
[
'account'
][
3
].
decode
(
'utf-8'
),
email
=
session
[
'account'
][
2
])
@
app
.
route
(
"/doLogin"
,
methods
=
[
'POST'
])
@
app
.
route
(
"/doLogin"
,
methods
=
[
'POST'
])
def
doLogin
():
def
doLogin
():
...
@@ -450,23 +451,14 @@ def getParameterXml(request):
...
@@ -450,23 +451,14 @@ def getParameterXml(request):
@
app
.
route
(
"/updateAccount"
,
methods
=
[
'POST'
])
@
app
.
route
(
"/updateAccount"
,
methods
=
[
'POST'
])
def
updateAccount
():
def
updateAccount
():
account
=
session
[
'account'
][:]
#copy session data
account
=
[]
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
try
:
account
.
append
(
request
.
form
[
'username'
].
strip
())
if
request
.
form
[
'username'
].
strip
():
account
.
append
(
request
.
form
[
'password'
].
strip
())
account
[
0
]
=
request
.
form
[
'username'
].
strip
()
account
.
append
(
request
.
form
[
'email'
].
strip
())
account
[
2
]
=
request
.
form
[
'email'
].
strip
()
account
.
append
(
request
.
form
[
'name'
].
strip
())
account
[
3
]
=
request
.
form
[
'name'
].
strip
()
result
=
saveSession
(
app
.
config
,
session
,
account
)
if
request
.
form
[
'password'
].
strip
():
if
type
(
result
)
==
type
(
""
):
salt
=
"runner81"
#to be changed
return
jsonify
(
code
=
0
,
result
=
result
)
account
[
1
]
=
hashlib
.
md5
(
salt
+
request
.
form
[
'password'
].
strip
()).
hexdigest
()
else
:
#backup previous data
open
(
user
+
'.back'
,
'w'
).
write
(
';'
.
join
(
session
[
'account'
]))
#save new account data
open
(
user
,
'w'
).
write
((
';'
.
join
(
account
)).
encode
(
"utf-8"
))
session
[
'account'
]
=
account
return
jsonify
(
code
=
1
,
result
=
""
)
return
jsonify
(
code
=
1
,
result
=
""
)
\ No newline at end of file
except
Exception
,
e
:
os
.
remove
(
user
)
os
.
rename
(
user
+
'.back'
,
user
)
return
jsonify
(
code
=
0
,
result
=
str
(
e
))
\ No newline at end of file
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