Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Nounous
re2o
Commits
0efe0c27
Commit
0efe0c27
authored
Oct 26, 2017
by
Gabriel Detraz
Committed by
root
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notification pour l'autocapture mac
parent
95d55628
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
users/models.py
users/models.py
+24
-0
users/templates/users/email_auto_newmachine
users/templates/users/email_auto_newmachine
+27
-0
No files found.
users/models.py
View file @
0efe0c27
...
...
@@ -669,10 +669,34 @@ class User(AbstractBaseUser):
domain
.
interface_parent
=
interface_cible
domain
.
clean
()
domain
.
save
()
self
.
notif_auto_newmachine
(
interface_cible
)
except
Exception
as
error
:
return
False
,
error
return
True
,
"Ok"
def
notif_auto_newmachine
(
self
,
interface
):
"""Notification mail lorsque une machine est automatiquement
ajoutée par le radius"""
template
=
loader
.
get_template
(
'users/email_auto_newmachine'
)
assooptions
,
_created
=
AssoOption
.
objects
.
get_or_create
()
general_options
,
_created
=
GeneralOption
.
objects
.
get_or_create
()
context
=
Context
({
'nom'
:
self
.
get_full_name
(),
'mac_address'
:
interface
.
mac_address
,
'asso_name'
:
assooptions
.
name
,
'interface_name'
:
interface
.
domain
,
'asso_email'
:
assooptions
.
contact
,
'pseudo'
:
self
.
pseudo
,
})
send_mail
(
"Ajout automatique d'une machine / New machine autoregistered"
,
''
,
general_options
.
email_from
,
[
self
.
email
],
html_message
=
template
.
render
(
context
)
)
return
def
set_user_password
(
self
,
password
):
""" A utiliser de préférence, set le password en hash courrant et
dans la version ntlm"""
...
...
users/templates/users/email_auto_newmachine
0 → 100644
View file @
0efe0c27
<p>Bonjour {{nom}} </p>
<p>Une nouvelle machine a automatiquement été inscrite sur votre compte.</p>
<p>Si vous êtes à l'origine de la connexion de cet appareil en filaire ou wifi, ne tenez pas compte de cette notification</p>
<p>La nouvelle machine possède l'adresse mac {{ mac_address }}, et s'est vu assigner le nom suivant : {{ interface_name }}</p>
<p>Vous pouvez à tout moment modifier ces informations sur votre compte en ligne</p>
<p>Si vous n'êtes pas à l'origine de cette connexion, merci de le signaler rapidement à {{asso_email}}</p>
<p>À bientôt,<br>
L'équipe de {{asso_name}}.</p>
<p>---</p>
<p>A new device has been automatically added on your account.</p>
<p>If you connected a new device recently, please don't take this mail into account<p>
<p>The new device has this mac address : {{ mac_address }}, and this name : {{ interface_name }}</p>
<p>Please contact us if you didn't connect a new device with this mail address {{asso_email}}.</p>
<p>Regards,<br>
The {{asso_name}} team.</p>
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