Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
aeece056
Commit
aeece056
authored
1 year ago
by
Henry Luetcke
Browse files
Options
Downloads
Patches
Plain Diff
implement better dialog box for user login
parent
2632d124
No related branches found
No related tags found
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api-openbis-matlab/OpenBis.m
+1
-1
1 addition, 1 deletion
api-openbis-matlab/OpenBis.m
api-openbis-matlab/user_pass_input.m
+87
-0
87 additions, 0 deletions
api-openbis-matlab/user_pass_input.m
with
88 additions
and
1 deletion
api-openbis-matlab/OpenBis.m
+
1
−
1
View file @
aeece056
...
...
@@ -39,7 +39,7 @@ classdef OpenBis
function
login
(
obj
)
%login
% Login to openBIS with username and password
[
url
,
user
,
pw
]
=
user_
url_pw
_input
dlg
;
[
user
,
pw
]
=
user_
pass
_input
;
obj
.
pybis
.
login
(
user
,
pw
,
pyargs
(
'save_token'
,
1
))
end
...
...
This diff is collapsed.
Click to expand it.
api-openbis-matlab/user_pass_input.m
0 → 100644
+
87
−
0
View file @
aeece056
function
[
user
,
pw
]
=
user_pass_input
%user_pw_input
% UI window to obtain user name and pwword for openBIS
% check if Java is available (Matlab not started with -nojvm flag)
if
~
usejava
(
'awt'
)
error
(
'This function requires Java. Start Matlab with Java enabled.'
)
end
% default values
user
=
''
;
pw
=
''
;
% Setup figure for UI window
sz
=
get
(
0
,
'ScreenSize'
);
dlgName
=
'openBIS Credentials'
;
% setup figure window
hFig
=
figure
(
WindowStyle
=
'modal'
,
Position
=
[(
sz
(
3
:
4
)
-
[
350
100
])/
2
350
100
],
Name
=
dlgName
,
...
Resize
=
'off'
,
NumberTitle
=
'off'
,
Menubar
=
'none'
,
Color
=
[
0.9
0.9
0.9
],
CloseRequestFcn
=@
(
~
,
~
)
uiresume
);
% setup text field for user name
hUser
=
uicontrol
(
hFig
,
Style
=
'edit'
,
Position
=
[
80
70
250
20
],
KeyPressFcn
=@
userKeyPress
,
...
FontSize
=
10
,
BackGroundColor
=
'w'
,
String
=
user
);
% setup text field for password
hPw
=
uicontrol
(
hFig
,
Style
=
'edit'
,
Position
=
[
80
40
250
20
],
KeyPressFcn
=@
pwKeyPress
,
...
FontSize
=
10
,
BackGroundColor
=
'w'
,
String
=
''
);
% labels for text fields
annotation
(
hFig
,
'textbox'
,
Units
=
'pixels'
,
Position
=
[
00
70
80
20
],
String
=
'Username'
,
...
EdgeColor
=
'n'
,
VerticalAlignment
=
'middle'
,
HorizontalAlignment
=
'right'
)
annotation
(
hFig
,
'textbox'
,
Units
=
'pixels'
,
Position
=
[
00
40
80
20
],
String
=
'Password'
,
...
EdgeColor
=
'n'
,
VerticalAlignment
=
'middle'
,
HorizontalAlignment
=
'right'
)
% OK / cancel buttons
hOK
=
uicontrol
(
hFig
,
Style
=
"pushbutton"
,
Position
=
[
140
7
50
20
],
Callback
=@
okClick
,
String
=
'OK'
);
hCancel
=
uicontrol
(
hFig
,
Style
=
"pushbutton"
,
Position
=
[
215
7
50
20
],
Callback
=@
cancelClick
,
String
=
'Cancel'
);
uicontrol
(
hUser
)
% give focuse to username field
uiwait
% wait for uiresume command
drawnow
user
=
hUser
.
String
;
delete
(
hFig
)
function
userKeyPress
(
~
,
event
)
if
event
.
Key
==
"return"
uiresume
,
return
%done
elseif
event
.
Key
==
"escape"
hUser
.
String
=
''
;
pw
=
''
;
uiresume
,
return
%abort
end
end
function
pwKeyPress
(
~
,
event
)
if
event
.
Key
==
"backspace"
pw
=
pw
(
1
:
end
-
1
);
%shorten pwword
elseif
event
.
Key
==
"return"
uiresume
,
return
%done
elseif
event
.
Key
==
"escape"
hUser
.
String
=
''
;
pw
=
''
;
uiresume
,
return
%abort
elseif
contains
(
event
.
Character
,
num2cell
(
char
(
32
:
126
)))
pw
(
end
+
1
)
=
event
.
Character
;
% append key to password
end
redrawPassField
(
pw
)
end
function
redrawPassField
(
pw
)
% redraw the entire password text field with the entered value
% hidden
hPw
=
uicontrol
(
hFig
,
Style
=
'edit'
,
Position
=
[
80
40
250
20
],
KeyPressFcn
=@
pwKeyPress
,
...
FontSize
=
10
,
BackGroundColor
=
'w'
,
String
=
repmat
(
char
(
8226
),
size
(
pw
)));
end
function
okClick
(
source
,
event
)
uiresume
,
return
end
function
cancelClick
(
source
,
event
)
% default values
hUser
.
String
=
''
;
pw
=
''
;
uiresume
,
return
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment