Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
edx
edx-platform
Commits
3ee224e3
Commit
3ee224e3
authored
Aug 05, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve create_user script slightly, to auto-grab fullname for MIT users
parent
3c232358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
utility-scripts/create_user.py
+18
-9
No files found.
utility-scripts/create_user.py
View file @
3ee224e3
...
@@ -56,17 +56,9 @@ while True:
...
@@ -56,17 +56,9 @@ while True:
else
:
else
:
break
break
while
True
:
email
=
raw_input
(
'email: '
)
if
User
.
objects
.
filter
(
email
=
email
):
print
"email
%
s already taken"
%
email
else
:
break
name
=
raw_input
(
'Full name: '
)
make_eamap
=
False
make_eamap
=
False
if
raw_input
(
'Create MIT ExternalAuth? [n] '
)
.
lower
()
==
'y'
:
if
raw_input
(
'Create MIT ExternalAuth? [n] '
)
.
lower
()
==
'y'
:
email
=
'
%
s@MIT.EDU'
%
uname
if
not
email
.
endswith
(
'@MIT.EDU'
):
if
not
email
.
endswith
(
'@MIT.EDU'
):
print
"Failed - email must be @MIT.EDU"
print
"Failed - email must be @MIT.EDU"
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
...
@@ -76,6 +68,13 @@ if raw_input('Create MIT ExternalAuth? [n] ').lower()=='y':
...
@@ -76,6 +68,13 @@ if raw_input('Create MIT ExternalAuth? [n] ').lower()=='y':
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
make_eamap
=
True
make_eamap
=
True
password
=
GenPasswd
(
12
)
password
=
GenPasswd
(
12
)
# get name from kerberos
kname
=
os
.
popen
(
"finger
%
s | grep 'name:'"
%
email
)
.
read
()
.
strip
()
.
split
(
'name: '
)[
1
]
.
strip
()
name
=
raw_input
(
'Full name: [
%
s] '
%
kname
)
.
strip
()
if
name
==
''
:
name
=
kname
print
"name =
%
s"
%
name
else
:
else
:
while
True
:
while
True
:
password
=
getpass
()
password
=
getpass
()
...
@@ -84,6 +83,16 @@ else:
...
@@ -84,6 +83,16 @@ else:
break
break
print
"Oops, passwords do not match, please retry"
print
"Oops, passwords do not match, please retry"
while
True
:
email
=
raw_input
(
'email: '
)
if
User
.
objects
.
filter
(
email
=
email
):
print
"email
%
s already taken"
%
email
else
:
break
name
=
raw_input
(
'Full name: '
)
user
=
User
(
username
=
uname
,
email
=
email
,
is_active
=
True
)
user
=
User
(
username
=
uname
,
email
=
email
,
is_active
=
True
)
user
.
set_password
(
password
)
user
.
set_password
(
password
)
try
:
try
:
...
...
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