Пример #1
0
def login(request):
    if pub.HasPostData(request,"ok"):
        username=pub.GetPostData(request,"username")
        password=pub.GetPostData(request,"password")

        user=auth.authenticate(username=username,password=password)
        if user is not None:
            userProfile=user.get_profile()
            try:
                userProfile=user.get_profile()
            except:
                createUserProfile(user)
            try:
                blog=Blog.objects.get(id=user.id)
            except:
                from UUBlog.apps.blog.views import viewblog
                viewblog.createBlog(user)

            if user.is_active:
                auth.login(request,user)
                return HttpResponseRedirect('/')
            else:
                return HttpResponseRedirect('')
        else:
            return HttpResponseRedirect('')
    else:
        return pub.my_render_to_response(request,"accounts/login.html",locals())
Пример #2
0
def register(request):
    if pub.HasPostData(request,"ok"):
        username=pub.GetPostData(request,"username")
        password=pub.GetPostData(request,"password")
        email=pub.GetPostData(request,"email")

        user=User.objects.create_user(username,email,password)
        user.first_name=username
        user.save()

        createUserProfile(user)

        from UUBlog.apps.blog.views import viewblog
        viewblog.createBlog(user)

        return HttpResponseRedirect('/')
    else:
        return pub.my_render_to_response(request,"accounts/register.html",locals())
Пример #3
0
    def PostContext(self, **kwargs):
        uid=int(kwargs.get("uid",0))

        if self.HasPostData("ok"):
            username=self.GetPostData("username")
            password=self.GetPostData("password")
            email=self.GetPostData("email")

            user=User.objects.create_user(username,email,password)
            user.first_name=username
            user.save()

            profile=UserProfile(user=user)
            profile.nickname=user.username
            profile.save()

            from UUBlog.apps.blog.views import viewblog
            viewblog.createBlog(user)

        self.returnUrl="/"

        return locals()
Пример #4
0
    def PostContext(self, **kwargs):
        uid = int(kwargs.get("uid", 0))

        if self.HasPostData("ok"):
            username = self.GetPostData("username")
            password = self.GetPostData("password")
            email = self.GetPostData("email")

            user = User.objects.create_user(username, email, password)
            user.first_name = username
            user.save()

            profile = UserProfile(user=user)
            profile.nickname = user.username
            profile.save()

            from UUBlog.apps.blog.views import viewblog
            viewblog.createBlog(user)

        self.returnUrl = "/"

        return locals()