initial.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Tktr 作者: Intuity 项目源码 文件源码
def setup_two_view(self):
        if (PROP.getProperty(self.request, PROP.SITE_SETUP) == True):
            return HTTPFound(location=self.request.route_path("welcome"))
        elif (PROP.getProperty(self.request, PROP.VERSION) == None):
            return HTTPFound(location=self.request.route_path("setup_stageone"))
        # Check if the password has already been changed, default is 'password'
        admin_usr = self.request.root.users["admin"]
        test_password = salt_password("password", admin_usr.password_salt)
        if test_password != admin_usr.password:
            self.request.session.flash("It looks like someone has already changed the default password on the account, if this wasn't you then contact support!", "info")
            return HTTPFound(location=self.request.route_path("setup_stagethree"))
        # Get password for admin user and double check
        if "password_one" in self.request.POST and  "password_two" in self.request.POST:
            pwd_1 = self.request.POST["password_one"]
            pwd_2 = self.request.POST["password_two"]
            if len(pwd_1) < 5:
                self.request.session.flash("The passwords entered are too short, they must be of 5 characters or longer.", "error")
                return {}
            elif pwd_1 != pwd_2:
                self.request.session.flash("The passwords entered do not match.", "error")
                return {}
            # Set the administrator password
            admin_usr.password_salt = Coding().generateUniqueCode()
            admin_usr.password = salt_password(pwd_1, admin_usr.password_salt)
            return HTTPFound(location=self.request.route_path("setup_stagethree"))
        return {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号