summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--py-bin/jabberman.py29
1 files changed, 9 insertions, 20 deletions
diff --git a/py-bin/jabberman.py b/py-bin/jabberman.py
index fd131da..d3dac25 100644
--- a/py-bin/jabberman.py
+++ b/py-bin/jabberman.py
@@ -2,7 +2,6 @@
import shelve, sqlite3, atexit, bcrypt, sha, hmac, random, os, time, re, datetime, string
import config
-from ejabberdctl import EJabberdCtl
class JabberUserOld:
def __init__(self, user_id):
@@ -397,7 +396,6 @@ class JabberManager:
self.jadb = JabberDB()
self.session = session
self.current_user, self.authenticated = None, False
- self.ejctl = EJabberdCtl()
def get_user(self):
return self.current_user
@@ -478,7 +476,7 @@ class JabberManager:
self.__clear_session()
return (False, status_or_user)
- ok, status = self.add_account(self.current_user.get_default_jabber_id())
+ ok, status = self.add_account(self.current_user.get_primary_jid())
if not ok:
#todo: handle this smarter somehow
return (False, status)
@@ -489,7 +487,7 @@ class JabberManager:
if not self.authenticated:
return (False, "Zugriff verweigert.")
- user_id = self.current_user.get_user_id()
+ user_id = self.current_user.email
ok, status = self.jadb.change_password(user_id, password)
if ok:
self.__set_session(user_id, password = password)
@@ -499,9 +497,9 @@ class JabberManager:
for jabber_id in self.current_user.get_account_list():
acc = JabberAccount(jabber_id)
- if not self.ejctl.change_password(acc.user, acc.server, password):
- msg = "Konnte Jaber Passwort fuer %s nicht setzen." % acc.get_jabber_id()
- return (False, msg)
+ #if not self.ejctl.change_password(acc.user, acc.server, password):
+ # msg = "Konnte Jaber Passwort fuer %s nicht setzen." % acc.get_jabber_id()
+ # return (False, msg)
return (True, "Passwort erfolgreich geaendert.")
@@ -528,16 +526,11 @@ class JabberManager:
except Exception:
return (False, "Zugriff verweigert.")
- user_id = self.current_user.get_user_id()
- ok, status = self.jadb.add_account(user_id, jabber_id, check_only = True)
+ ok, status = self.jadb.add_account(self.current_user.email, jabber_id, self.session["pass"], check_only = True)
if not ok:
return (False, status)
- if not self.ejctl.create_account(acc.user, acc.server, password):
- return (False, "Konnte Konto %s nicht erstellen." % acc.get_jabber_id())
-
- user_id = self.current_user.get_user_id()
- return self.jadb.add_account(user_id, jabber_id)
+ return self.jadb.add_account(self.current_user.email, jabber_id, self.session["pass"])
def remove_account(self, jabber_id):
if not self.authenticated:
@@ -547,18 +540,14 @@ class JabberManager:
if not ok:
return (False, "Zugriff verweigert.")
- user_id = self.current_user.get_user_id()
- if jabber_id == self.current_user.get_default_jabber_id():
+ user_id = self.current_user.email
+ if jabber_id == self.current_user.get_primary_jid():
return (False, "Hauptkonto darf nicht geloescht werden!")
ok, status = self.jadb.remove_account(user_id, jabber_id, check_only = True)
if not ok:
return (False, status)
- acc = JabberAccount(jabber_id)
- if not self.ejctl.remove_account(acc.user, acc.server):
- return (False, "Konnte Konto %s nicht loeschen." % acc.get_jabber_id())
-
return self.jadb.remove_account(user_id, jabber_id)
def __set_session(self, user_id, password = None, token = None):