ajout edition wifi
This commit is contained in:
parent
815bc9ff45
commit
5ecf9f0ac5
@ -73,9 +73,14 @@ class WifiRestController(AuthenticatedRestController):
|
|||||||
|
|
||||||
if member is None:
|
if member is None:
|
||||||
self.show.error_no_entry()
|
self.show.error_no_entry()
|
||||||
|
|
||||||
|
return { "member_ldap" : member }
|
||||||
|
#end def
|
||||||
|
|
||||||
|
|
||||||
|
@expose("brie.templates.edit.wifi")
|
||||||
def post(self, uid, password):
|
def post(self, uid, password):
|
||||||
|
|
||||||
member = Member.get_by_uid(self.user, uid)
|
member = Member.get_by_uid(self.user, uid)
|
||||||
|
|
||||||
if member is None:
|
if member is None:
|
||||||
@ -87,9 +92,7 @@ class WifiRestController(AuthenticatedRestController):
|
|||||||
wifi_dn = "cn=wifi," + member.dn
|
wifi_dn = "cn=wifi," + member.dn
|
||||||
self.user.ldap_bind.add_entry(wifi_dn, Wifi.entry_attr(password))
|
self.user.ldap_bind.add_entry(wifi_dn, Wifi.entry_attr(password))
|
||||||
else:
|
else:
|
||||||
attr = {
|
attr = Wifi.password_attr(password)
|
||||||
"userPassword" : password
|
|
||||||
}
|
|
||||||
self.user.ldap_bind.replace_attr(wifi.dn, attr)
|
self.user.ldap_bind.replace_attr(wifi.dn, attr)
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
|
@ -64,13 +64,20 @@ class Wifi(object):
|
|||||||
return {
|
return {
|
||||||
"objectClass" : ["top", "organizationalRole", "simpleSecurityObject"],
|
"objectClass" : ["top", "organizationalRole", "simpleSecurityObject"],
|
||||||
"cn" : "wifi",
|
"cn" : "wifi",
|
||||||
"userPassword" : password
|
"userPassword" : str(password)
|
||||||
|
}
|
||||||
|
#end def
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def password_attr(password):
|
||||||
|
return {
|
||||||
|
"userPassword" : str(password)
|
||||||
}
|
}
|
||||||
#end def
|
#end def
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_by_dn(user_session, dn):
|
def get_by_dn(user_session, dn):
|
||||||
return user_session.ldap_bind.search_first("cn=wifi," + dn)
|
return user_session.ldap_bind.search_dn("cn=wifi," + dn)
|
||||||
#end def
|
#end def
|
||||||
|
|
||||||
#end class
|
#end class
|
||||||
|
@ -8,7 +8,8 @@ a {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover, input[type="button"]
|
||||||
|
{
|
||||||
color: white;
|
color: white;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
@ -36,3 +37,16 @@ a:hover {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: #e0e0e0;
|
background-color: #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link_button {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"]
|
||||||
|
{
|
||||||
|
border: none;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
|
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
|
||||||
|
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/auth/login" method="post">
|
<div class="section">
|
||||||
<p class="error">${error}</p>
|
<span class="section_name show_section_name">CONNEXION</span>
|
||||||
<div>
|
<form action="/auth/login" method="post">
|
||||||
<span>Nom d'utilisateur</span>
|
<p class="error">${error}</p>
|
||||||
<input name="username" type="text" value="${login}" />
|
<div>
|
||||||
</div>
|
<span class="item_name">Utilisateur</span>
|
||||||
<div>
|
<input name="username" type="text" value="${login}" />
|
||||||
<span>Nom d'utilisateur</span>
|
</div>
|
||||||
<input name="password" type="password" />
|
<div>
|
||||||
</div>
|
<span class="item_name">Mot de passe</span>
|
||||||
<input type="submit" value="connexion"/>
|
<input name="password" type="password" />
|
||||||
</form>
|
</div>
|
||||||
|
<input type="submit" value="SOUMETTRE"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
28
Brie/brie/templates/edit/wifi.html
Normal file
28
Brie/brie/templates/edit/wifi.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<html
|
||||||
|
xmlns:py="http://genshi.edgewall.org/"
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
<xi:include href="member_room_interface_edit_views.html" />
|
||||||
|
<head>
|
||||||
|
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
|
||||||
|
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
|
||||||
|
<link type="text/css" rel="Stylesheet" href="/css/edit.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
${edit_banner()}
|
||||||
|
${back_show("member", member_ldap.uid.first())}
|
||||||
|
<div class="section">
|
||||||
|
<span class="section_name show_section_name">WIFI :: ${member_ldap.cn.first()}</span>
|
||||||
|
<form action="/edit/wifi/${member_ldap.uid.first()}" method="POST">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="uid" value="${member_ldap.uid.first()}" />
|
||||||
|
<span class="item_name">Mot de passe</span>
|
||||||
|
<input type="password" name="password" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="submit" value="ENREGISTRER" class="button"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -47,6 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="item_name">Wifi</span>
|
<span class="item_name">Wifi</span>
|
||||||
|
<span><a href="/edit/wifi/${member_ldap.uid.first()}" class="link_button">mot de passe</a></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user