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
Thomas Leymonerie
slapos.toolbox
Commits
652bc606
Commit
652bc606
authored
Jun 21, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user session management
parent
317b1abf
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
119 additions
and
7 deletions
+119
-7
slapos/runner/__init__.py
slapos/runner/__init__.py
+1
-1
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+9
-0
slapos/runner/static/js/scripts/account.js
slapos/runner/static/js/scripts/account.js
+48
-0
slapos/runner/templates/account.html
slapos/runner/templates/account.html
+35
-0
slapos/runner/templates/index.html
slapos/runner/templates/index.html
+1
-1
slapos/runner/templates/layout.html
slapos/runner/templates/layout.html
+1
-1
slapos/runner/templates/projectFolder.html
slapos/runner/templates/projectFolder.html
+2
-2
slapos/runner/templates/runResult.html
slapos/runner/templates/runResult.html
+1
-1
slapos/runner/views.py
slapos/runner/views.py
+21
-1
No files found.
slapos/runner/__init__.py
View file @
652bc606
...
...
@@ -126,7 +126,7 @@ def serve(config):
#set default user and password
salt
=
"runner81"
#to be changed
pwd
=
hashlib
.
md5
(
salt
+
"insecure"
).
hexdigest
()
user
=
"root;"
+
pwd
+
";
Slaprunner Administrator;1
"
user
=
"root;"
+
pwd
+
";
;Slaprunner Administrator
"
open
(
os
.
path
.
join
(
config
.
runner_workdir
,
'.users'
),
'w'
).
write
(
user
)
app
.
run
(
host
=
config
.
runner_host
,
port
=
int
(
config
.
runner_port
),
debug
=
config
.
debug
,
threaded
=
True
)
slapos/runner/static/css/styles.css
View file @
652bc606
...
...
@@ -644,6 +644,14 @@ a.lshare img{
width
:
30px
;
height
:
22px
;
}
.noscroll
{
overflow
:
hidden
;
}
.form
{
padding
:
10px
;
padding-left
:
20px
;}
.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
;}
.hiddendiv
{
display
:
none
;
white-space
:
pre-wrap
;
min-height
:
18px
;
font-family
:
Arial
,
sans-serif
;
font-size
:
13px
;
padding
:
3px
;
word-wrap
:
break-word
;
width
:
430px
;
max-height
:
120px
;}
.list
{
background
:
url(../images/menu_dropdown.png)
left
center
no-repeat
;
padding-left
:
10px
;}
.slidebox
{
padding
:
10px
;
}
.alert_message
{
background
:
url(../images/alert.png)
center
no-repeat
;
height
:
26px
;}
...
...
@@ -661,6 +669,7 @@ a.lshare img{
margin-top
:
10px
;
box-shadow
:
1px
1px
1px
#888888
;}
.menu-box-left
ul
{
margin
:
0px
;
list-style
:
none
;}
.menu-box-left
li
{
padding
:
2px
;
padding-left
:
10px
;
padding-right
:
10px
;
text-shadow
:
0px
1px
#fff
;
border-bottom
:
1px
solid
#fff
;}
.menu-box-left
li
label
,
.menu-box-left
li
input
[
type
=
radio
]
{
cursor
:
pointer
}
.menu-box-left
li
:hover
{
background
:
#F0F2F2
;}
.menu-box-left
li
.checked
{
background
:
#fff
;}
.menu-box-right
h2
{
text-align
:
center
}
...
...
slapos/runner/static/js/scripts/account.js
0 → 100644
View file @
652bc606
$
(
document
).
ready
(
function
()
{
var
send
=
false
;
$
(
"
#update
"
).
click
(
function
(){
var
haspwd
=
false
;
if
(
$
(
"
input#username
"
).
val
()
===
""
||
!
$
(
"
input#username
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Invalid user name. Please check it!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#name
"
).
val
()
===
""
){
$
(
"
#error
"
).
Popup
(
"
Please enter your name and surname!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
!
$
(
"
input#email
"
).
val
().
match
(
/^
([
a-zA-Z0-9_
\.\-])
+
\@(([
a-zA-Z0-9
\-])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Please enter a valid email adress!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!==
""
){
if
(
$
(
"
input#password
"
).
val
()
===
""
||
!
$
(
"
input#password
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Please enter your new password!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!==
$
(
"
input#cpassword
"
).
val
()){
$
(
"
#error
"
).
Popup
(
"
your password does not match!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
haspwd
=
true
;
}
if
(
send
)
return
false
;
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/updateAccount
'
,
data
:
{
name
:
$
(
"
input#name
"
).
val
(),
username
:
$
(
"
input#username
"
).
val
(),
email
:
$
(
"
input#email
"
).
val
(),
password
:((
haspwd
)
?
$
(
"
input#password
"
).
val
():
""
)},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#error
"
).
Popup
(
"
Your account informations has been saved!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
},
error
:
function
(){
send
=
false
;}
});
return
false
;
});
});
\ No newline at end of file
slapos/runner/templates/account.html
0 → 100644
View file @
652bc606
{% extends "layout.html" %}
{% block title %}Update your account{% endblock %}
{% block head %}
{{ super() }}
<script
src=
"{{ url_for('static', filename='js/scripts/account.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
{% endblock %}
{% block body %}
<h2
class=
'title'
>
Your personal informations
</h2><br/>
<form>
<div
class=
'form'
>
<label
for=
"name"
>
Your name:
</label>
<input
type=
'text'
name=
'name'
id=
'name'
value=
'{{name}}'
/>
<div
class=
'clear'
></div>
<label
for=
"email"
>
Your email adress:
</label>
<input
type=
'text'
name=
'email'
id=
'email'
value=
'{{email}}'
/>
<div
class=
'clear'
></div>
<label
for=
"username"
>
User name:
</label>
<input
type=
'text'
name=
'username'
id=
'username'
value=
'{{username}}'
/>
<div
class=
'clear'
></div>
<label
for=
"password"
>
Password:
</label>
<input
type=
'password'
name=
'password'
id=
'password'
value=
''
/>
<div
class=
'clear'
></div>
<label
for=
"cpassword"
>
Confirm Password:
</label>
<input
type=
'password'
name=
'cpassword'
id=
'cpassword'
value=
''
/>
<div
class=
'clear'
></div>
<br/>
<label></label>
<input
type=
"submit"
name=
"update"
id =
"update"
value=
"Update"
class=
"button"
/>
<div
class=
'clear'
></div>
<br/><br/><br/>
</div>
<div
id=
"file_info"
class=
"file_info"
>
leave passwords blank to preserve your current password...
</div>
<br/>
</form>
{% endblock %}
slapos/runner/templates/index.html
View file @
652bc606
...
...
@@ -32,7 +32,7 @@
<div
class=
"clear"
></div>
</div>
<div
class=
"umenu"
>
<h2><a
href=
"{{ url_for('
login
')}}"
>
Your Account
</a></h2>
<h2><a
href=
"{{ url_for('
myAccount
')}}"
>
Your Account
</a></h2>
<p>
Click here to Manage your account
</p>
<img
src=
"{{ url_for('static', filename='images/user_card.png') }}"
/>
</div>
...
...
slapos/runner/templates/layout.html
View file @
652bc606
...
...
@@ -121,9 +121,9 @@
<div
style=
"margin-top:3px;border-bottom: 1px dashed #666666; heigth:1px"
></div>
<ul>
<li><a
href=
"{{ url_for('manageProject')}}"
>
Manage Repositories
</a></li>
<li><a
href=
"{{ url_for('configRepo')}}"
>
Clone your Repository
</a></li>
<li><a
href=
"{{ url_for('openProject', method='open')}}"
>
Open Software Release
</a></li>
<li><a
href=
"{{ url_for('openProject', method='new')}}"
>
Create Software Release
</a></li>
<li><a
href=
"{{ url_for('logout')}}"
>
Close your session
</a></li>
</ul>
</div>
</body>
...
...
slapos/runner/templates/projectFolder.html
View file @
652bc606
...
...
@@ -14,7 +14,7 @@
<input
type=
"hidden"
name=
"method"
id=
"method"
value=
"{{method}}"
/>
{% if method == "new" %}
<div
id=
"addsoftware"
>
<h2
>
Create your software release
</h2
>
<h2
class=
"title"
>
Create your software release
</h2><br/
>
<label
for=
'software'
>
Name:
</label>
<input
type=
"text"
name=
"software"
id=
"software"
size=
'30'
value=
"Enter software name..."
/>
<br/><br/>
...
...
@@ -28,7 +28,7 @@
</div>
{% elif method == "open" %}
<div
id=
"openSoftware"
>
<h2
>
Select the folder of your software release into the box
</h2
>
<h2
class=
"title"
>
Select the folder of your software release into the box
</h2><br/
>
<div
id=
"fileTree"
class=
"file_tree"
></div>
<div
id=
"file_info"
class=
"file_info"
>
<img
src=
"{{ url_for('static', filename='images/check.png') }}"
class=
"check"
id=
"check"
alt=
""
/>
...
...
slapos/runner/templates/runResult.html
View file @
652bc606
...
...
@@ -24,7 +24,7 @@
<button
id =
"open"
class=
"button"
title=
"Set this software as current software release"
>
Open
</button>
<br/><br/>
<h2
id=
"softcontent"
>
No content to displays
</h2>
<div
id=
"fileTree"
class=
"file_tree"
style=
'height:200px;'
></div>
<div
id=
"fileTree"
class=
"file_tree"
style=
'height:200px;'
title=
"Double click to open file"
></div>
<div
id=
"file_info"
class=
"file_info"
>
<span
id=
"info"
>
Please select your file or folder into the box...
</span></div>
<!-- This contains the hidden content for inline calls -->
...
...
slapos/runner/views.py
View file @
652bc606
...
...
@@ -444,3 +444,23 @@ def getParameterXml(request):
return
jsonify
(
code
=
0
,
result
=
parameters
)
else
:
return
jsonify
(
code
=
1
,
result
=
parameters
)
@
app
.
route
(
"/updateAccount"
,
methods
=
[
'POST'
])
def
updateAccount
():
account
=
session
[
'account'
]
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
try
:
if
request
.
form
[
'username'
].
strip
():
account
[
0
]
=
request
.
form
[
'username'
].
strip
()
account
[
2
]
=
request
.
form
[
'email'
].
strip
()
account
[
3
]
=
request
.
form
[
'name'
].
strip
().
encode
(
"utf-8"
)
if
request
.
form
[
'password'
].
strip
():
account
[
1
]
=
request
.
form
[
'password'
].
strip
()
#save new account data
open
(
user
,
'w'
).
write
(
';'
.
join
(
account
))
session
[
'account'
]
=
account
return
jsonify
(
code
=
1
,
result
=
""
)
except
Exception
,
e
:
os
.
remove
(
user
)
open
(
user
,
'w'
).
write
(
';'
.
join
(
session
[
'account'
]))
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