예제 #1
0
 def enter(self,t,e_id,passwd):
     # login Button will call this and destroy ist frame
     global log_id
     if con.login(e_id,passwd):
         log_id = e_id
         self.bframe.destroy(),
         optionbar(t)
     else :
         mbox.showinfo("Message", "Incorrect Password or email_id")
예제 #2
0
    def _init_ui_(self):
        self.setWindowTitle('Mima (PyQt5)')
        homeTab_homeTableView_width = 80+150+200+200+100
        margin = 60
        self.setGeometry(
            200,
            200,
            homeTab_homeTableView_width + margin,
            600
        )

        # Central Widget
        centralWidget = QWidget()
        vbox = QVBoxLayout()
        tabWidget = QTabWidget()
        vbox.addWidget(tabWidget)
        centralWidget.setLayout(vbox)
        self.setCentralWidget(centralWidget)

        self.homeTab = HomeTab(tabWidget)
        tabWidget.addTab(self.homeTab, 'Home')

        self.recycleBinTab = RecycleBinTab()
        tabWidget.addTab(self.recycleBinTab, 'Recycle Bin')

        self.homeTab.set_recyclebin_model(self.recycleBinTab.model)
        self.recycleBinTab.set_hometable_model(self.homeTab.model)

        autoCloseTab = AutoLockTab(tabWidget)
        tabWidget.addTab(autoCloseTab, 'Auto Lock')
        self.homeTab.set_autoclose_tab(autoCloseTab)

        aboutTab = AboutTab()
        tabWidget.addTab(aboutTab, 'About')

        self.show()
        secretbox = connection.login(self, cancelToQuit=True)
        if secretbox:
            MimaBox.secretbox = secretbox
            connection.populate_temp_tables()
            self.homeTab.model.submitAll()
            self.recycleBinTab.model.submitAll()
            autoCloseTab.start_timer()
            self.homeTab.searchEdit.setFocus()
예제 #3
0
    from utils import create_log, generate_hash, show_404

    config = configparser.ConfigParser()
    config.read('constants.cnf')
    cgitb.enable()
    form = cgi.FieldStorage()
    header = dict()
    header["title"] = "Activate"
    header["homeUrl"] = "http://localhost/register.py"
    header[
        "navTopRight"] = '<li class="active"><a href="http://localhost/register.py">Register Now</a></li>'
    header["css_version"] = config.get("version", "css")
    footer = {"js_version": config.get("version", "css")}
    email = form.getvalue("email")
    value = form.getvalue("value")
    active = login(email)["active"]
    email_hash = generate_hash(email)

    if os.environ['REQUEST_METHOD'] == 'GET':
        print("Content-type: text/html\n")
        f = open('./template/header.html', encoding='utf-8')
        print(f.read() % header)
        f.close()
        if value == email_hash and not active:
            activate(email)
            print(
                "<p>Your account has been activated. Please log in with the password assigned to you</p>"
            )
        elif active:
            print(
                "<p>Your account was already activated. Please log in with the password assigned to you</p>"
예제 #4
0
import praw
import prawcore
import yaml

import artemis_stats
import connection
import database
import timekeeping
from common import logger
from settings import AUTH, FILE_ADDRESS, SETTINGS, SOURCE_FOLDER
"""LOGGING IN"""

USER_AGENT = "Artemis Monitor, a service routine for this account."

connection.login(posts_frequency=False)
reddit = connection.reddit
reddit_helper = connection.reddit_helper
reddit_monitor = praw.Reddit(client_id=AUTH.monitor_app_id,
                             client_secret=AUTH.monitor_app_secret,
                             password=AUTH.monitor_password,
                             user_agent=USER_AGENT,
                             username=AUTH.monitor_username)
"""MONITOR FUNCTIONS"""


def monitor_seconds_till_next_hour():
    """Function to determine seconds until the next hour to act.
    The monitor uses this time to wait for that period, thus
    running itself at the same time each hour.
예제 #5
0
 def unlock(self):
     if connection.login(self):
         self.reset_timer()
         self.toggle_buttons_enabled()
         self.parent.setTabEnabled(0, True)
         self.parent.setTabEnabled(1, True)
예제 #6
0
        if current_user:
            print("Location: http://localhost/edit_profile.py\n")
        else:
            print("Content-type: text/html\n")
            f = open('./template/header.html', encoding='utf-8')
            print(f.read() % header)
            f.close()
            f = open('./template/login.html')
            print(f.read())
            f.close()
            f = open('./template/footer.html', encoding="utf_8")
            print(f.read() % footer)
            f.close()
    elif os.environ['REQUEST_METHOD'] == 'POST':
        form_email = form.getvalue('email')
        form_password = form.getvalue('password')
        user = login(form_email)

        if user:
            if user["password"] == form_password:
                session.session(user)
            else:
                print("Location: http://localhost/edit_profile.py\n")
                print('Check the password')
        else:
            print("Location: http://localhost/edit_profile.py\n")
            print('Check the username')
except Exception as e:
    create_log("Login.py : " + str(e))
    show_404()
예제 #7
0
    -p PASSWORD --password PASSWORD     Enter password , leave this password flag to enter password in secure way

"""
arguments = docopt(program_doc, version='Reading Steiner 1.0.0')

# print(type(arguments))
# print(arguments)

#Handing login / register
username = arguments['<username>'] or arguments['--username']
password = arguments['<password>'] or arguments['--password']
isNewUser = False

if not username:
    isNewUser = input("New user? (y/n) : ")
    isNewUser = (isNewUser == 'y')

if not isNewUser:
    data = connection.login(username, password)
    # print(data)
    if data:
        sketch.init(data)
        # print(sketch.session.headers)
        # print(sketch.session.request.headers)
        sketch.welcome()
    else:
        print("Login failed")
else:
    connection.create_account()
    pass
예제 #8
0
        print(difference / len(posts_new))
        differences.append(difference / len(posts_new))

    print(
        "Average = New comment every {:.2f} seconds.".format(sum(differences) / len(differences))
    )
    # Sort the posts by oldest first.
    comments_all.sort(key=lambda x: x.id.lower())

    return


# The main runtime if the module itself is called.
# */20 * * * *
if __name__ == "__main__":
    # Log into Reddit.
    start_time = time.time()
    logger.info("Stream: Beginning fetch.")
    connection.login(False, 0)
    reddit = connection.reddit
    logger.info("Stream: Logging in as u/{}.".format(reddit.user.me()))
    reddit_helper = connection.reddit_helper

    # Run the proper functions.
    get_streamed_posts(SETTINGS.stream_pull_amount)
    # get_streamed_comments()
    integrity_check()
    CONN_STREAM.close()
    elapsed = (time.time() - start_time) / 60
    logger.info("Stream: Ended fetch. Elapsed time: {:.2f} minutes.".format(elapsed))