def reset_password(self):
        """At this stage we're trying to get our players back. If they decided 
        to add an e-mail to their character, we will send them a code and they
        can reset it, and they will go to a state to confirm their code. If not,
        they are out of luck, but they can still log on as another character.

        PREV STATE: self.verify_password
        NEXT STATE: self.verify_playername
        """
        self.state = self.get_input
        player_email = self.world.db.select('email,name FROM player WHERE dbid=?', [self.dbid])[0]['email']
        if not player_email:
            self.player.update_output(CLEAR + 'You do not have an e-mail associated with this character. ' +
            'You will need to contact someone with super admin privileges to reset your password.')
            self.player.update_output(['', 'Until then you can log on with another character if you like: '])
            self.next_state = self.verify_playername
            return
        try:
            if not EMAIL_ENABLED:
                raise Exception("%s email is not configured! %s could not reset their password!" %
                                                         (GAME_NAME, self.player.name))
            self.conf_code = random.randint(99999, 1000000)
            subject = '%s Password Reset' % GAME_NAME
            message = 'Hello %s, \n\nYou have recently requested a password reset. ' % self.playername
            message += 'Please enter the code below into your game prompt to reset your password.\n '
            message += 'Code: %s\n\nThanks, \n\n\n\n%s' % (self.conf_code, GAME_NAME)
            mail = ShinyMail([player_email], subject, message)
            mail.send()
            self.player.update_output(CLEAR + 'An e-mail has been sent to %s with a six digit number inside.' %
                                                                             player_email)
            self.player.update_output('Copy the code here to continue: ')
            self.next_state = self.confirm_code
            return
        except Exception, e:
            #We had a problem sending email! Most likely, we don't have email set up in the config.py file
            self.player.update_output(CLEAR + 'We were unable to send an e-mail to %s. ' % player_email)
            self.player.update_output('This could be a problem with our internal e-mail sender.' + \
            'Please contact the administrator of the game. We\'re sorry for the inconvenience.')
            self.player.update_output(['', 'You can log in with another player if you like: '])
            self.log.error("Password email reset Fail: " + str(e))
            self.next_state = self.verify_playername
dataset/ETHPy150Open shinymud/ShinyMUD/src/shinymud/modes/init_mode.py/InitMode.reset_password/original