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
5306a02c
Commit
5306a02c
authored
4 years ago
by
Henry Luetcke
Committed by
Adam Laskowski
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add new password entry function
parent
87910cdf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
passcode.m
+74
-0
74 additions, 0 deletions
passcode.m
with
74 additions
and
0 deletions
passcode.m
0 → 100644
+
74
−
0
View file @
5306a02c
function
pass
=
passcode
%PASSCODE password input dialog box.
% passcode creates a modal dialog box that returns user password input.
% Given characters are substituted with '*'-Signs like in usual password dialogs.
%
% usage:
% password = PASSCODE
%
% Adapted from https://www.mathworks.com/matlabcentral/fileexchange/6590-passcode
% Version: v1.2 (03-Mar-2008)
% Author: Elmar Tarajan [MCommander@gmx.de]
ScreenSize
=
get
(
0
,
'ScreenSize'
);
hfig
=
figure
(
'Menubar'
,
'none'
,
...
'Units'
,
'Pixels'
,
...
'Resize'
,
'off'
,
...
'NumberTitle'
,
'off'
,
...
'Name'
,[
'password required'
],
...
'Position'
,[
(
ScreenSize
(
3
:
4
)
-
[
300
75
])/
2
300
75
],
...
'Color'
,[
0.8
0.8
0.8
],
...
'WindowStyle'
,
'modal'
);
hedit
=
uicontrol
(
'Parent'
,
hfig
,
...
'Style'
,
'Edit'
,
...
'Enable'
,
'inactive'
,
...
'Units'
,
'Pixels'
,
'Position'
,[
49
28
202
22
],
...
'FontSize'
,
15
,
...
'String'
,[],
...
'BackGroundColor'
,[
0.7
0.7
0.7
]);
hpass
=
uicontrol
(
'Parent'
,
hfig
,
...
'Style'
,
'Text'
,
...
'Tag'
,
'password'
,
...
'Units'
,
'Pixels'
,
'Position'
,[
51
30
198
18
],
...
'FontSize'
,
15
,
...
'BackGroundColor'
,[
1
1
1
]);
hwarn
=
uicontrol
(
'Parent'
,
hfig
,
...
'Style'
,
'Text'
,
...
'Tag'
,
'error'
,
...
'Units'
,
'Pixels'
,
'Position'
,[
50
2
200
20
],
...
'FontSize'
,
8
,
...
'String'
,
'character not allowed'
,
...
'Visible'
,
'off'
,
...
'ForeGroundColor'
,[
1
0
0
],
...
'BackGroundColor'
,[
0.8
0.8
0.8
]);
set
(
hfig
,
'KeyPressFcn'
,{
@
keypress_Callback
,
hedit
,
hpass
,
hwarn
},
...
'CloseRequestFcn'
,
'uiresume'
)
uiwait
pass
=
get
(
hpass
,
'userdata'
);
delete
(
hfig
)
function
keypress_Callback
(
~
,
data
,
~
,
hpass
,
~
)
pass
=
get
(
hpass
,
'userdata'
);
switch
data
.
Key
case
'backspace'
pass
=
pass
(
1
:
end
-
1
);
case
'return'
uiresume
return
otherwise
try
pass
=
[
pass
data
.
Character
];
catch
disp
(
'Some error occured during password entry!'
)
end
end
set
(
hpass
,
'userdata'
,
pass
)
set
(
hpass
,
'String'
,
char
(
'*'
*
sign
(
pass
)))
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