Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
b2b473b1
Commit
b2b473b1
authored
Apr 28, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[INSTALL] Default account created with init script.
parent
b6263a33
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
5 deletions
+41
-5
init_accounts.py
init_accounts.py
+39
-5
README.md
install/README.md
+1
-0
account.csv
install/init/account.csv
+1
-0
No files found.
init_accounts.py
View file @
b2b473b1
...
@@ -2,11 +2,45 @@
...
@@ -2,11 +2,45 @@
import
sys
import
sys
import
os
import
os
dirname
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"gargantext.settings"
)
# initialize Django application
from
django.core.wsgi
import
get_wsgi_application
application
=
get_wsgi_application
()
from
django.contrib.auth
import
password_validation
from
django.contrib.auth.hashers
import
(
check_password
,
is_password_usable
,
make_password
)
from
django.db
import
models
from
django.utils.crypto
import
get_random_string
,
salted_hmac
# retrieve Django models
import
django.apps
django_models
=
django
.
apps
.
apps
.
get_models
()
django_models_names
=
set
(
model
.
_meta
.
db_table
for
model
in
django_models
)
from
gargantext.util.db
import
session
from
gargantext.util.db
import
session
from
gargantext.models.users
import
User
from
gargantext.models.users
import
User
from
django.core.mail
import
send_mail
from
django.core.mail
import
send_mail
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"gargantext.settings"
)
def
make_random_password
(
length
=
10
,
allowed_chars
=
'abcdefghjkmnpqrstuvwxyz'
'ABCDEFGHJKLMNPQRSTUVWXYZ'
'0123456789'
):
"""
Generate a random password with the given length and given
allowed_chars. The default value of allowed_chars does not have "I" or
"O" or letters and digits that look similar -- just to avoid confusion.
(source: django/contrib/auth)
"""
return
get_random_string
(
length
,
allowed_chars
)
def
notify_user
(
username
,
email
,
password
):
def
notify_user
(
username
,
email
,
password
):
message
=
'''
message
=
'''
...
@@ -42,10 +76,10 @@ def create_user(username, email, user=None, password=None, active=False, notify=
...
@@ -42,10 +76,10 @@ def create_user(username, email, user=None, password=None, active=False, notify=
user
.
email
=
email
user
.
email
=
email
user
.
is_active
=
True
user
.
is_active
=
True
if
password
is
None
or
password
==
""
:
if
password
is
None
or
password
==
""
:
password
=
User
.
objects
.
make_random_password
()
password
=
make_random_password
()
#print
(password)
user
.
password
=
make_password
(
password
)
user
.
set_password
(
password
)
session
.
add
(
user
)
user
.
save
()
session
.
commit
()
if
notify
==
True
:
if
notify
==
True
:
notify_user
(
username
,
email
,
password
)
notify_user
(
username
,
email
,
password
)
...
...
install/README.md
View file @
b2b473b1
...
@@ -99,6 +99,7 @@ service postgresql start
...
@@ -99,6 +99,7 @@ service postgresql start
su gargantua
su gargantua
source
/srv/env_3-5/bin/activate
source
/srv/env_3-5/bin/activate
/srv/gargantext/manage.py runserver 0.0.0.0:8000
/srv/gargantext/manage.py runserver 0.0.0.0:8000
python /srv/gargantext/init_accounts.py /srv/gargantext/install/init/account.csv
```
```
### Outside docker container launch browser
### Outside docker container launch browser
...
...
install/init/account.csv
0 → 100644
View file @
b2b473b1
gargantua,contact@gargantext,autnagrag,
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