Example #1
0
def reset_password(self, widget, data=None):
    """
    Reset user's password. Let them provide a new one on next access.
    """
    message = "This will reset your password. Are you sure?"
    dialog = gtk.MessageDialog(
        None,
        gtk.DIALOG_MODAL,
        gtk.MESSAGE_QUESTION,
        gtk.BUTTONS_YES_NO,
        message)
    response = dialog.run()
    dialog.destroy()
    
    if response == gtk.RESPONSE_YES:
        from settings import db, app
        from models import Account, Session
        
        ctx = app.test_request_context()
        ctx.push()
        account = Account.query and Account.query.first()
        if account:
            db.session.delete(account)
            db.session.commit()
            
        sessions = Session.query and Session.query.all()
        if sessions:
            for session in sessions:
                db.session.delete(session)
            db.session.commit()
            
        ctx.pop()
        
        if hasattr(self, 'server_pid') and self.server_pid:
            webbrowser.open("http://%s:%s/logout" % (DOMAIN, self.server_port))
Example #2
0
def resetPassword_(self,notification):
    #message = "This will reset your password. Are you sure?"
    #response = win32ui.MessageBox(
    #        message,
    #        "MyVault",
    #        win32con.MB_YESNO)
    #if response == win32con.IDYES:
    #doTest()
    try:
        from settings import db, app
        from models import Account, Session
        
        ctx = app.test_request_context()
        ctx.push()
        account = Account.query and Account.query.first()
        if account:
            db.session.delete(account)
            db.session.commit()
            
        sessions = Session.query and Session.query.all()
        if sessions:
            for session in sessions:
                db.session.delete(session)
            db.session.commit()
            
        ctx.pop()
        
        if hasattr(self, 'server_pid') and self.server_pid:
            webbrowser.open("http://%s:%s/logout" % (HOST, self.server_port))
    except:
        pass