Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baas
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
baas
Commits
85335b0e
Commit
85335b0e
authored
Apr 13, 2016
by
Efthymia Bika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove passphrase field from backup form
Use passphrase pop-up instead, where needed
parent
f8ebc34c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
65 deletions
+57
-65
baas/backup-list.html
baas/backup-list.html
+22
-48
baas/backup.js
baas/backup.js
+15
-10
baas/dup_calls.js
baas/dup_calls.js
+14
-6
baas/restore.html
baas/restore.html
+2
-1
baas/static/stylesheets/custom.css
baas/static/stylesheets/custom.css
+3
-0
baas/timeview.js
baas/timeview.js
+1
-0
No files found.
baas/backup-list.html
View file @
85335b0e
...
...
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
g_tab_clicked
=
""
;
g_value
=
""
;
g_passphrase
=
""
;
function
disable_buttons
(
disable
)
{
$
(
"
#backup_button
"
).
attr
(
"
disabled
"
,
disable
);
...
...
@@ -133,26 +134,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
return
true
;
}
function
check_passphrase
()
{
var
passphrase
=
$
(
"
#passphrase
"
).
val
();
if
(
!
passphrase
)
{
$
(
'
#passphrase-error small
'
).
text
(
errors
.
passphrase_empty
);
$
(
'
#passphrase-error small
'
).
show
();
return
false
;
}
else
{
$
(
'
#passphrase-error small
'
).
hide
();
}
return
true
;
}
function
disable_form
(
disable
)
{
$
(
"
#backup-name
"
).
prop
(
"
disabled
"
,
disable
);
$
(
"
#choose-dir
"
).
prop
(
"
disabled
"
,
disable
);
$
(
"
#cloud
"
).
prop
(
"
disabled
"
,
disable
);
var
save_pass
=
$
(
"
#save_passphrase
"
).
is
(
"
:checked
"
);
if
(
save_pass
)
{
$
(
"
#passphrase
"
).
prop
(
"
disabled
"
,
disable
);
}
var
project
=
$
(
"
#project_div
"
);
if
(
project
)
{
$
(
"
#project
"
).
prop
(
"
disabled
"
,
disable
);
...
...
@@ -202,13 +188,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
function
check_fields
()
{
return
(
check_directory
(
"
directory
"
)
&&
check_cloud
()
&&
check_backup_name
()
&&
check_passphrase
());
&&
check_backup_name
());
}
function
go_to_restore
()
{
g_res_directory
=
RESTORE_DEFAULT_DIR
;
g_passphrase
=
$
(
"
#passphrase
"
).
val
();
g_passphrase
=
$
(
"
#passphrase
_m
"
).
val
();
g_res_file
=
""
;
g_timestamp
=
""
;
$
(
"
#restore-tab-link
"
).
trigger
(
"
click
"
);
...
...
@@ -323,14 +308,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
function
submit_passphrase
()
{
$
(
'
#passphrase
'
).
val
(
$
(
'
#passphrase_m
'
).
val
());
$
(
'
#passphrase-modal
'
).
foundation
(
'
reveal
'
,
'
close
'
);
if
(
$
(
"
#save_passphrase_m
"
).
is
(
"
:checked
"
))
{
$
(
"
#save_passphrase
"
).
attr
(
"
checked
"
,
true
);
save_backup_set
(
false
);
if
(
!
$
(
"
#passphrase_m
"
).
val
())
{
$
(
"
#passphrase-m-error small
"
).
text
(
errors
.
passphrase_empty
);
$
(
"
#passphrase-m-error small
"
).
show
();
}
else
{
$
(
'
#passphrase-modal
'
).
foundation
(
'
reveal
'
,
'
close
'
);
if
(
$
(
"
#save_passphrase_m
"
).
is
(
"
:checked
"
))
{
if
(
selected_backup
)
{
backups
[
selected_backup
].
passphrase
=
$
(
"
#passphrase_m
"
).
val
();
}
save_backup_set
(
false
);
}
window
[
g_tab_clicked
](
g_value
);
}
window
[
g_tab_clicked
](
g_value
);
}
</script>
<div
class=
"row"
>
...
...
@@ -458,27 +451,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
in your cloud
</div>
</div>
<div
class=
"clearfix"
>
<div
class=
"small-3 columns"
>
<label
id=
"passphrase_label"
for=
"passphrase"
class=
"right inline"
>
Passphrase
</label>
</div>
<div
class=
"small-5 columns error"
id=
"passphrase-error"
>
<input
type=
"password"
id=
"passphrase"
placeholder=
"Passphrase"
>
<small
class=
"error"
></small>
</div>
<div
class=
"small-2 columns"
>
<label
for=
"save_passphrase"
class=
"right inline"
>
Save
</label>
</div>
<div
class=
"small-2 columns"
>
<input
id=
"save_passphrase"
type=
"checkbox"
>
</div>
</div>
</fieldset>
<div
class=
"clearfix pad-bottom"
>
<div
class=
"small-3 columns"
>
...
...
@@ -725,7 +697,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<div
id=
"passphrase-modal"
class=
"reveal-modal"
data-reveal
aria-labelledby=
"firstModalTitle"
aria-hidden=
"true"
role=
"dialog"
>
<h5>
Use a passphrase to encrypt/decrypt backups
</h5>
<div>
</div>
<div
class=
"small-3 columns"
>
<label
id=
"passphrase_m_label"
for=
"passphrase_m"
class=
"right inline"
>
Passphrase
</label>
...
...
@@ -753,7 +726,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</a>
</div>
</div>
<a
class=
"close-reveal-modal"
aria-label=
"Close"
>
×
</a>
<a
class=
"close-reveal-modal"
aria-label=
"Close"
onclick=
"if($('#loader')) $('#loader').hide()"
>
×
</a>
</div>
<script
type=
"text/javascript"
>
$
(
document
).
foundation
();
...
...
baas/backup.js
View file @
85335b0e
...
...
@@ -84,7 +84,6 @@ function hide_error_divs() {
$
(
'
#cloud-error small
'
).
hide
();
$
(
'
#project-error small
'
).
hide
();
$
(
'
#res-cloud-error small
'
).
hide
();
$
(
'
#passphrase-error small
'
).
hide
();
$
(
'
#res-passphrase-error small
'
).
hide
();
$
(
'
#passphrase-m-error small
'
).
hide
();
$
(
'
#exclude-error small
'
).
hide
();
...
...
@@ -112,10 +111,8 @@ function load_backup(backup) {
$
(
"
#backup-name
"
).
val
(
backup
.
name
);
$
(
"
#directory
"
).
html
(
backup
.
local_dir
);
$
(
"
#cloud
"
).
val
(
backup
.
cloud
);
$
(
"
#passphrase
"
).
val
(
backup
.
passphrase
);
if
(
backup
.
passphrase
!=
""
)
{
$
(
"
#save_passphrase
"
).
prop
(
"
checked
"
,
true
);
}
$
(
"
#passphrase_m
"
).
val
(
backup
.
passphrase
);
if
(
backup
.
first_backup
)
{
disable_form
(
true
);
disable_actions
(
false
);
...
...
@@ -144,7 +141,7 @@ function load_backup(backup) {
$
(
"
#cloud
"
).
val
(
''
);
$
(
"
#project
"
).
val
(
''
);
}
$
(
"
#passphrase
"
).
val
(
''
);
$
(
"
#passphrase
_m
"
).
val
(
''
);
$
(
"
#exclude
"
).
val
(
''
);
$
(
"
#include
"
).
val
(
''
);
$
(
"
#full
"
).
prop
(
"
checked
"
,
true
);
...
...
@@ -158,7 +155,8 @@ function load_backup(backup) {
function
show_alert_box
(
msg
,
alert_type
,
hide
)
{
$
(
"
#
"
+
alert_type
+
"
-alert
"
).
show
();
$
(
"
#
"
+
alert_type
+
"
-msg
"
).
html
(
msg
+
"
<a href='#' class='close'>×</a>
"
);
$
(
"
#
"
+
alert_type
+
"
-msg
"
).
html
(
msg
+
"
<a href='#' class='close'>×</a>
"
);
if
(
hide
)
{
$
(
"
#
"
+
alert_type
+
"
-alert
"
).
delay
(
1200
).
fadeOut
(
400
);
}
...
...
@@ -172,8 +170,15 @@ function save_backup_set(is_template) {
var
backup_name
=
$
(
"
#backup-name
"
).
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
);
var
directory
=
$
(
"
#directory
"
).
html
();
var
cloud
=
$
(
"
#cloud
"
).
val
();
var
save_pass
=
$
(
"
#save_passphrase
"
).
is
(
"
:checked
"
);
var
passphrase
=
(
save_pass
)
?
$
(
"
#passphrase
"
).
val
()
:
""
;
var
passphrase
=
""
;
if
(
typeof
backups
[
cloud
+
"
/
"
+
backup_name
]
!=
'
undefined
'
)
{
// existing backup
passphrase
=
backups
[
cloud
+
"
/
"
+
backup_name
].
passphrase
;
}
else
{
// new one
passphrase
=
$
(
"
#save_passphrase_m
"
).
is
(
"
:checked
"
)
?
$
(
"
#passphrase_m
"
).
val
()
:
""
;
}
var
exclude
=
$
(
"
#exclude
"
).
val
();
var
include
=
$
(
"
#include
"
).
val
();
...
...
@@ -261,7 +266,7 @@ function show_passphrase_modal(error) {
}
function
check_empty_passphrase
()
{
var
passphrase
=
$
(
"
#passphrase
"
).
val
();
var
passphrase
=
$
(
"
#passphrase
_m
"
).
val
();
if
(
!
passphrase
)
{
show_passphrase_modal
(
false
);
return
false
;
...
...
baas/dup_calls.js
View file @
85335b0e
...
...
@@ -30,12 +30,17 @@ function backup(restore) {
if
(
$
(
"
#error-alert
"
))
$
(
"
#error-alert
"
).
hide
();
$
(
"
#msg
"
).
html
(
""
);
if
(
!
restore
)
{
save_backup_set
(
false
);
disable_form
(
true
);
disable_actions
(
true
);
disable_buttons
(
true
);
if
(
check_empty_passphrase
())
{
save_backup_set
(
false
);
disable_form
(
true
);
disable_actions
(
true
);
disable_buttons
(
true
);
call_duplicity
(
"
backup
"
,
get_backup_set
(),
false
);
call_duplicity
(
"
backup
"
,
get_backup_set
(),
false
);
}
else
{
g_tab_clicked
=
"
backup
"
;
g_value
=
false
;
}
}
else
{
$
(
'
#res-passphrase-error small
'
).
hide
();
call_duplicity
(
"
restore
"
,
null
,
false
);
...
...
@@ -43,7 +48,7 @@ function backup(restore) {
}
function
get_env_values
()
{
var
sel_pass
=
$
(
'
#passphrase
'
).
val
()
?
$
(
'
#passphrase
'
)
:
var
sel_pass
=
$
(
'
#passphrase
_m
'
).
val
()
?
$
(
'
#passphrase_m
'
)
:
$
(
"
#res-passphrase
"
);
var
passphrase
=
sel_pass
.
val
();
...
...
@@ -332,6 +337,9 @@ function spawn_dup_process(args, backup_set, backup_name, mode) {
backup_set
.
last_status
=
"
Failed
"
;
if
(
code
==
DUP_ERR_CODES
.
CONNECTION_FAILED
)
{
show_cloud_error
();
}
else
if
(
code
==
DUP_ERR_CODES
.
GPG_FAILED
)
{
toggle_msgs
(
""
,
"
msg
"
,
false
);
show_passphrase_modal
(
true
);
}
else
{
show_alert_box
(
"
There was a problem uploading backup set
"
,
"
error
"
,
false
);
...
...
baas/restore.html
View file @
85335b0e
...
...
@@ -23,7 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
function
load_field_values
()
{
$
(
"
#res-backup-name
"
).
val
(
backups
[
selected_backup
].
name
);
$
(
"
#res-cloud
"
).
val
(
backups
[
selected_backup
].
cloud
);
$
(
"
#res-passphrase
"
).
val
(
backups
[
selected_backup
].
passphrase
);
$
(
"
#res-passphrase
"
).
val
(
backups
[
selected_backup
].
passphrase
||
g_passphrase
);
if
(
typeof
g_res_directory
!=
'
undefined
'
)
{
$
(
"
#res-directory
"
).
html
(
g_res_directory
);
}
...
...
baas/static/stylesheets/custom.css
View file @
85335b0e
...
...
@@ -187,3 +187,6 @@ body fieldset {
.wrapper
p
{
font-size
:
0.8rem
;
}
.reveal-modal
{
max-width
:
38.5rem
;
}
baas/timeview.js
View file @
85335b0e
...
...
@@ -21,6 +21,7 @@ function go_to_restore_single(name) {
g_res_file
=
time_path
+
name
;
g_timestamp
=
selected_date
;
g_passphrase
=
$
(
"
#passphrase_m
"
).
val
();
$
(
"
#restore-tab-link
"
).
trigger
(
"
click
"
);
}
...
...
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