Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
d3239b49
Commit
d3239b49
authored
Apr 09, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #372 from hnk/fix-spaces_in_password
fix(read_password): regex check for spaces, quotes
parents
d11be61d
6989df0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
mail.py
tools/mail.py
+6
-3
No files found.
tools/mail.py
View file @
d3239b49
#!/usr/bin/python3
import
sys
,
getpass
,
urllib
.
request
,
urllib
.
error
,
json
import
sys
,
getpass
,
urllib
.
request
,
urllib
.
error
,
json
,
re
def
mgmt
(
cmd
,
data
=
None
,
is_json
=
False
):
# The base URL for the management daemon. (Listens on IPv4 only.)
...
...
@@ -31,11 +31,14 @@ def read_password():
while
True
:
first
=
getpass
.
getpass
(
'password: '
)
if
len
(
first
)
<
4
:
print
(
'Passwords must be at least four characters.'
)
print
(
"Passwords must be at least four characters."
)
continue
if
re
.
search
(
r'[\s]'
,
first
):
print
(
"Passwords cannot contain spaces."
)
continue
second
=
getpass
.
getpass
(
' (again): '
)
if
first
!=
second
:
print
(
'Passwords not the same. Try again.'
)
print
(
"Passwords not the same. Try again."
)
continue
break
return
first
...
...
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