Re: Django Login Problem

2020-03-29 Thread ramadhan ngallen
Why your templates shows some of the codes like {% csrf_token %}, for loops  
and so on? Check your templates first are not okay.
After signup log in to the admin panel as an admin and check if the user has 
been created on the database. You can also log in to your database to inspect 
this.

Does your app name called "app"? If so kindly on project ulrs change to
url(r'^',include(app.urls)), instead of
url(r'^',include(appurls))

And on app.urls add this
app_name ="app"
This is how name spacing on django work
On 29 Mar 2020, 16:55 +0300, Antje Kazimiers , wrote:
> Hi,
>
> It sounds like you don't get an error message, so maybe your authenticate 
> method in
>
> def sign_in(request)
>
> just returns a None user and you get redirected. I would find this method in 
> your django installation, for me it's in the env folder but that depends on 
> your setup:
>
> ./env/lib/python3.7/site-packages/django/contrib/auth/__init__.py
>
> and debug into it or add some print statements to see why this is failing.
>
> Antje
>
> > On 29. Mar 2020, at 10:33, pratiksha jain  
> > wrote:
> >
> > I have problem in loging in after signing up. I have tried all the methods 
> > that I can try, I want to know my errors.
> > Thank you
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to django-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/f542af27-682f-4528-b1e8-70acfc6c8e1e%40googlegroups.com.
> > 
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/820B2E17-AB07-4F17-9117-88D1AD3B7ED4%40gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/77ead107-a8dd-4462-b043-a52db4b4912c%40Spark.


Re: Django Login Problem

2020-03-29 Thread Antje Kazimiers
Hi,

It sounds like you don't get an error message, so maybe your authenticate 
method in

def sign_in(request)

just returns a None user and you get redirected. I would find this method in 
your django installation, for me it's in the env folder but that depends on 
your setup:

./env/lib/python3.7/site-packages/django/contrib/auth/__init__.py

and debug into it or add some print statements to see why this is failing.

Antje

> On 29. Mar 2020, at 10:33, pratiksha jain  wrote:
> 
> I have problem in loging in after signing up. I have tried all the methods 
> that I can try, I want to know my errors.
> Thank you
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/f542af27-682f-4528-b1e8-70acfc6c8e1e%40googlegroups.com
>  
> .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/820B2E17-AB07-4F17-9117-88D1AD3B7ED4%40gmail.com.


Django Login Problem

2020-03-29 Thread pratiksha jain
I have problem in loging in after signing up. I have tried all the methods 
that I can try, I want to know my errors.
Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f542af27-682f-4528-b1e8-70acfc6c8e1e%40googlegroups.com.







Message board


Sign Up
{% if user_login == False %}
Log In
{% else %}
Log Out
Logged in as {{user.username}}
{% endif %}








Sign Up!



{% csrf_token %}
 Enter a username: 


Enter a Password: 














Message board


Sign Up
{% if user_login == False %}
Log In
{% else %}
Log Out
Logged in as {{user.username}}
{% endif %}










Signup Complete!
Return to message board 












Message board


Sign Up
{% if user_login == False %}
Log In
{% else %}
Log Out
Logged in as {{user.username}}
{% endif %}









{{topic.title}}

{% for post in posts %}

{{post.content}}

Post By:
{{post.author.username}}

{% if post in user.post_set.all %}

{% csrf_token %}



{% endif %}


{% endfor %}

{% if user_login == True %}
Add New Post
{% endif %}






Add a Post


{% csrf_token %}
Post:






















Message Board


Sign Up
   {% if user_login == False %}
Log In
{% else %}-->

Log Out
Logged in as {{user.username}}
{% endif %}


  




Board Topics

{% for topic in topics %}

{{topic.title}}
View Posts

{% endfor %}
{% if user_login == True %}
Create New Topic
{% endif %}
 

  

  Login a User


{% csrf_token %}

Username:



  


  

  






New Topic


{% csrf_token %}
 Topic Name:








  
from django.conf.urls import url
from . import views


