Beispiel #1
0
    def changeColors(self, color, AccSettingsPopup=None):
        if (color == "Green"):
            self.realColor = "SeaGreen3"
        if (color == "Blue"):
            self.realColor = "RoyalBlue3"
        if (color == "Red"):
            self.realColor = "red3"
        if (color == "Orange"):
            self.realColor = "DarkOrange1"

        if (AccSettingsPopup != None):
            AccSettingsPopup.window.config(background=self.realColor)
            AccSettingsPopup.errLabel.config(background=self.realColor)
            AccSettingsPopup.themeInstruction.config(background=self.realColor)
            AccSettingsPopup.textInstruction.config(background=self.realColor)
            AccSettingsPopup.confirmInstruction.config(
                background=self.realColor)
            AccSettingsPopup.passInstruction.config(background=self.realColor)
            AccSettingsPopup.emailInstruction.config(background=self.realColor)
            AccSettingsPopup.userInstruction.config(background=self.realColor)
            AccSettingsPopup.oldPassLabel.config(background=self.realColor)
            AccSettingsPopup.title.config(background=self.realColor)
            AccSettingsPopup.themeDropDown.config(
                highlightbackground=self.realColor)
            AccSettingsPopup.theDropDown.config(
                highlightbackground=self.realColor)

        self.page.config(background=self.realColor)
        self.page.messages.config(background=self.realColor)
        self.page.inputFrame.config(background=self.realColor)
        self.page.groups.config(background=self.realColor)
        self.page.groupListLabel.config(background=self.realColor)
        self.page.knuthKonnectionsLabel.config(background=self.realColor)
        self.page.groupListFrame.config(background=self.realColor)
        self.page.groupNameFrame.config(background=self.realColor)
        #self.page.groupName.config(background=self.realColor)
        self.page.settingsFrame.config(background=self.realColor)

        userDB.update_user_info(color, 'theme', self.currentUser.id)
Beispiel #2
0
 def Textbg(self, AccSettingsPopup):
     self.currentUser.textbg = AccSettingsPopup.defaultV.get()
     userDB.update_user_info(AccSettingsPopup.defaultV.get(), 'textbg',
                             self.currentUser.id)
     self.currentUser = userDB.load_user_info(None, self.currentUser.id,
                                              'user_id')
Beispiel #3
0
    def retrieveUserInfo(self):
        valid_email = userDB.check_valid_email(self.page.email_entry.get())

        if (valid_email == False):
            self.page.mlabel.config(
                text="Invalid E-Mail format!\nPlease check your entry.",
                foreground="red")
            return

        else:
            tempUser = userDB.forgot_user_info(self.page.email_entry.get())
            self.newpass = ""

            if (tempUser is not None):
                full_username_label = "Username: "******""
                        or self.page.Pass_reentry.get() == ""
                        or self.page.Pass_entry.get() == "Choose a Password" or
                        self.page.Pass_reentry.get() == "Re-Enter Password"):
                    self.page.mlabel.config(
                        text="Please do not leave the\npassword fields blank.")
                    return

                if (userDB.check_valid_password(
                        self.page.Pass_entry.get()) == 0):
                    self.page.mlabel.config(
                        text="Password must be at least 7 characters!")
                    return

                elif (userDB.check_valid_password(
                        self.page.Pass_entry.get()) == 1):
                    self.page.mlabel.config(
                        text="Password must contain at least (1) digit.")
                    return

                elif (userDB.check_valid_password(
                        self.page.Pass_entry.get()) == 2):
                    self.page.mlabel.config(
                        text=
                        "Password must contain at least (1)\nuppercase character"
                    )
                    return

                elif (userDB.check_valid_password(
                        self.page.Pass_entry.get()) == 3):
                    self.page.mlabel.config(
                        text=
                        "Password must contain at least (1)\nspecial character(!#$%&'()*+,-./[\\\]^_`{|}~)"
                    )
                    return

                if (self.page.Pass_entry.get() !=
                        self.page.Pass_reentry.get()):
                    self.page.mlabel.config(text="Passwords do not match!")
                    return

                self.newpass = self.page.Pass_entry.get()
                userDB.update_user_info(self.newpass, 'password', tempUser.id)
                self.page.mlabel.config(
                    text="User information changed successfully",
                    foreground="green")
                return

            else:
                self.page.usernamelabel.config(text="")
                self.page.mlabel.config(
                    text="E-mail not currently registered!")
                return
Beispiel #4
0
    def changeUserAndPass(self, AccSettingsPopup):
        self.accSettingsOpen.errLabel.config(text="", foreground="red")
        self.newuser = ""
        self.newpass = ""
        self.newemail = ""
        self.olduser = self.currentUser.name
        self.oldemail = self.currentUser.email
        self.oldpass = AccSettingsPopup.oldPassEntry.get()
        self.currentID = self.currentUser.id

        #Check for valid password, if it is valid, we can change settings
        if (userDB.login_user(self.currentUser.name, self.oldpass) == 2):
            self.accSettingsOpen.errLabel.config(text="Invalid Password!")
            return
        else:
            # Check new password input
            if AccSettingsPopup.changePasswordInput.get() != "":
                if AccSettingsPopup.confirmPasswordInput.get(
                ) != AccSettingsPopup.changePasswordInput.get():
                    self.accSettingsOpen.errLabel.config(
                        text="New Password does not match confirmation")
                    return
                else:
                    #if new passwords match, set newpass
                    self.newpass = AccSettingsPopup.changePasswordInput.get()
                    self.accSettingsOpen.errLabel.config(
                        text="Settings Changed", foreground="green")
                    userDB.update_user_info(self.newpass, 'password',
                                            self.currentUser.id)
                    self.currentUser = userDB.load_user_info(
                        None, self.currentUser.id, 'user_id')

            # Check new email input
            if AccSettingsPopup.changeEmailInput.get() != "":
                self.newemail = AccSettingsPopup.changeEmailInput.get()

                if (self.newemail == self.oldemail):
                    self.accSettingsOpen.errLabel.config(
                        text="E-Mail unchanged", foreground="yellow")
                if (userDB.check_valid_email(self.newemail) == None):
                    self.accSettingsOpen.errLabel.config(
                        text="E-Mail already registered", foreground="green")
                    return
                elif (userDB.check_valid_email(self.newemail) == True):
                    userDB.update_user_info(self.newemail, 'email',
                                            self.currentUser.id)
                    #self.currentUser = userDB.load_user_info(None, self.currentUser.id[0], 'user_id')
                else:
                    self.accSettingsOpen.errLabel.config(
                        text="Invalid or already registered E-Mail Address.")
                    return

            #Check username input
            if AccSettingsPopup.changeUserNameInput.get() != "":
                self.newuser = AccSettingsPopup.changeUserNameInput.get()

                if (self.newuser == self.olduser):
                    self.accSettingsOpen.errLabel.config(
                        text="Username unchanged", foreground="yellow")
                    return

                if (userDB.checkAccExistence(self.newuser, 'username')
                    ):  #if the new username is already registered
                    self.accSettingsOpen.errLabel.config(
                        text=
                        "Username is already taken.\nPlease choose a different username"
                    )
                    return

                userDB.update_user_info(self.newuser, 'username',
                                        self.currentUser.id, self.olduser)
                self.accSettingsOpen.errLabel.config(text="Settings Changed",
                                                     foreground="green")
                Client.updateAllGroupMembers(self, self,
                                             self.currentUser.friends)

        #Call changes with updated information
        self.currentUser = userDB.load_user_info(None, self.currentUser.id,
                                                 'user_id')