urlpatterns = [
	
	
   	url(r'^signin/$', views.sign_in, name = "signin"),
   	url(r'^$', views.index, name = "main"),
url(r'^logout/$', views.logout_view, name = "logout"),
url(r'^new_topic/$', views.new_topic, name = "new-topic"),
url(r'topic/(?P\d+)/$', views.topic_detail, name = "topic-detail"),
url(r'^add_post/$', views.add_post, name ="add-post"),
url(r'^delete_post/$', views.delete_post, na

Re: Admin login problem

2020-02-26 Thread Naveen Arora
Share all of the code related to this model what you have overriden from 
nodel to admin registeration part also. Also check through terminal if 
superuser has been created successfully.
Did you override something related to login part too..?
Share code please. 

On Wednesday, 26 February 2020 17:57:19 UTC+5:30, Soumen Khatua wrote:
>
> Yes I'm using custom user model and I already added user.is_admin=True. 
> But still I'm getting the same error.
> I attached the code snippet as well as error message also. 
>
>
>
> On Wed 26 Feb, 2020, 5:47 PM Naveen Arora,  > wrote:
>
>> Hi soumen, 
>>
>> Are you overriding default user model,  if yes check user.is_admin=True.
>> or else, Please post the exact error
>>
>> Cheers
>> Naveen Arora
>> On Wednesday, 26 February 2020 17:43:51 UTC+5:30, Soumen Khatua wrote:
>>>
>>> Hi Folks,
>>> after creating superuser by using this command python manage.py 
>>> createsuperuser. Whenever I'm entering the same(exact) login 
>>> credentials.I'm getting this error:
>>> Please enter the correct phone number and password for a staff 
>>> account. Notethat both fields may be case-sensitive .
>>>
>>> But don't why i'm getting this error message.
>>>
>>>
>>> Thank you in advance
>>>
>>> Regards,
>>> Soumen
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/7f3894dd-6fd2-455a-975a-2f03f5041c16%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4da4d212-7360-43bb-8e94-db1ee31d1f9f%40googlegroups.com.


Re: Admin login problem

2020-02-26 Thread Naveen Arora
Hi soumen, 

Are you overriding default user model,  if yes check user.is_admin=True.
or else, Please post the exact error

Cheers
Naveen Arora
On Wednesday, 26 February 2020 17:43:51 UTC+5:30, Soumen Khatua wrote:
>
> Hi Folks,
> after creating superuser by using this command python manage.py 
> createsuperuser. Whenever I'm entering the same(exact) login 
> credentials.I'm getting this error:
> Please enter the correct phone number and password for a staff 
> account. Notethat both fields may be case-sensitive .
>
> But don't why i'm getting this error message.
>
>
> Thank you in advance
>
> Regards,
> Soumen
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f3894dd-6fd2-455a-975a-2f03f5041c16%40googlegroups.com.


Admin login problem

2020-02-26 Thread Soumen Khatua
Hi Folks,
after creating superuser by using this command python manage.py
createsuperuser. Whenever I'm entering the same(exact) login
credentials.I'm getting this error:
Please enter the correct phone number and password for a staff account.
Notethat both fields may be case-sensitive .

But don't why i'm getting this error message.


Thank you in advance

Regards,
Soumen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYP-TBzvcgikd4%2BnrGVFstS0cC_dDf1RndheayTZ_2o5g%40mail.gmail.com.


Re: Simple Login Problem

2014-11-30 Thread Rootz
Apparently caching was enable. Now that I know I disable caching and now it 
is working now..
thanks :)

On Sunday, November 30, 2014 1:32:27 PM UTC-5, Collin Anderson wrote:
>
> Hi,
>
> If you type your password wrong, user will be None, and your code will 
> then redirect to the "register" page.
>
> If you press "back" after a successful login, the CSRF token will be out 
> of date and the form won't work.
>
> Are you caching any pages?
>
> Collin
>
> On Friday, November 28, 2014 12:55:35 AM UTC-5, Rootz wrote:
>>
>> I have a django app but I having problems with my login views and logout 
>> views. I do not have a html template designated to handle user login/logout 
>> view.
>> Django project is configured as follows:
>>
>> INSTALLED_APPS 
>> 
>>  setting:
>>
>>1. 'django.contrib.auth' contains the core of the authentication 
>>framework, and its default models.
>>2. 'django.contrib.contenttypes' is the Django *content type system* 
>>, 
>>which allows permissions to be associated with models you create.
>>3. 'django.contrib.sessions',
>>
>>  MIDDLEWARE_CLASSES 
>> 
>>  setting:
>>
>>1. SessionMiddleware 
>>
>> 
>> manages *sessions* 
>> across 
>>requests.
>>2. AuthenticationMiddleware 
>>
>> 
>>  associates 
>>users with requests using sessions.
>>3. csrf.CsrfViewMiddleware 
>>
>>
>> Using Django Template Language and Template inheritance. The login form 
>> is on the base template on other templates extends from this base template.
>>
>> All my login attempts result in some of the views rendering the user info 
>> (username to welcome user back) while other views rendering the page as if 
>> the user is an anonymous user. If I try to login in again I get an error 
>> page stating that there is a missing csrf token or incorrect. Adding to 
>> this I have identified many instances where I have tried to logout and it 
>> does not seem to log me out because it is still showing the last user login 
>> info. For my base template I have hard coded the form (meaning not using 
>> Django Form class).
>>
>> Can You identify the possible fault in how i am implementing the login 
>> and logout views?
>>
>>  
>>  Here is a copy of my login and logout views
>>
>> def members_login(request):
>>
>> if request.method == 'POST':
>> password = request.POST['password']
>> username = request.POST['username']
>> user = authenticate(username=username,password=password)
>>
>> if user is not None:
>> if user.is_active:
>> login(request,user)
>> return redirect('members:index')
>> else:
>> #inactive users required to re-register
>> return redirect('members:index')
>> else:
>> #no account required to register to create one
>> return redirect('members:register')
>> 
>> else:
>> #test if login is a regular get request then redirect
>> return HttpResponseRedirect(reverse('members:index'))
>>
>>
>> def members_logout(request):
>> logout(request)
>> return redirect('members:index')
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a54ac9c-d935-4fb0-b220-113dc477a200%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple Login Problem

2014-11-30 Thread Collin Anderson
Hi,

If you type your password wrong, user will be None, and your code will then 
redirect to the "register" page.

If you press "back" after a successful login, the CSRF token will be out of 
date and the form won't work.

Are you caching any pages?

Collin

On Friday, November 28, 2014 12:55:35 AM UTC-5, Rootz wrote:
>
> I have a django app but I having problems with my login views and logout 
> views. I do not have a html template designated to handle user login/logout 
> view.
> Django project is configured as follows:
>
> INSTALLED_APPS 
> 
>  setting:
>
>1. 'django.contrib.auth' contains the core of the authentication 
>framework, and its default models.
>2. 'django.contrib.contenttypes' is the Django *content type system* 
>, 
>which allows permissions to be associated with models you create.
>3. 'django.contrib.sessions',
>
>  MIDDLEWARE_CLASSES 
> 
>  setting:
>
>1. SessionMiddleware 
>
> 
> manages *sessions* 
> across 
>requests.
>2. AuthenticationMiddleware 
>
> 
>  associates 
>users with requests using sessions.
>3. csrf.CsrfViewMiddleware 
>
>
> Using Django Template Language and Template inheritance. The login form is 
> on the base template on other templates extends from this base template.
>
> All my login attempts result in some of the views rendering the user info 
> (username to welcome user back) while other views rendering the page as if 
> the user is an anonymous user. If I try to login in again I get an error 
> page stating that there is a missing csrf token or incorrect. Adding to 
> this I have identified many instances where I have tried to logout and it 
> does not seem to log me out because it is still showing the last user login 
> info. For my base template I have hard coded the form (meaning not using 
> Django Form class).
>
> Can You identify the possible fault in how i am implementing the login and 
> logout views?
>
>  
>  Here is a copy of my login and logout views
>
> def members_login(request):
>
> if request.method == 'POST':
> password = request.POST['password']
> username = request.POST['username']
> user = authenticate(username=username,password=password)
>
> if user is not None:
> if user.is_active:
> login(request,user)
> return redirect('members:index')
> else:
> #inactive users required to re-register
> return redirect('members:index')
> else:
> #no account required to register to create one
> return redirect('members:register')
> 
> else:
> #test if login is a regular get request then redirect
> return HttpResponseRedirect(reverse('members:index'))
>
>
> def members_logout(request):
> logout(request)
> return redirect('members:index')
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c106f934-66a0-4f60-b1b4-05095b9adf73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Simple Login Problem

2014-11-27 Thread Rootz
I have a django app but I having problems with my login views and logout 
views. I do not have a html template designated to handle user login/logout 
view.
Django project is configured as follows:

INSTALLED_APPS 

 setting:

   1. 'django.contrib.auth' contains the core of the authentication 
   framework, and its default models.
   2. 'django.contrib.contenttypes' is the Django *content type system* 
   , which 
   allows permissions to be associated with models you create.
   3. 'django.contrib.sessions',
   
 MIDDLEWARE_CLASSES 

 setting:

   1. SessionMiddleware 
   

manages *sessions* 
    across 
   requests.
   2. AuthenticationMiddleware 
   

 associates 
   users with requests using sessions.
   3. csrf.CsrfViewMiddleware 


Using Django Template Language and Template inheritance. The login form is 
on the base template on other templates extends from this base template.

All my login attempts result in some of the views rendering the user info 
(username to welcome user back) while other views rendering the page as if 
the user is an anonymous user. If I try to login in again I get an error 
page stating that there is a missing csrf token or incorrect. Adding to 
this I have identified many instances where I have tried to logout and it 
does not seem to log me out because it is still showing the last user login 
info. For my base template I have hard coded the form (meaning not using 
Django Form class).

Can You identify the possible fault in how i am implementing the login and 
logout views?

 
 Here is a copy of my login and logout views

def members_login(request):

if request.method == 'POST':
password = request.POST['password']
username = request.POST['username']
user = authenticate(username=username,password=password)

if user is not None:
if user.is_active:
login(request,user)
return redirect('members:index')
else:
#inactive users required to re-register
return redirect('members:index')
else:
#no account required to register to create one
return redirect('members:register')

else:
#test if login is a regular get request then redirect
return HttpResponseRedirect(reverse('members:index'))


def members_logout(request):
logout(request)
return redirect('members:index')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f55242f9-ea84-4620-a90d-d4b81640885d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: facebook login problem

2012-03-05 Thread dummyman dummyman
Hi

i tried tat code and im getting d same error

Please help me out

here are specifications

use facebook login.
and once the user logins get his id
and using his id get basic information
and also get other information like books etc using access token
get the json object

please provide the detailed proc on how to go about
i ve spent 2 days on this and yet couldnt find a solution

On Wed, Feb 29, 2012 at 9:46 PM, Vignesh Sunder wrote:

> This might help you ih managing the session. I had a similar problem a
> year ago and used the following snippet:
>
> http://djangosnippets.org/snippets/2065/
>
> Cheers!
>
> On Wed, Feb 29, 2012 at 5:29 PM, dummyman dummyman 
> wrote:
> > Hi , i am using django framework at the back end
> >
> > I have used facebook s social plugin login for authentication
> >
> > 
> > 
> >   My Facebook Login Page
> > 
> > 
> >   
> >   http://connect.facebook.net/en_US/all.js";>
> >   
> >  FB.init({
> > appId:'My_app_id', cookie:true,
> > status:true, xfbml:true
> >  });
> >   
> >   Login with Facebook
> > 
> >  
> >
> > I have replaced app_id with appropriate app id
> >
> > login button appears but when i click on the login button, a  window
> pops up
> > and fb s signin form appears. wen i enter my email and pass it says
> "error
> > occured.Please try again later"
> > my app id is correct  and i want to proceed further on maintaining the
> > session information about the logged in user. Please suggest me suitable
> > reference for this and please help me in finding the error in fb  login
> > button
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: facebook login problem

2012-02-29 Thread Vignesh Sunder
This might help you in managing the session. I had a similar problem a
year ago and used the following snippet:

http://djangosnippets.org/snippets/2065/

Cheers!

On Wed, Feb 29, 2012 at 5:29 PM, dummyman dummyman  wrote:
> Hi , i am using django framework at the back end
>
> I have used facebook s social plugin login for authentication
>
> 
>     
>       My Facebook Login Page
>     
>     
>       
>       http://connect.facebook.net/en_US/all.js";>
>       
>          FB.init({
>             appId:'My_app_id', cookie:true,
>             status:true, xfbml:true
>          });
>       
>       Login with Facebook
>     
>  
>
> I have replaced app_id with appropriate app id
>
> login button appears but when i click on the login button, a  window pops up
> and fb s signin form appears. wen i enter my email and pass it says "error
> occured.Please try again later"
> my app id is correct  and i want to proceed further on maintaining the
> session information about the logged in user. Please suggest me suitable
> reference for this and please help me in finding the error in fb  login
> button
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



facebook login problem

2012-02-29 Thread dummyman dummyman
Hi , i am using django framework at the back end

I have used facebook s social plugin login for authentication



  My Facebook Login Page


  
  http://connect.facebook.net/en_US/all.js";>
  
 FB.init({
appId:'My_app_id', cookie:true,
status:true, xfbml:true
 });
  
  Login with Facebook

 

I have replaced app_id with appropriate app id

login button appears but when i click on the login button, a  window pops
up and fb s signin form appears. wen i enter my email and pass it says
"error occured.Please try again later"
my app id is correct  and i want to proceed further on maintaining the
session information about the logged in user. Please suggest me suitable
reference for this and please help me in finding the error in fb  login
button

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2011-09-16 Thread marios
OK, thank you.

The problem is already solved.

Mario

On 16 sep, 09:44, Jacco Flenter  wrote:
> How did you set the password? There is a password field in the "change user"
> form in the admin, but it does not contain the user's password in clear
> text: it is the result of some cryptography on the password. It might be a
> good idea to go to the change user form and check if the password field
> contains something in the lines of "sha1$x$xxx..."
>
> Regards,
> Jacco
>
>  P.s. if you are on the "change user" page you can use the "change password
> form" below the password field to modify the current password
>
>
>
>
>
>
>
> On Fri, Sep 16, 2011 at 2:20 PM, marios  wrote:
> > Thank you.
>
> > I did what you are saying. And I have tried creating several new
> > users, but the error message is the same.
>
> > On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"
> >  wrote:
> > > Are you sure you've used the right credentials ?!
> > > Can you log as the admin ?!
> > > If so try to create another user and log in as such.
>
> > > . . . . . . . . . . . . . . . . . . . . . . . . . .
> > > Ing. Patrick Szabo
> > >  XSLT Developer
> > > LexisNexis
> > > Marxergasse 25, 1030 Wien
>
> > > mailto:patrick.sz...@lexisnexis.at
> > > Tel.: 00431 534521573
> > > Fax: +43 (1) 534 52 - 146
>
> > > -Ursprüngliche Nachricht-
>
> > > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> > Im Auftrag von marios
> > > Gesendet: Freitag, 16. September 2011 13:14
> > > An: Django users
> > > Betreff: New user login problem
>
> > > I am a new user of Django with not much experience in programming. I
> > > am following the tutorial.
> > > In the Administration module I have created a new user with some
> > > permissions, but when I try to logging in as this new user appear an
> > > error message ("Wrong user or password")
> > > Could you help me?
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group athttp://
> > groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2011-09-16 Thread Jacco Flenter
How did you set the password? There is a password field in the "change user"
form in the admin, but it does not contain the user's password in clear
text: it is the result of some cryptography on the password. It might be a
good idea to go to the change user form and check if the password field
contains something in the lines of "sha1$x$xxx..."

Regards,
Jacco

 P.s. if you are on the "change user" page you can use the "change password
form" below the password field to modify the current password

On Fri, Sep 16, 2011 at 2:20 PM, marios  wrote:

> Thank you.
>
> I did what you are saying. And I have tried creating several new
> users, but the error message is the same.
>
> On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"
>  wrote:
> > Are you sure you've used the right credentials ?!
> > Can you log as the admin ?!
> > If so try to create another user and log in as such.
> >
> > . . . . . . . . . . . . . . . . . . . . . . . . . .
> > Ing. Patrick Szabo
> >  XSLT Developer
> > LexisNexis
> > Marxergasse 25, 1030 Wien
> >
> > mailto:patrick.sz...@lexisnexis.at
> > Tel.: 00431 534521573
> > Fax: +43 (1) 534 52 - 146
> >
> > -Ursprüngliche Nachricht-
> >
> > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> Im Auftrag von marios
> > Gesendet: Freitag, 16. September 2011 13:14
> > An: Django users
> > Betreff: New user login problem
> >
> > I am a new user of Django with not much experience in programming. I
> > am following the tutorial.
> > In the Administration module I have created a new user with some
> > permissions, but when I try to logging in as this new user appear an
> > error message ("Wrong user or password")
> > Could you help me?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2011-09-16 Thread marios
OK now.

I missed set is_staff=True.

Thank you.

Mario

(A doubt: Is it OK ask support questions in this forum or its purpose
is another?

On 16 sep, 09:22, Martin Tiršel  wrote:
> Hi,
>
> did you set is_staff to True?
>
> Martin
>
>
>
>
>
>
>
> On Fri, 16 Sep 2011 14:20:14 +0200, marios  wrote:
> > Thank you.
>
> > I did what you are saying. And I have tried creating several new
> > users, but the error message is the same.
>
> > On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"
> >  wrote:
> >> Are you sure you've used the right credentials ?!
> >> Can you log as the admin ?!
> >> If so try to create another user and log in as such.
>
> >> . . . . . . . . . . . . . . . . . . . . . . . . . .
> >> Ing. Patrick Szabo
> >>  XSLT Developer
> >> LexisNexis
> >> Marxergasse 25, 1030 Wien
>
> >> mailto:patrick.sz...@lexisnexis.at
> >> Tel.: 00431 534521573
> >> Fax: +43 (1) 534 52 - 146
>
> >> -Ursprüngliche Nachricht-----
>
> >> Von: django-users@googlegroups.com  
> >> [mailto:django-users@googlegroups.com] Im Auftrag von marios
> >> Gesendet: Freitag, 16. September 2011 13:14
> >> An: Django users
> >> Betreff: New user login problem
>
> >> I am a new user of Django with not much experience in programming. I
> >> am following the tutorial.
> >> In the Administration module I have created a new user with some
> >> permissions, but when I try to logging in as this new user appear an
> >> error message ("Wrong user or password")
> >> Could you help me?
>
> >> --
> >> You received this message because you are subscribed to the Google  
> >> Groups "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to  
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group  
> >> athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2011-09-16 Thread Martin Tiršel

Hi,

did you set is_staff to True?

Martin



On Fri, 16 Sep 2011 14:20:14 +0200, marios  wrote:


Thank you.

I did what you are saying. And I have tried creating several new
users, but the error message is the same.

On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"
 wrote:

Are you sure you've used the right credentials ?!
Can you log as the admin ?!
If so try to create another user and log in as such.

. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573
Fax: +43 (1) 534 52 - 146

-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com  
[mailto:django-users@googlegroups.com] Im Auftrag von marios

Gesendet: Freitag, 16. September 2011 13:14
An: Django users
Betreff: New user login problem

I am a new user of Django with not much experience in programming. I
am following the tutorial.
In the Administration module I have created a new user with some
permissions, but when I try to logging in as this new user appear an
error message ("Wrong user or password")
Could you help me?

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to  
django-users+unsubscr...@googlegroups.com.
For more options, visit this group  
athttp://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2011-09-16 Thread marios
Thank you.

I did what you are saying. And I have tried creating several new
users, but the error message is the same.

On 16 sep, 08:49, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Are you sure you've used the right credentials ?!
> Can you log as the admin ?!
> If so try to create another user and log in as such.
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Ing. Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: 00431 534521573
> Fax: +43 (1) 534 52 - 146
>
> -Ursprüngliche Nachricht-
>
> Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
> Auftrag von marios
> Gesendet: Freitag, 16. September 2011 13:14
> An: Django users
> Betreff: New user login problem
>
> I am a new user of Django with not much experience in programming. I
> am following the tutorial.
> In the Administration module I have created a new user with some
> permissions, but when I try to logging in as this new user appear an
> error message ("Wrong user or password")
> Could you help me?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: New user login problem

2011-09-16 Thread Szabo, Patrick (LNG-VIE)
Are you sure you've used the right credentials ?!
Can you log as the admin ?!
If so try to create another user and log in as such.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von marios
Gesendet: Freitag, 16. September 2011 13:14
An: Django users
Betreff: New user login problem

I am a new user of Django with not much experience in programming. I
am following the tutorial.
In the Administration module I have created a new user with some
permissions, but when I try to logging in as this new user appear an
error message ("Wrong user or password")
Could you help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



New user login problem

2011-09-16 Thread marios
I am a new user of Django with not much experience in programming. I
am following the tutorial.
In the Administration module I have created a new user with some
permissions, but when I try to logging in as this new user appear an
error message ("Wrong user or password")
Could you help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Login problem, django does not remember user

2010-04-16 Thread chris_ingenhaag
Argh yes, of course. Thank you, thats it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Login problem, django does not remember user

2010-04-16 Thread Tim Shaffer
I suspect you have a clash in names here. You have two methods named
"login":

5: from django.contrib.auth import authenticate, login
9: def login(request, template_name='auth/login.html'):

So when you call login(request, user) on line 21, it's calling the
method you created on line 9, not the login method you import on line
5. And that means the user isn't actually being logged in.

To fix this, simple import login as auth_login, then change line 21 to
auth_login(request, user)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Login problem, django does not remember user

2010-04-16 Thread chris_ingenhaag
Hi all,
i would like to user a simple captcha during login to a web
application. Because of this I wrote my own login view like in the
django documentation, in short:

form.is_valid()
authenticate(username='user', password='pass')
login(request, user)

For deteil here is the full code of the login view http://dpaste.com/184432/

Now the problem is that the login procedure finished successful but
the @login_required decorator redirects me to the login view again. I
just seems that django does not remember the logged in user. I removed
the captcha formfield but nothing happened.

In the documentation the login view contains a section where test
cookies were set and then deleted. What about this. Do I have to test
the cookies for a complete login procedure?

Does someone have or had the same problem?

Regards
Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New user login problem

2009-11-14 Thread Zeynel
I figured that "active" and "staff" need to be checked as explained
here:

http://docs.djangoproject.com/en/dev/faq/admin/

Does anybody know how to make admin "view only" for a user? This
paragraph from the above appears to explain a similar process:

How do I limit admin access so that objects can only be edited by the
users who created them?

The ModelAdmin class also provides customization hooks that allow you
to control the visibility and editability of objects in the admin.
Using the same trick of extracting the user from the request, the
ModelAdmin.queryset() and ModelAdmin.has_change_permission() can be
used to control the visibility and editability of objects in the
admin.

Is there anyone who is familiar with this process?

On Nov 14, 9:38 am, Zeynel  wrote:
> Hello,
>
> I am creating a new user successfully but I cannot login with that new
> user. I make sure that username and pw (case sensitive) are correct.
> Is there more to creating a new user?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




New user login problem

2009-11-14 Thread Zeynel
Hello,

I am creating a new user successfully but I cannot login with that new
user. I make sure that username and pw (case sensitive) are correct.
Is there more to creating a new user?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: login problem

2008-12-16 Thread vierda

Hi Matius,

Thank you for your clue, I have modified my code and it run exactly
like I want.
My code as following below:

def my_view(request):

   username = []
   password = []

   if request.method == "POST" :
  username = request.POST['username']
  password = request.POST['password']
  user =  authenticate(username=username, password=password)
  render_to_response ('login.html', {'username': username,
'password' : password})

  if user is not None:
 if user.is_active:
login(request,user)
return render_to_response('success.html',
{'username':username})
 else:
return HttpResponse('disabled account')
  else:
 return HttpResponse('invalid login')

   else:
  return render_to_response ('login.html', {'username': username,
'password' : password})

the login.html and success.html remain the same
once again thanks man and have a nice day :)

regards,
-vierda-

On Dec 16, 8:50 am, brandonh  wrote:
> I just use the get method on the POST object.
>
> username = request.POST.get('username','')
>
> if there is no username posted, the username will be blank and should
> not authenticate. same for the password.
>
> On Dec 16, 9:39 am, Matias  wrote:
>
> > Hello,
>
> > You should show the login if the method != "POST".
> > By calling render_to_response(...) it will render your template, so that is
> > what the view must return.
>
> > I think you want something like this:
>
> > def my_view(request):
> >   if request.method == "POST" :
> >       username = request.POST['username']
> >      password = request.POST['password']
> >      user =  authenticate(username=username, password=password)
>
> >      if user is not None:
> >         if user.is_active:
> >            login(request,user)
> >            return render_to_response('success.html',
> > {'username':username})
> >         else:
> >            return HttpResponse('disabled account')
> >      else:
> >         return HttpResponse('invalid login')
> >    else:
> >      *return render_to_response* ('login.html', {'username': username,
> > 'password' : password})
>
> > Regards,
> > Matias.
>
> > On Tue, Dec 16, 2008 at 1:17 AM, vierda  wrote:
>
> > > Hi Matias,
>
> > > Thanks for your reply but I did'nt get your point. sorry I'm newbie
> > > and still learning.
> > > I modified my_view function in my views as your suggestion (if I
> > > didn't wrong get your point) as per below:
>
> > > def my_view(request):
> > >   if request.method == "POST" :
> > >       username = request.POST['username']
> > >      password = request.POST['password']
> > >      user =  authenticate(username=username, password=password)
> > >       render_to_response ('login.html', {'username': username,
> > > 'password' : password})
>
> > >      if user is not None:
> > >         if user.is_active:
> > >            login(request,user)
> > >            return render_to_response('success.html',
> > > {'username':username})
> > >         else:
> > >            return HttpResponse('disabled account')
> > >      else:
> > >         return HttpResponse('invalid login')
> > >    else:
> > >      return HttpResponse ('home page')
>
> > > above code run and shows home page text, I assume that the method is
> > > not POST regarding the result.
> > > What sholud I do to fix this and show my login page. somebody please
> > > help me to understand this concept. Thank you
>
> > > regards,
> > > -Mila-
>
> > > On Dec 15, 9:06 am, Matias  wrote:
> > > > Hello,
>
> > > > You should check by which method was called your view.
> > > > something like
>
> > > > if request.method == "POST":
> > > >     #now you can use request.POST
> > > > else:
> > > >     #just show the template
>
> > > > Hope that helps,
>
> > > > Matias.
>
> > > > On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:
>
> > > > > Dear Ronny/all,
>
> > > > > Thank you for your reply. I have modified my code and the error still
> > > > > occur.
> > > > > my new code as following below:
>
> > > > > def my_view(request):
> > > > >   username = request.POST['username']
> > > > >   password = request.POST['password']
> > > > >   user =  authenticate(username=username, password=password)#create
> > > > > Authentication object
> > > > >    render_to_response ('login.html', {'username': username,
> > > > > 'password' : password})
>
> > > > >   if user is not None:
> > > > >      if user.is_active:
> > > > >         login(request,user)
> > > > >          return render_to_response('success.html',
> > > > > {'username':username})
> > > > >      else:
> > > > >         return HttpResponse('disabled account')
> > > > >    else:
> > > > >      return HttpResponse('invalid login')
>
> > > > > and my login.html as per below:
> > > > > 
>
> > > > > Enter Username: 
> > > > > Enter Password: 
> > > > > 
> > > > > 
>
> > > > > my success.html as per below :
> > > > > 
> > > > >  welcome{{username}}
> > > > > 
>
> > > > > somebody kindly help and thank you in advance
>
> > > > > On De

Re: login problem

2008-12-16 Thread brandonh

I just use the get method on the POST object.

username = request.POST.get('username','')

if there is no username posted, the username will be blank and should
not authenticate. same for the password.

On Dec 16, 9:39 am, Matias  wrote:
> Hello,
>
> You should show the login if the method != "POST".
> By calling render_to_response(...) it will render your template, so that is
> what the view must return.
>
> I think you want something like this:
>
> def my_view(request):
>   if request.method == "POST" :
>       username = request.POST['username']
>      password = request.POST['password']
>      user =  authenticate(username=username, password=password)
>
>      if user is not None:
>         if user.is_active:
>            login(request,user)
>            return render_to_response('success.html',
> {'username':username})
>         else:
>            return HttpResponse('disabled account')
>      else:
>         return HttpResponse('invalid login')
>    else:
>      *return render_to_response* ('login.html', {'username': username,
> 'password' : password})
>
> Regards,
> Matias.
>
>
>
> On Tue, Dec 16, 2008 at 1:17 AM, vierda  wrote:
>
> > Hi Matias,
>
> > Thanks for your reply but I did'nt get your point. sorry I'm newbie
> > and still learning.
> > I modified my_view function in my views as your suggestion (if I
> > didn't wrong get your point) as per below:
>
> > def my_view(request):
> >   if request.method == "POST" :
> >       username = request.POST['username']
> >      password = request.POST['password']
> >      user =  authenticate(username=username, password=password)
> >       render_to_response ('login.html', {'username': username,
> > 'password' : password})
>
> >      if user is not None:
> >         if user.is_active:
> >            login(request,user)
> >            return render_to_response('success.html',
> > {'username':username})
> >         else:
> >            return HttpResponse('disabled account')
> >      else:
> >         return HttpResponse('invalid login')
> >    else:
> >      return HttpResponse ('home page')
>
> > above code run and shows home page text, I assume that the method is
> > not POST regarding the result.
> > What sholud I do to fix this and show my login page. somebody please
> > help me to understand this concept. Thank you
>
> > regards,
> > -Mila-
>
> > On Dec 15, 9:06 am, Matias  wrote:
> > > Hello,
>
> > > You should check by which method was called your view.
> > > something like
>
> > > if request.method == "POST":
> > >     #now you can use request.POST
> > > else:
> > >     #just show the template
>
> > > Hope that helps,
>
> > > Matias.
>
> > > On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:
>
> > > > Dear Ronny/all,
>
> > > > Thank you for your reply. I have modified my code and the error still
> > > > occur.
> > > > my new code as following below:
>
> > > > def my_view(request):
> > > >   username = request.POST['username']
> > > >   password = request.POST['password']
> > > >   user =  authenticate(username=username, password=password)#create
> > > > Authentication object
> > > >    render_to_response ('login.html', {'username': username,
> > > > 'password' : password})
>
> > > >   if user is not None:
> > > >      if user.is_active:
> > > >         login(request,user)
> > > >          return render_to_response('success.html',
> > > > {'username':username})
> > > >      else:
> > > >         return HttpResponse('disabled account')
> > > >    else:
> > > >      return HttpResponse('invalid login')
>
> > > > and my login.html as per below:
> > > > 
>
> > > > Enter Username: 
> > > > Enter Password: 
> > > > 
> > > > 
>
> > > > my success.html as per below :
> > > > 
> > > >  welcome{{username}}
> > > > 
>
> > > > somebody kindly help and thank you in advance
>
> > > > On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> > > > > On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > > > > > today I try to make login page with follow example code in
> > > > > > djangoproject (user authentication chapter), code as following
> > below :
>
> > > > > > def my_view(request):
> > > > > >   username = request.POST['username']
> > > > > >   password = request.POST['password']
> > > > > >   user =  authenticate(username=username, password=password)#create
> > > > > > Authentication object
>
> > > > > >   if user is not None:
> > > > > >      if user.is_active:
> > > > > >         login(request,user)
> > > > > >         return HttpResponse('login success')
> > > > > >      else:
> > > > > >         return HttpResponse('disable account')
> > > > > >   else:
> > > > > >      return HttpResponse('invalid login')
>
> > > > > > the above code always shows MultiValueDictKeyError with exception
> > > > > > value "Key 'username' not found in ".
>
> > > > > That exception will always be raised if the view is called via GET
> > > > > method instead of POST.
>
> > > > > If you're sending it via POST, then the information you provided was
> > > > > not sufficient. We need to see tem

Re: login problem

2008-12-16 Thread Matias
Hello,

You should show the login if the method != "POST".
By calling render_to_response(...) it will render your template, so that is
what the view must return.

I think you want something like this:

def my_view(request):
  if request.method == "POST" :
  username = request.POST['username']
 password = request.POST['password']
 user =  authenticate(username=username, password=password)

 if user is not None:
if user.is_active:
   login(request,user)
   return render_to_response('success.html',
{'username':username})
else:
   return HttpResponse('disabled account')
 else:
return HttpResponse('invalid login')
   else:
 *return render_to_response* ('login.html', {'username': username,
'password' : password})

Regards,
Matias.

On Tue, Dec 16, 2008 at 1:17 AM, vierda  wrote:

>
> Hi Matias,
>
> Thanks for your reply but I did'nt get your point. sorry I'm newbie
> and still learning.
> I modified my_view function in my views as your suggestion (if I
> didn't wrong get your point) as per below:
>
> def my_view(request):
>   if request.method == "POST" :
>   username = request.POST['username']
>  password = request.POST['password']
>  user =  authenticate(username=username, password=password)
>   render_to_response ('login.html', {'username': username,
> 'password' : password})
>
>  if user is not None:
> if user.is_active:
>login(request,user)
>return render_to_response('success.html',
> {'username':username})
> else:
>return HttpResponse('disabled account')
>  else:
> return HttpResponse('invalid login')
>else:
>  return HttpResponse ('home page')
>
> above code run and shows home page text, I assume that the method is
> not POST regarding the result.
> What sholud I do to fix this and show my login page. somebody please
> help me to understand this concept. Thank you
>
> regards,
> -Mila-
>
>
>
> On Dec 15, 9:06 am, Matias  wrote:
> > Hello,
> >
> > You should check by which method was called your view.
> > something like
> >
> > if request.method == "POST":
> > #now you can use request.POST
> > else:
> > #just show the template
> >
> > Hope that helps,
> >
> > Matias.
> >
> >
> >
> > On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:
> >
> > > Dear Ronny/all,
> >
> > > Thank you for your reply. I have modified my code and the error still
> > > occur.
> > > my new code as following below:
> >
> > > def my_view(request):
> > >   username = request.POST['username']
> > >   password = request.POST['password']
> > >   user =  authenticate(username=username, password=password)#create
> > > Authentication object
> > >render_to_response ('login.html', {'username': username,
> > > 'password' : password})
> >
> > >   if user is not None:
> > >  if user.is_active:
> > > login(request,user)
> > >  return render_to_response('success.html',
> > > {'username':username})
> > >  else:
> > > return HttpResponse('disabled account')
> > >else:
> > >  return HttpResponse('invalid login')
> >
> > > and my login.html as per below:
> > > 
> >
> > > Enter Username: 
> > > Enter Password: 
> > > 
> > > 
> >
> > > my success.html as per below :
> > > 
> > >  welcome{{username}}
> > > 
> >
> > > somebody kindly help and thank you in advance
> >
> > > On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> > > > On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > > > > today I try to make login page with follow example code in
> > > > > djangoproject (user authentication chapter), code as following
> below :
> >
> > > > > def my_view(request):
> > > > >   username = request.POST['username']
> > > > >   password = request.POST['password']
> > > > >   user =  authenticate(username=username, password=password)#create
> > > > > Authentication object
> >
> > > > >   if user is not None:
> > > > >  if user.is_active:
> > > > > login(request,user)
> > > > > return HttpResponse('login success')
> > > > >  else:
> > > > > return HttpResponse('disable account')
> > > > >   else:
> > > > >  return HttpResponse('invalid login')
> >
> > > > > the above code always shows MultiValueDictKeyError with exception
> > > > > value "Key 'username' not found in ".
> >
> > > > That exception will always be raised if the view is called via GET
> > > > method instead of POST.
> >
> > > > If you're sending it via POST, then the information you provided was
> > > > not sufficient. We need to see template code that renders the form
> (or
> > > > the html form if you're not using templates) and probably the form as
> > > > well.
> >
> > > > Ronny
> >
> > --
> > :wq
> >
>


-- 
:wq

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, sen

Re: login problem

2008-12-16 Thread Matias
Hello,

You should show the login if the method != "POST".
By calling render_to_response(...) it will render your template, so that is
what the view must return.

I think you want something like this:

def my_view(request):
  if request.method == "POST" :
  username = request.POST['username']
 password = request.POST['password']
 user =  authenticate(username=username, password=password)

 if user is not None:
if user.is_active:
   login(request,user)
   return render_to_response('success.html',
{'username':username})
else:
   return HttpResponse('disabled account')
 else:
return HttpResponse('invalid login')
   else:
 *return render_to_response* ('login.html', {'username': username,
'password' : password})

Regards,
Matias.

On Tue, Dec 16, 2008 at 1:17 AM, vierda  wrote:

>
> Hi Matias,
>
> Thanks for your reply but I did'nt get your point. sorry I'm newbie
> and still learning.
> I modified my_view function in my views as your suggestion (if I
> didn't wrong get your point) as per below:
>
> def my_view(request):
>   if request.method == "POST" :
>   username = request.POST['username']
>  password = request.POST['password']
>  user =  authenticate(username=username, password=password)
>   render_to_response ('login.html', {'username': username,
> 'password' : password})
>
>  if user is not None:
> if user.is_active:
>login(request,user)
>return render_to_response('success.html',
> {'username':username})
> else:
>return HttpResponse('disabled account')
>  else:
> return HttpResponse('invalid login')
>else:
>  return HttpResponse ('home page')
>
> above code run and shows home page text, I assume that the method is
> not POST regarding the result.
> What sholud I do to fix this and show my login page. somebody please
> help me to understand this concept. Thank you
>
> regards,
> -Mila-
>
>
>
> On Dec 15, 9:06 am, Matias  wrote:
> > Hello,
> >
> > You should check by which method was called your view.
> > something like
> >
> > if request.method == "POST":
> > #now you can use request.POST
> > else:
> > #just show the template
> >
> > Hope that helps,
> >
> > Matias.
> >
> >
> >
> > On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:
> >
> > > Dear Ronny/all,
> >
> > > Thank you for your reply. I have modified my code and the error still
> > > occur.
> > > my new code as following below:
> >
> > > def my_view(request):
> > >   username = request.POST['username']
> > >   password = request.POST['password']
> > >   user =  authenticate(username=username, password=password)#create
> > > Authentication object
> > >render_to_response ('login.html', {'username': username,
> > > 'password' : password})
> >
> > >   if user is not None:
> > >  if user.is_active:
> > > login(request,user)
> > >  return render_to_response('success.html',
> > > {'username':username})
> > >  else:
> > > return HttpResponse('disabled account')
> > >else:
> > >  return HttpResponse('invalid login')
> >
> > > and my login.html as per below:
> > > 
> >
> > > Enter Username: 
> > > Enter Password: 
> > > 
> > > 
> >
> > > my success.html as per below :
> > > 
> > >  welcome{{username}}
> > > 
> >
> > > somebody kindly help and thank you in advance
> >
> > > On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> > > > On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > > > > today I try to make login page with follow example code in
> > > > > djangoproject (user authentication chapter), code as following
> below :
> >
> > > > > def my_view(request):
> > > > >   username = request.POST['username']
> > > > >   password = request.POST['password']
> > > > >   user =  authenticate(username=username, password=password)#create
> > > > > Authentication object
> >
> > > > >   if user is not None:
> > > > >  if user.is_active:
> > > > > login(request,user)
> > > > > return HttpResponse('login success')
> > > > >  else:
> > > > > return HttpResponse('disable account')
> > > > >   else:
> > > > >  return HttpResponse('invalid login')
> >
> > > > > the above code always shows MultiValueDictKeyError with exception
> > > > > value "Key 'username' not found in ".
> >
> > > > That exception will always be raised if the view is called via GET
> > > > method instead of POST.
> >
> > > > If you're sending it via POST, then the information you provided was
> > > > not sufficient. We need to see template code that renders the form
> (or
> > > > the html form if you're not using templates) and probably the form as
> > > > well.
> >
> > > > Ronny
> >
> > --
> > :wq
> >
>


-- 
:wq

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, sen

Re: login problem

2008-12-15 Thread vierda

Hi Matias,

Thanks for your reply but I did'nt get your point. sorry I'm newbie
and still learning.
I modified my_view function in my views as your suggestion (if I
didn't wrong get your point) as per below:

def my_view(request):
   if request.method == "POST" :
  username = request.POST['username']
  password = request.POST['password']
  user =  authenticate(username=username, password=password)
  render_to_response ('login.html', {'username': username,
'password' : password})

  if user is not None:
 if user.is_active:
login(request,user)
return render_to_response('success.html',
{'username':username})
 else:
return HttpResponse('disabled account')
  else:
 return HttpResponse('invalid login')
   else:
  return HttpResponse ('home page')

above code run and shows home page text, I assume that the method is
not POST regarding the result.
What sholud I do to fix this and show my login page. somebody please
help me to understand this concept. Thank you

regards,
-Mila-



On Dec 15, 9:06 am, Matias  wrote:
> Hello,
>
> You should check by which method was called your view.
> something like
>
> if request.method == "POST":
>     #now you can use request.POST
> else:
>     #just show the template
>
> Hope that helps,
>
> Matias.
>
>
>
> On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:
>
> > Dear Ronny/all,
>
> > Thank you for your reply. I have modified my code and the error still
> > occur.
> > my new code as following below:
>
> > def my_view(request):
> >   username = request.POST['username']
> >   password = request.POST['password']
> >   user =  authenticate(username=username, password=password)#create
> > Authentication object
> >    render_to_response ('login.html', {'username': username,
> > 'password' : password})
>
> >   if user is not None:
> >      if user.is_active:
> >         login(request,user)
> >          return render_to_response('success.html',
> > {'username':username})
> >      else:
> >         return HttpResponse('disabled account')
> >    else:
> >      return HttpResponse('invalid login')
>
> > and my login.html as per below:
> > 
>
> > Enter Username: 
> > Enter Password: 
> > 
> > 
>
> > my success.html as per below :
> > 
> >  welcome{{username}}
> > 
>
> > somebody kindly help and thank you in advance
>
> > On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> > > On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > > > today I try to make login page with follow example code in
> > > > djangoproject (user authentication chapter), code as following below :
>
> > > > def my_view(request):
> > > >   username = request.POST['username']
> > > >   password = request.POST['password']
> > > >   user =  authenticate(username=username, password=password)#create
> > > > Authentication object
>
> > > >   if user is not None:
> > > >      if user.is_active:
> > > >         login(request,user)
> > > >         return HttpResponse('login success')
> > > >      else:
> > > >         return HttpResponse('disable account')
> > > >   else:
> > > >      return HttpResponse('invalid login')
>
> > > > the above code always shows MultiValueDictKeyError with exception
> > > > value "Key 'username' not found in ".
>
> > > That exception will always be raised if the view is called via GET
> > > method instead of POST.
>
> > > If you're sending it via POST, then the information you provided was
> > > not sufficient. We need to see template code that renders the form (or
> > > the html form if you're not using templates) and probably the form as
> > > well.
>
> > > Ronny
>
> --
> :wq
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem

2008-12-15 Thread Matias
Hello,

You should check by which method was called your view.
something like

if request.method == "POST":
#now you can use request.POST
else:
#just show the template


Hope that helps,

Matias.

On Mon, Dec 15, 2008 at 5:15 AM, vierda  wrote:

>
> Dear Ronny/all,
>
> Thank you for your reply. I have modified my code and the error still
> occur.
> my new code as following below:
>
> def my_view(request):
>   username = request.POST['username']
>   password = request.POST['password']
>   user =  authenticate(username=username, password=password)#create
> Authentication object
>render_to_response ('login.html', {'username': username,
> 'password' : password})
>
>   if user is not None:
>  if user.is_active:
> login(request,user)
>  return render_to_response('success.html',
> {'username':username})
>  else:
> return HttpResponse('disabled account')
>else:
>  return HttpResponse('invalid login')
>
> and my login.html as per below:
> 
>
> Enter Username: 
> Enter Password: 
> 
> 
>
> my success.html as per below :
> 
>  welcome{{username}}
> 
>
> somebody kindly help and thank you in advance
>
>
> On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> > On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > > today I try to make login page with follow example code in
> > > djangoproject (user authentication chapter), code as following below :
> >
> > > def my_view(request):
> > >   username = request.POST['username']
> > >   password = request.POST['password']
> > >   user =  authenticate(username=username, password=password)#create
> > > Authentication object
> >
> > >   if user is not None:
> > >  if user.is_active:
> > > login(request,user)
> > > return HttpResponse('login success')
> > >  else:
> > > return HttpResponse('disable account')
> > >   else:
> > >  return HttpResponse('invalid login')
> >
> > > the above code always shows MultiValueDictKeyError with exception
> > > value "Key 'username' not found in ".
> >
> > That exception will always be raised if the view is called via GET
> > method instead of POST.
> >
> > If you're sending it via POST, then the information you provided was
> > not sufficient. We need to see template code that renders the form (or
> > the html form if you're not using templates) and probably the form as
> > well.
> >
> > Ronny
> >
>


-- 
:wq

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem

2008-12-14 Thread vierda

Dear Ronny/all,

Thank you for your reply. I have modified my code and the error still
occur.
my new code as following below:

def my_view(request):
   username = request.POST['username']
   password = request.POST['password']
   user =  authenticate(username=username, password=password)#create
Authentication object
   render_to_response ('login.html', {'username': username,
'password' : password})

   if user is not None:
  if user.is_active:
 login(request,user)
 return render_to_response('success.html',
{'username':username})
  else:
 return HttpResponse('disabled account')
   else:
  return HttpResponse('invalid login')

and my login.html as per below:


Enter Username: 
Enter Password: 



my success.html as per below :

 welcome{{username}}


somebody kindly help and thank you in advance


On Dec 6, 12:05 am, "Ronny Haryanto"  wrote:
> On Sat, Dec 6, 2008 at 2:42 PM, vierda  wrote:
> > today I try to make login page with follow example code in
> > djangoproject (user authentication chapter), code as following below :
>
> > def my_view(request):
> >   username = request.POST['username']
> >   password = request.POST['password']
> >   user =  authenticate(username=username, password=password)#create
> > Authentication object
>
> >   if user is not None:
> >      if user.is_active:
> >         login(request,user)
> >         return HttpResponse('login success')
> >      else:
> >         return HttpResponse('disable account')
> >   else:
> >      return HttpResponse('invalid login')
>
> > the above code always shows MultiValueDictKeyError with exception
> > value "Key 'username' not found in ".
>
> That exception will always be raised if the view is called via GET
> method instead of POST.
>
> If you're sending it via POST, then the information you provided was
> not sufficient. We need to see template code that renders the form (or
> the html form if you're not using templates) and probably the form as
> well.
>
> Ronny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem

2008-12-06 Thread Ronny Haryanto

On Sat, Dec 6, 2008 at 2:42 PM, vierda <[EMAIL PROTECTED]> wrote:
> today I try to make login page with follow example code in
> djangoproject (user authentication chapter), code as following below :
>
> def my_view(request):
>   username = request.POST['username']
>   password = request.POST['password']
>   user =  authenticate(username=username, password=password)#create
> Authentication object
>
>   if user is not None:
>  if user.is_active:
> login(request,user)
> return HttpResponse('login success')
>  else:
> return HttpResponse('disable account')
>   else:
>  return HttpResponse('invalid login')
>
> the above code always shows MultiValueDictKeyError with exception
> value "Key 'username' not found in ".

That exception will always be raised if the view is called via GET
method instead of POST.

If you're sending it via POST, then the information you provided was
not sufficient. We need to see template code that renders the form (or
the html form if you're not using templates) and probably the form as
well.

Ronny

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



login problem

2008-12-05 Thread vierda

Dear All,

today I try to make login page with follow example code in
djangoproject (user authentication chapter), code as following below :

def my_view(request):
   username = request.POST['username']
   password = request.POST['password']
   user =  authenticate(username=username, password=password)#create
Authentication object

   if user is not None:
  if user.is_active:
 login(request,user)
 return HttpResponse('login success')
  else:
 return HttpResponse('disable account')
   else:
  return HttpResponse('invalid login')

the above code always shows MultiValueDictKeyError with exception
value "Key 'username' not found in ".
please give me clue to resolve this problem. Thank you in advance

regards,
-vierda-
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-14 Thread KillaBee



On Oct 10, 12:02 pm, Robocop <[EMAIL PROTECTED]> wrote:
> Unfortunately, that is the explanation.  I really appreciate all the
> help though; how disappointing that i didn't learn anything other than
> not allowing anyone to touch my projects without me around.
>
> On Oct 10, 9:59 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Fri, Oct 10, 2008 at 12:51 PM, Robocop <[EMAIL PROTECTED]> wrote:
>
> > > Bad news guys, someone deactivated my test user and didn't tell me.
> > > I'm so sad.
>
> > Do you mean that is the explanation for why auth.login hasn't been working?
> > Or is there still a problem that needs to be investigated?
>
> > Karen

1) I was looking at this because I am have a problem login in users
and showing there auth info(show any data not from a form).
my view looks just like yours, it is letting every thing in.

2) I saw the line:  news_list = New.objects.all().order_by('-
date')
I need to do something like this
usertime=time.objects.filter( user=User.username).filter(worked=null)
time is my class in my models.py that has user and worked.
 what else do I have to do to get this to work?

View   http://dpaste.com/84442/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-10 Thread Robocop

Unfortunately, that is the explanation.  I really appreciate all the
help though; how disappointing that i didn't learn anything other than
not allowing anyone to touch my projects without me around.

On Oct 10, 9:59 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 10, 2008 at 12:51 PM, Robocop <[EMAIL PROTECTED]> wrote:
>
> > Bad news guys, someone deactivated my test user and didn't tell me.
> > I'm so sad.
>
> Do you mean that is the explanation for why auth.login hasn't been working?
> Or is there still a problem that needs to be investigated?
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-10 Thread Karen Tracey
On Fri, Oct 10, 2008 at 12:51 PM, Robocop <[EMAIL PROTECTED]> wrote:

>
> Bad news guys, someone deactivated my test user and didn't tell me.
> I'm so sad.
>

Do you mean that is the explanation for why auth.login hasn't been working?
Or is there still a problem that needs to be investigated?

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-10 Thread Robocop

Bad news guys, someone deactivated my test user and didn't tell me.
I'm so sad.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-10 Thread Robocop

Also worth noting:  I tried using the built in
django.contrib.views.login, but that resulted in the same behavior.
Did some automagic default session setting in django .96 get changed
to something that needs to be manually set in 1.0?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-10 Thread Robocop


Sorry for the sloppy post, i was reposting an old ignored thread in my
frustrated rage.  The code i'm working with right now looks like:

from django.contrib import auth

def log(request):
  news_list = New.objects.all().order_by('-date')
  if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None:
  if user.is_active:
auth.login(request, user)
  return HttpResponseRedirect('/')
else:
  return render_to_response('registration.html', locals())

I'm trying to keep it very simple for the sake of debugging.  I still
have no clue as to why this won't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Karen Tracey
On Thu, Oct 9, 2008 at 5:18 PM, Robocop <[EMAIL PROTECTED]> wrote:

>
> Having looked through the archived posts, i found a similar problem
> that had found no solution:
> http://groups.google.com/group/django-users/browse_thread/thread/bf05...
>

I get a 'topic not found' error from Google Groups when I click on either
the link in my email copy of this post or the link in the post at Google
Groups.  So I cannot refer to the older similar problem to try to understand
what's going on.


>
> It looks like django is not actually logging my user in, or not
> creating a session.  I have a very simple snippet for login
> functionality pretty much lifted directly from the docs:
>
> from django.contrib.auth import logout, login, authenticate
>
> def login(request):
>  news_list = New.objects.all().order_by('-date')
>  if request.method == 'POST':
>username = request.POST['username']
>password = request.POST['password']
>user = auth.authenticate(username=username, password=password)
>if user is not None:
>  if user.is_active:
>login(request,user)
>  return HttpResponseRedirect('/')
>else:
>  return render_to_response('registration.html', locals())
>

You import login from django.contrib.auth but then you redefine login, which
means when you call login from within login you should recursively call the
function you are already in...but apparently that is not happening?  You
also import 'authenticate' but call 'auth.authenticate', so I am suspicious
that the code you have posted is not really the code you are running, which
makes it rather hard to speculate on what might be going wrong.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Colin Bean

On Thu, Oct 9, 2008 at 4:15 PM, Robocop <[EMAIL PROTECTED]> wrote:
>
>
> actually i read that wrong, i do not know what path it is being sent
> to.


I think that's the root path... you can verify in firefox if you look
under preferences > privacy > show cookies.  You said you moved from a
dev setup under 0.96, are you running another dev setup under 1.0, or
something else?  If you're using something else, have you tried it
under the dev server?  That would probably be the simplest possible
case...

Also, does the session id stay the same between requests?

Colin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Robocop


actually i read that wrong, i do not know what path it is being sent
to.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Robocop


Cookie=sessionid=6bc37c43a444db3aaf60a5c61e85bb01; support_tabs=0
Content-Type=application/x-www-form-urlencoded
Content-Length=52
POSTDATA=username=moneybags&password=dollars&next=%2F&x=0&y=0

this is the relevant tamperdata output, though i'm not necessarily
sure how to check if the session cookie is being set (i don't know
what it should look like), but it's definitely routing to the correct
path ('/').  And i've only had this issue with django 1.0, i'd ported
this project over from a DEV box running .96 and everything worked
great; now the login function seems to hate me.  Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Robocop


Cookie=sessionid=6bc37c43a444db3aaf60a5c61e85bb01; support_tabs=0
Content-Type=application/x-www-form-urlencoded
Content-Length=52
POSTDATA=username=moneybags&password=dollars&next=%2F&x=0&y=0

this is the relevant tamperdata output, though i'm not necessarily
sure how to check if the session cookie is being set (i don't know
what it should look like), but it's definitely routing to the correct
path ('/').  And i've only had this issue with django 1.0, i'd ported
this project over from a DEV box running .96 and everything worked
great; now the login function seems to hate me.  Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Colin Bean

On Thu, Oct 9, 2008 at 3:25 PM, Robocop <[EMAIL PROTECTED]> wrote:
>
> All right, this is getting absolutely ridiculous.  I tried to
> workaround my problems by using the built in contrib.auth.views.login,
> and of course this resulted in the same behavior.  I am very reluctant
> to think this is a bug, but rather some type of session
> misunderstanding, but i'm running out of options.  I'm getting
> desperate on this project and would really really appreciate some type
> of constructive commentary, no matter how outrageous.
>
>

One thing you can do (below the django level) is to use TamperData for
firefox or something similar to examine your headers and make sure the
session cookie is indeed being set, with the right path.  Always good
to confirm that if you're having weird session behavior.  Are you
experiencing this on the development server, or some other setup?

Colin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Robocop

I'm going to burn my server down, i could really use some help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login problem, Django 1.0

2008-10-09 Thread Robocop

All right, this is getting absolutely ridiculous.  I tried to
workaround my problems by using the built in contrib.auth.views.login,
and of course this resulted in the same behavior.  I am very reluctant
to think this is a bug, but rather some type of session
misunderstanding, but i'm running out of options.  I'm getting
desperate on this project and would really really appreciate some type
of constructive commentary, no matter how outrageous.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



login problem, Django 1.0

2008-10-09 Thread Robocop

Having looked through the archived posts, i found a similar problem
that had found no solution:
http://groups.google.com/group/django-users/browse_thread/thread/bf05...

It looks like django is not actually logging my user in, or not
creating a session.  I have a very simple snippet for login
functionality pretty much lifted directly from the docs:

from django.contrib.auth import logout, login, authenticate

def login(request):
  news_list = New.objects.all().order_by('-date')
  if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None:
  if user.is_active:
login(request,user)
  return HttpResponseRedirect('/')
else:
  return render_to_response('registration.html', locals())

settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'intrinsic.site',
)

I've posted once before and no one really had a solution, though i've
seen that a few people have had the same problem, though they too had
found no solutions.  After some debugging, i've found out definitively
that all of my code works, OTHER than that one line with
"login(request,user)."  If i log in through the admin interface, then
navigate to my site, all of the login responsive content changes the
way it should, however logging in through my main page interface still
does not do anything.  I haven't seen a posted bug regarding
login(request,user), so i'm assuming there is something subtle about
how the login sessions are created through the site that i am
missing.  Any ideas or solutions would really be great, otherwise i'm
going to have to pull out some mickey mouse code on this one.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Vague, annoying, login problem

2008-10-03 Thread Robocop

I'm running out of ideas, so i decided to see if anyone could offer
any advice on a problem i'm having.  I'm trying to finish up a site
with some 'dummy' login functionality.  Dummy meaning that it doesn't
do anything right now besides offer demographic information through
registration, so it's very simple.  At the moment i'm having several
problems implementing it.

The foremost is it entirely ruining the css and formatting of the page
anytime i login a user.  When i login a user i render_to_response to
the main page, and an included if statement in the html template
decides whether to display the login textfields (if not logged in), or
a blank table to preserve the formatting of the page (if logged in).
However, the page halfway loads, i.e. all of the images don't load,
even though viewing the live code via firebug shows that all the code
is correct and in place.

I tried a HttpResponseRedirect instead of render_to_response but when
i do that, the session seems to close itself (as if the user had never
logged in at all).

My template code for the login area looks like this:


{% if not user.is_authenticated %}

  

  

     


  


     Username


     

  


     Password
  


  
 

   Login to view your results, or order a test
   Click here to apply for a
username and password
{% else %}
  




  
  Logout
  


  
  

  
  


  
  
  
{% endif %}
 

The login code in the views is as such:

if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None:
  if user.is_active:
auth.login(request,user)
  return render_to_response('main.html', locals())
else:
  return render_to_response('registration.html', locals())

Nothing too complicated on the django end, there just seems to be some
kind of crazy formatting problem that is far beyond me.  Any help
would be the highlight of my day, i'd even take you out to some type
of romantic dinner if you save my project.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Vague, annoying, login problem

2008-10-02 Thread Robocop

fixed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Vague, annoying, login problem

2008-10-02 Thread Robocop

I just realized why the images are not loading; the images are served
by appending the file path to the url, but when they try to append
mysite.com/login/imagefilepath it can't find them as there is no login
directory.  My question now is how do i work around this, i haven't
thought of a workaround yet as when i try to do a HttpResponseRedirect
django seems to forget the user got logged in.  Is there any slick
trick anyone knows of how to solve my url problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-03 Thread laspal

Hey I am able to run the test by using :
class IndustryTest(TestCase):
fixtures = ['/fixtures/initial_data.xml']

def setUp(self):
self.client = Client()
response =self.client.post('/ibms/login/',
{'username':'laspal', 'password':'abcd'})

def test_addIndustry( self):
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'})
url = '/ibms/crm/industries/add/'
response = self.client.post(url,{ 'name': 'tarams'})
self.failUnlessEqual( response.status_code, 302)
industry = Industry.objects.get( name = 'tarams')
self.failUnlessEqual( industry.name, 'tarams')

So my point is it still  shows response as """Your username and
password didn't match. Please try again"""
but my test is not showing any error as before. I just added the login
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'}) to the test_addIndustry functions.

So my doubt is I am doing the correct way.. because I run into some
other problem.
"""function for viewing the list of industry

def test_view_industry(self):
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'})
industry = Industry.objects.get(name = 'tarams')
url = '/ibms/crm/industries/' + str(industry.id) + '/
overview/'
response = self.client.post(url)
self.failUnlessEqual( response.status_code, 302)

gives me error saying """Industry matching query does not exist."""
for the test_view_industry function..

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-03 Thread laspal

Hey I am able to run the test by using :
class IndustryTest(TestCase):
fixtures = ['/fixtures/initial_data.xml']

def setUp(self):
self.client = Client()
response =self.client.post('/ibms/login/',
{'username':'laspal', 'password':'abcd'})

def test_addIndustry( self):
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'})
url = '/ibms/crm/industries/add/'
response = self.client.post(url,{ 'name': 'tarams'})
self.failUnlessEqual( response.status_code, 302)
industry = Industry.objects.get( name = 'tarams')
self.failUnlessEqual( industry.name, 'tarams')

So my point is it still  shows response as """Your username and
password didn't match. Please try again"""
but my test is not showing any error as before. I just added the login
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'}) to the test_addIndustry functions.

So my doubt is I am doing the correct way.. because I run into some
other problem.
"""function for viewing the list of industry

def test_view_industry(self):
res = self.client.post('/ibms/login/', {'username':'laspal',
'password':'abcd'})
industry = Industry.objects.get(name = 'tarams')
url = '/ibms/crm/industries/' + str(industry.id) + '/
overview/'
response = self.client.post(url)
self.failUnlessEqual( response.status_code, 302)

gives me error saying """Industry matching query does not exist."""
for the test_view_industry function..

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-03 Thread Nick Sandford

On Thu, Jul 3, 2008 at 2:18 PM, laspal <[EMAIL PROTECTED]> wrote:
>
> Hi,
> Thanks for the help but still I am not able to login in my test
> client..
>
> here is the code:
>
> from django.test import TestCase
> from django.test.client import Client
>
> class IndustryTest(TestCase):
>fixtures = ['/fixtures/initial_data.xml']
>
>
>def setUp(self):
>self.client = Client()
>response =self.client.post('/ibms/login/',
> {'username':'laspal', 'passwords':'abcd'})
>print response

did you spell password wrong? passwords != password

Cheers,
Nick

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-02 Thread laspal

Hi,
Thanks for the help but still I am not able to login in my test
client..

here is the code:

from django.test import TestCase
from django.test.client import Client

class IndustryTest(TestCase):
fixtures = ['/fixtures/initial_data.xml']


def setUp(self):
self.client = Client()
response =self.client.post('/ibms/login/',
{'username':'laspal', 'passwords':'abcd'})
print response

test case is as follows:
Loading 'initial_data' fixtures...
Installing xml fixture 'initial_data' from '/home/laspal/work/ibms/../
ibms/crm/fixtures'.
Installing xml fixture 'initial_data' from absolute path.
Installed 207 object(s) from 2 fixture(s)

response > Your username and password didn't match. Please try
again.

and my xml file is contain the username and password :


laspal


[EMAIL PROTECTED]

sha1$f7594$ec2e69b5197b6b26d14a832e4873ab6838a8fe9a


Can any one tell me what I am doing wrong here as I am having a had
time to figure it out...
and if I do user = User.objects.get( username ='laspal') print user
gives me correct value
but dont know why I am, not able to login..

thanks for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-02 Thread Russell Keith-Magee

On Wed, Jul 2, 2008 at 10:14 PM, Norman Harman <[EMAIL PROTECTED]> wrote:
>
> Test system creates a new test database from scratch every time it is
> run.  manage.py loaddata has NO effect on test.
>
> I could be wrong but I don't believe test runner automatically loads the
> fixture initial_data.xml

You are wrong. initial_data is automatically loaded whenever syncdb is
run; syncdb is used to set up the test database, so all initial_data
will be present in a test database.

However, the rest of your analysis is correct - data manually loaded
with loaddata won't be present in the test database. You need to
either define a fixture in your django.test.TestCase, or call the
loaddata management as part of the test case itself.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-02 Thread [EMAIL PROTECTED]

You can check my dump of manage.py test (ran as root) here;
http://dpaste.com/60433/

As you can see the fixture load runs OK... and I even got a couple of
errors on the load process! That sure confirms the fixtures load ;-)
Tests run fine though.

On Jul 2, 4:14 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> laspal wrote:
> > Hi,
> > I have  created initial_data.xml using dumpdata and
> > """manage.py loaddata initial_data.xml""" gives me no error.
> > but still  I am not able to login using setUp().. and this is
> > essential  as all my views functions required login..
>
> > here is my test file:
>
> > import unittest
>
> > from django.test import TestCase
>
> > class IndustryTest(TestCase):
>
> >     def setUp(self):
> >         self.client = Client()
> >         response =self.client.post('/ibms/login/',
> > {'username':'laspal', 'passwords':'abcd'})
> >         print response
>
> > I am still getting the error."""Your username and password didn't
> > match"""
> > Please help me out as I have to write lots of test cases for my view
> > functions.
>
> Test system creates a new test database from scratch every time it is
> run.  manage.py loaddata has NO effect on test.
>
> I could be wrong but I don't believe test runner automatically loads the
> fixture initial_data.xml
>
> You need to tell it what fixtures to load and you need to put them in
> the correct place.
>
> http://www.djangoproject.com/documentation/testing/#fixture-loading
>
> --
> Norman J. Harman Jr.
> Senior Web Specialist, Austin American-Statesman
> ___
> You've got fun!  Check out Austin360.com for all the entertainment
> info you need to live it up in the big city!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-02 Thread Norman Harman

laspal wrote:
> Hi,
> I have  created initial_data.xml using dumpdata and
> """manage.py loaddata initial_data.xml""" gives me no error.
> but still  I am not able to login using setUp().. and this is
> essential  as all my views functions required login..
> 
> here is my test file:
> 
> import unittest
> 
> from django.test import TestCase
> 
> class IndustryTest(TestCase):
> 
> def setUp(self):
> self.client = Client()
> response =self.client.post('/ibms/login/',
> {'username':'laspal', 'passwords':'abcd'})
> print response
> 
> I am still getting the error."""Your username and password didn't
> match"""
> Please help me out as I have to write lots of test cases for my view
> functions.

Test system creates a new test database from scratch every time it is 
run.  manage.py loaddata has NO effect on test.

I could be wrong but I don't believe test runner automatically loads the 
fixture initial_data.xml

You need to tell it what fixtures to load and you need to put them in 
the correct place.

http://www.djangoproject.com/documentation/testing/#fixture-loading


-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-02 Thread laspal

Hi,
I have  created initial_data.xml using dumpdata and
"""manage.py loaddata initial_data.xml""" gives me no error.
but still  I am not able to login using setUp().. and this is
essential  as all my views functions required login..

here is my test file:

import unittest

from django.test import TestCase

class IndustryTest(TestCase):

def setUp(self):
self.client = Client()
response =self.client.post('/ibms/login/',
{'username':'laspal', 'passwords':'abcd'})
print response

I am still getting the error."""Your username and password didn't
match"""
Please help me out as I have to write lots of test cases for my view
functions.

Thanks

On Jul 1, 7:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> > How do I create username and password for the test database.
>
> What I do is either create a test user on SetUp(), or put that
> username inside the "initial_data" fixture, which loads automatically
> when Django creates the test DB...
>
> HTH,
>
> Carlos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-01 Thread [EMAIL PROTECTED]

> How do I create username and password for the test database.

What I do is either create a test user on SetUp(), or put that
username inside the "initial_data" fixture, which loads automatically
when Django creates the test DB...

HTH,

Carlos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-01 Thread laspal

How do I create username and password for the test database.


On Jul 1, 2:24 pm, Julien <[EMAIL PROTECTED]> wrote:
> Hi,
>
> If you're using the SVN version you can try:
>
> >>> c = Client()
> >>> c.login(username='fred', password='secret')
>
> More info here:http://www.djangoproject.com/documentation/testing/
>
> On Jul 1, 5:51 pm, laspal <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am writing the test case but I am getting errors.
>
> > Test case is as follows:
>
> > import unittest
>
> > from django.test.client import Client
> > from django.contrib.auth.models import User, Group
> > from ibm.crm.models import Industry
>
> > class IndustryTest(unittest.TestCase):
>
> > def setUp(self):
> > self.client = Client()
> > response =self.client.post('/ibm/login/',
> > {'username':'laspal', 'password':'abcd'})
> > print response
>
> > Getting error :
>
> > 
>
> >   Your username and password didn't match.
> > Please try again.
>
> >  > for="id_username">Username :   > width="50%" class="loginbox"> > class="vTextField required" name="username" size="15" value="laspal"
> > maxlength="30" />
> >  > for="id_password">Password :   > width="50%" class="loginbox"> > class="vPasswordField required" name="password" size="15" value="abcd"
> > maxlength="30" />
> >  > class="button" type="submit" value="login" />
>
> > 
>
> > So my problem is its not getting login.
> > with same username and login I am able to login in the UI.
> > Does I have to include anything??
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: testing login problem

2008-07-01 Thread Julien

Hi,

If you're using the SVN version you can try:
>>> c = Client()
>>> c.login(username='fred', password='secret')

More info here: http://www.djangoproject.com/documentation/testing/


On Jul 1, 5:51 pm, laspal <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am writing the test case but I am getting errors.
>
> Test case is as follows:
>
> import unittest
>
> from django.test.client import Client
> from django.contrib.auth.models import User, Group
> from ibm.crm.models import Industry
>
> class IndustryTest(unittest.TestCase):
>
>     def setUp(self):
>         self.client = Client()
>         response =self.client.post('/ibm/login/',
> {'username':'laspal', 'password':'abcd'})
>         print response
>
> Getting error :
>
> 
>
>                       Your username and password didn't match.
> Please try again.
>
>  for="id_username">Username :   width="50%" class="loginbox"> class="vTextField required" name="username" size="15" value="laspal"
> maxlength="30" />
>                  for="id_password">Password :   width="50%" class="loginbox"> class="vPasswordField required" name="password" size="15" value="abcd"
> maxlength="30" />
>                  class="button" type="submit" value="login" />
>
> 
>
> So my problem is its not getting login.
> with same username and login I am able to login in the UI.
> Does I have to include anything??
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



testing login problem

2008-07-01 Thread laspal

Hi,

I am writing the test case but I am getting errors.

Test case is as follows:

import unittest

from django.test.client import Client
from django.contrib.auth.models import User, Group
from ibm.crm.models import Industry

class IndustryTest(unittest.TestCase):

def setUp(self):
self.client = Client()
response =self.client.post('/ibm/login/',
{'username':'laspal', 'password':'abcd'})
print response

Getting error :



  Your username and password didn't match.
Please try again.


Username :  
Password :  




So my problem is its not getting login.
with same username and login I am able to login in the UI.
Does I have to include anything??

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



user login problem

2008-06-21 Thread R. K.

So the problem is, that I can't login regular users, who has is_staff
field set to false. If it is set to true, everything is fine. So now
what I have:
default login function (django.contrib.auth.views.login) and the view
which renders the page after login has
django.contrib.auth.decorators.login_required decorator.

And it works without decorator, just manually checking if user is
authenticated. So what could be wrong with that decorator, maybe I
missed something.

Thanks in advance;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 0.96 custom django login problem

2008-03-06 Thread Evert Rol

> I am new to django, and I am trying to create a custom login
> application, from where the users might get access to other
> applications in the system. I can not get it to work, please, I need
> help.

Well, what exactly isn't working? That may give people a better start  
on where to look than the general "Help, it doesn't work".

Btw, sending the code along is fine, but dpaste.com ( http://dpaste.com/about/ 
  ) may be friendlier. Especially as it will keep emails shorter, and  
more focussed on the actual problem & discussion.
Don't forget your settings.py file btw; or at least the important  
parts (we probably don't need your database password).




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



0.96 custom django login problem

2008-03-06 Thread azormx

Hi,

I am new to django, and I am trying to create a custom login
application, from where the users might get access to other
applications in the system. I can not get it to work, please, I need
help.

Project structure:
txm--+--profile
+--app1
+-- ap2

txm.urls
###
# IMPORTS
###
from django.conf.urls.defaults import *

# Imports from self
from txm.views  import Home
from txm.profile.views  import Login #, Logout, Change, Lost
#from txm.docreg.views   import Docreg
#from txm.hlrsd.viewsimport Hlrsd

###
# BINDINGS
###
urlpatterns = patterns('',
# Uncomment this for admin:
(r'^admin/$', include('django.contrib.admin.urls')),

# TXM User Profile
(r'^$', Home),
(r'^login/$',   Login),
#(r'^logout/$',  Logout),
#(r'^change/$',  Change),
#(r'^lost/$',Lost),

# TXM DocReg
#(r'^docreg/$', Docreg),

# TXM HLR Subscriber Data
#(r'^hlrsd/$', Hlrsd),
)



txm.views
###
# IMPORTS
###

# Imports from Python

# Imports from Django
from django.shortcuts import render_to_response
from django.http  import HttpResponseRedirect
# Imports from self


###
# CONSTANTS
###


###
# VIEWS
###

def Home(request):
"""System home/main page

   This is the main page, from where the system provided
applications
 can be delivered.
"""

if  request.user.is_authenticated():
return render_to_response('applications.html', {})

return HttpResponseRedirect('/login')




tmx.profile.views
###
# IMPORTS
###

# Imports from Python

# Imports from Django
from django.shortcuts import render_to_response
from django   import newforms as forms
from django.core  import validators

# Imports from self
from txm.profile.forms import LoginForm


###
# CONSTANTS
###


###
# VIEWS
###

def Login(request):
""" User login

User login to system access
"""

form = new_data = message = None

# Verify correct method
if  request.GET:
form = LoginForm()
new_data = request.GET.copy()
message  = new_data['message']

return render_to_response('login.html', {'form':form,
'message':message})

if  request.POST:

# Proceed to acquire user login
form = LoginForm(request.POST)
new_data = request.POST.copy()
message  = new_data['message']

# Validate and authenticate user login
if  form.is_valid():
return render_to_response('applications.html', {})
else:
return render_to_response('login.html', {'form':form,
'message':message})

return render_to_response('login.html', {'form':form,
'message':message})


txm.profile.forms
###
# IMPORTS
###

# Imports from Python
import re

# Imports from Django
from django  import newforms as forms
from django.core import validators
from django.contrib.auth import authenticate, login


###
# CONSTANTS
###

# Use custom form validator for:
#   - User name
#   - User password

# User name
user_name_length_min = 3
user_name_length_max = 15
user_name_regex  = r'^[a-zA-Z0-9\.\_\-]{%d,%d}$' %
(user_name_length_min, user_name_length_max)
user_name_msg= u'User name validation must be %s-%s long, can
only contain letters, numbers, underscores, dash, and dot'

# User password
user_password_length_min = 6
user_password_length_max = 15
user_password_regex  = r'^[a-zA-Z0-9\.\_\-]{%d,%d}$' %
(user_password_length_min, user_password_length_m

Re: Redirect after login problem

2007-09-30 Thread Paddy Joy

Thanks guys,

I didn't fully understand the meaning of "redirect_field_name".

@login_required() on it's own works as expected.

Paddy

On Sep 30, 3:19 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 9/29/07, Paddy Joy <[EMAIL PROTECTED]> wrote:
>
> > views.py
> > @login_required(redirect_field_name='/login/')
> > def index(request)
>
> You're using the 'redirect_field_name' argument incorrectly.
>
> The default value is 'next', which means Django will expect something like 
> this:
>
> http://yoursite.com/accounts/login/?next=/some_auth_required_page/
>
> But when you change the value of 'redirect_field_name', you're
> changing the name of the *variable* Django looks for; in other words,
> you're changing the '?next' bit, not the '/some_auth_required_page/'
> bit. So if you pass 'redirect_field_name="foo"', for example, Django
> will look for something like
>
> http://yoursite.com/accounts/login/?foo=/some_auth_required_page/
>
> And NOT something like
>
> http://yoursite.com/accounts/login/?next=foo
>
> See the documentation for details:
>
> http://www.djangoproject.com/documentation/authentication/#the-login-...
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Redirect after login problem

2007-09-29 Thread James Bennett

On 9/29/07, Paddy Joy <[EMAIL PROTECTED]> wrote:
> views.py
> @login_required(redirect_field_name='/login/')
> def index(request)

You're using the 'redirect_field_name' argument incorrectly.

The default value is 'next', which means Django will expect something like this:

http://yoursite.com/accounts/login/?next=/some_auth_required_page/

But when you change the value of 'redirect_field_name', you're
changing the name of the *variable* Django looks for; in other words,
you're changing the '?next' bit, not the '/some_auth_required_page/'
bit. So if you pass 'redirect_field_name="foo"', for example, Django
will look for something like

http://yoursite.com/accounts/login/?foo=/some_auth_required_page/

And NOT something like

http://yoursite.com/accounts/login/?next=foo

See the documentation for details:

http://www.djangoproject.com/documentation/authentication/#the-login-required-decorator

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Redirect after login problem

2007-09-29 Thread Przemek Gawronski

Hi

> I'm using the following code, anyone got any ideas what could be
> wrong?

> @login_required(redirect_field_name='/login/')

My guess is, that it should be:

@login_required(redirect_field_name='/hosting/login/')

> urls.py
> # Login
> (r'^hosting/login/$', 'django.contrib.auth.views.login',
> {'template_name': 'hosting/login.html'})

or in your urls, you should also include a redirection:
'^login/$' => '^hosting/login/$'

Hope that helps

Przemek
-- 
AIKIDO TANREN DOJO  -   Poland - Warsaw - Mokotow - Ursynow - Natolin
info:   http://tanren.pl/   phone:+4850151   email:[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Redirect after login problem

2007-09-29 Thread Paddy Joy

I'm having some problems getting the "next" variable to work in the
authentication module. After a user is logged in the page is
redirected to /accounts/profile rather than being directed to the
"next" variable.

I'm using the following code, anyone got any ideas what could be
wrong?


views.py
@login_required(redirect_field_name='/login/')
def index(request)

urls.py
# Login
(r'^hosting/login/$', 'django.contrib.auth.views.login',
{'template_name': 'hosting/login.html'})

settings.py
LOGIN_URL = '/hosting/login/



hosting/login.html
{% extends "base.html" %}

{% block content %}

{% if form.has_errors %}
Your username and password didn't match. Please try again.
{% endif %}



Username:{{ form.username }}
Password:{{ form.password }}






{% endblock %}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin login problem

2006-12-15 Thread Yatla

Jorge,

Turns out that I did need to modify the url as you indicated like

 (r'^galeria/admin/', include('django.contrib.admin.urls')),

the first time the site or my browser must have been caching something
and it seemed to work.

Now onwards to build the site

Yatla

On Dec 13, 4:35 pm, "Yatla" <[EMAIL PROTECTED]> wrote:
> Jorge,
>
> Many thanks!  I was using an .htaccess in the subdirectory, but did not
> have the subdirectory specified after the fcgi file in the last rewrite
> rule.  I don't know much about this so just copied from a tutorial on
> this that did not have the subdirectory in the rewriterule.  Thanks
> again!
>
> btw, it seems to work correctly whether I had the subdirectory in front
> of the admin/ or not in the url.py file, ie, just
> (r'^admin/', include('django.contrib.admin.urls')),
> seems to work after I modified the rewriterule.
> 
> Yatla


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin login problem

2006-12-13 Thread Yatla

Jorge,

Many thanks!  I was using an .htaccess in the subdirectory, but did not
have the subdirectory specified after the fcgi file in the last rewrite
rule.  I don't know much about this so just copied from a tutorial on
this that did not have the subdirectory in the rewriterule.  Thanks
again!

btw, it seems to work correctly whether I had the subdirectory in front
of the admin/ or not in the url.py file, ie, just
(r'^admin/', include('django.contrib.admin.urls')),
seems to work after I modified the rewriterule.

Yatla


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin login problem

2006-12-13 Thread Jorge Gajon

On 12/12/06, Yatla <[EMAIL PROTECTED]> wrote:
>
> Newbie here - saw that the same question was asked earlier but not
> answered, and the post was locked so I could not reply.
>
> I have a Django site in a subdirectory as follows (via fcgi) - (using
> ver 0.96 pre via svn)
>
> http://mydomain.com/dj
>
> When I go into the Admin area as follows
>
> http://mydomain.com/dj/Admin/
>
> The login form that comes up has action="/admin/" (not "/dj/admin"), so
> the post goes to
>
> http://mydomain.com/admin
>
> which is not the Django site.  Somehow the /dg/ subdirectory info is
> not prefixed to the form action.  Is there a configuration with the
> main site prefix that I'm missing somwhere, I ony see path to media to
> be set in tte seetings?
>

Hi Yatla,
Are you using an .htaccess file? I have a site on Dreamhost in which
my Django app live under a sub-url like this:
http://mydomain.com/galeria/

In my .htaccess file (in the 'galeria' folder of the domain) I have
the following rules:

RewriteEngine On
RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/galeria/$1 [L]


Remember that in your urls.py file you will need to include the admin
urls like this:

 (r'^galeria/admin/', include('django.contrib.admin.urls')),


Hope it helps.

Regards,
Jorge

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin login problem

2006-12-12 Thread Yatla

Newbie here - saw that the same question was asked earlier but not
answered, and the post was locked so I could not reply.

I have a Django site in a subdirectory as follows (via fcgi) - (using
ver 0.96 pre via svn)

http://mydomain.com/dj

When I go into the Admin area as follows

http://mydomain.com/dj/Admin/

The login form that comes up has action="/admin/" (not "/dj/admin"), so
the post goes to

http://mydomain.com/admin

which is not the Django site.  Somehow the /dg/ subdirectory info is
not prefixed to the form action.  Is there a configuration with the
main site prefix that I'm missing somwhere, I ony see path to media to
be set in tte seetings?

Thanks


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin login Problem (not the one in the FAQ)

2005-09-02 Thread Boffbowsh

or md5 -s 'password'



Re: Admin login Problem (not the one in the FAQ)

2005-09-01 Thread igor

Quoting "J. Davis" <[EMAIL PROTECTED]>:
>
> # echo "password" | md5sum
>
> Can anyone suggest how else I might troubleshoot this?

You should use: echo -n "password" | md5sum


Igor.


Re: Admin login Problem (not the one in the FAQ)

2005-09-01 Thread J. Davis

That did the trick.
Thanks Adrian!

-Jake



Re: Admin login Problem (not the one in the FAQ)

2005-09-01 Thread Adrian Holovaty

On 9/1/05, J. Davis <[EMAIL PROTECTED]> wrote:
> To create the password I paste in the output from the following
> command:
> 
> # echo "password" | md5sum
> 
> Can anyone suggest how else I might troubleshoot this?

It appears the md5sum shell command doesn't generate the same output
as Python's md5. Django's md5s are generated like so:

>>> import md5
>>> md5.new('password').hexdigest()

Generate the md5 that way, and you should be good to go. Or spare
yourself the low-level trouble and use this:

>>> from django.models.auth import users
>>> u = users.create_user('username', '[EMAIL PROTECTED]', 'password')
>>> u.is_staff = True
>>> u.save()

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org


Admin login Problem (not the one in the FAQ)

2005-09-01 Thread J. Davis

Hello,
I'm greatly enjoying this excellent project.
However, I have a problem with users created through the admin web
interface being able to log into the admin site.
I get "Please enter a correct username and password." Even though all
users have "is_active" and "is_staff" set to True.
It's definitely *not* a typo/caps-lock thing.

I'm using MySQL.
To create the password I paste in the output from the following
command:

# echo "password" | md5sum

Can anyone suggest how else I might troubleshoot this? 

Thanks,
-Jake