Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Yes I was trying to implement it for learning django properly. Alright , I
got your point.


On Thu, Mar 20, 2014 at 9:55 PM, C. Kirby  wrote:

> Are you building your own authentication system as a learning opportunity
> or to actually use in a production system? If it is for a production system
> then...don't. There is quite a bit of code in django Users to handle
> passwords and keep passwords safe and authentication secure.
>
> If you want to expand on the User model or modify it then you should
> extend or substitute the existing User model (
> https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#extending-the-existing-user-model
> )
>
> That page also has information about hooking into different authentication
> backends if you want to use an existing source of users (for instance to
> use LDAP or the like)
>
>
>
>
> On Thursday, March 20, 2014 9:06:48 AM UTC-5, Aryak Sengupta wrote:
>>
>> I am new to Django (but not new to python) and I am looking forward to
>> create a customized  page using django.  I have read about django's inbuilt
>> authentication system but I want build it from scratch So here are the few
>> ideas I am stumbling upon :
>>
>>
>>1. Creating a *users* class in the models.py with username and
>>password as the fields (both are CharField)
>>
>>2. Creating  two views one named *LoginView*, which will depict the
>>initial login page (such as a *form* imported from a *module named
>> forms.py*) and another view named *LoggedInView* which will show
>>only the username of the logged user
>>
>>3. Mapping them into corresponding URLs
>>
>> I tried creating it with above mentioned thoughts but I got stuck with an
>> error as follows:
>>
>> Forbidden (403)
>>
>> CSRF verification failed. Request aborted.
>> Help
>>
>> Reason given for failure:
>>
>> CSRF cookie not set.
>>
>>
>> I couldn't figure out why possibly I am getting this error for
>> incorporating such a simple(and basic) functionality.
>>
>> *I want to understand the best way/approach to go about this (for
>> implementing this functionality). I am not worrying about the error for the
>> time being since I didn't spend much time thinking about it (So I am not
>> posting any code). I want to get my approach right first. I want to be
>> flawless while implementing such basic and elementary stuffs.  *
>>
>  --
> 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/fa3d5877-2098-4cb0-a2ae-8f503f24d517%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALTbq1wS_feOyHp-b8Yn6ZgRNhB_wHtXpLome5TJA6nar0S0rQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread C. Kirby
Are you building your own authentication system as a learning opportunity 
or to actually use in a production system? If it is for a production system 
then...don't. There is quite a bit of code in django Users to handle 
passwords and keep passwords safe and authentication secure.

If you want to expand on the User model or modify it then you should extend 
or substitute the existing User model 
(https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#extending-the-existing-user-model)

That page also has information about hooking into different authentication 
backends if you want to use an existing source of users (for instance to 
use LDAP or the like)



On Thursday, March 20, 2014 9:06:48 AM UTC-5, Aryak Sengupta wrote:
>
> I am new to Django (but not new to python) and I am looking forward to 
> create a customized  page using django.  I have read about django's inbuilt 
> authentication system but I want build it from scratch So here are the few 
> ideas I am stumbling upon :
>
>
>1. Creating a *users* class in the models.py with username and 
>password as the fields (both are CharField)
>
>2. Creating  two views one named *LoginView*, which will depict the 
>initial login page (such as a *form* imported from a *module named 
> forms.py*) and another view named *LoggedInView* which will show only 
>the username of the logged user
>
>3. Mapping them into corresponding URLs
>
> I tried creating it with above mentioned thoughts but I got stuck with an 
> error as follows:
>
> Forbidden (403)
>
> CSRF verification failed. Request aborted.
> Help
>
> Reason given for failure:
>
> CSRF cookie not set.
>
>
> I couldn't figure out why possibly I am getting this error for 
> incorporating such a simple(and basic) functionality.
>
> *I want to understand the best way/approach to go about this (for 
> implementing this functionality). I am not worrying about the error for the 
> time being since I didn't spend much time thinking about it (So I am not 
> posting any code). I want to get my approach right first. I want to be 
> flawless while implementing such basic and elementary stuffs.  *
>

-- 
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/fa3d5877-2098-4cb0-a2ae-8f503f24d517%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
You need to have sessions if you want login so you can tie a browser to a user, 
and the CSRF is tied to the session cookie.

F.

On Mar 20, 2014, at 11:28 AM, Aryak Sengupta  wrote:

> Alright... Thanks  a lot. But do I really require using sessions for 
> implementing this simple functionality ... Or is it just a bad design that I 
> had been trying?
> 
> On 20 Mar 2014 20:28, "François Schiettecatte"  
> wrote:
> See https://docs.djangoproject.com/en/1.6/topics/http/sessions/
> 
> On Mar 20, 2014, at 10:50 AM, Aryak Sengupta  wrote:
> 
> > Can you please elaborate
> >
> > On 20 Mar 2014 20:17, "François Schiettecatte"  
> > wrote:
> > You may be missing some middleware, eg:
> >
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.csrf.CsrfViewMiddleware',
> >
> > 'django.contrib.sessions',
> >
> > Maybe your browser is rejecting cookies.
> >
> > François
> >
> > On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  
> > wrote:
> >
> > > Yes I do Where am I going wrong then?
> > >
> > > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > > do you have {% csrf_token % } in your forms?
> > >
> > >
> > > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> > > wrote:
> > > I am new to Django (but not new to python) and I am looking forward to 
> > > create a customized  page using django.  I have read about django's 
> > > inbuilt authentication system but I want build it from scratch So here 
> > > are the few ideas I am stumbling upon :
> > >
> > >   • Creating a users class in the models.py with username and 
> > > password as the fields (both are CharField)
> > >
> > >   • Creating  two views one named LoginView, which will depict the 
> > > initial login page (such as a form imported from a module named  
> > > forms.py) and another view named LoggedInView which will show only the 
> > > username of the logged user
> > >
> > >   • Mapping them into corresponding URLs
> > > I tried creating it with above mentioned thoughts but I got stuck with an 
> > > error as follows:
> > >
> > > Forbidden (403)
> > > CSRF verification failed. Request aborted.
> > > Help
> > >
> > > Reason given for failure:
> > > CSRF cookie not set.
> > >
> > > I couldn't figure out why possibly I am getting this error for 
> > > incorporating such a simple(and basic) functionality.
> > >
> > > I want to understand the best way/approach to go about this (for 
> > > implementing this functionality). I am not worrying about the error for 
> > > the time being since I didn't spend much time thinking about it (So I am 
> > > not posting any code). I want to get my approach right first. I want to 
> > > be flawless while implementing such basic and elementary stuffs.
> > >
> > > --
> > > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > --
> > > 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > > --
> > > 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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > 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-u

Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Alright... Thanks  a lot. But do I really require using sessions for
implementing this simple functionality ... Or is it just a bad design that
I had been trying?
On 20 Mar 2014 20:28, "François Schiettecatte" 
wrote:

> See https://docs.djangoproject.com/en/1.6/topics/http/sessions/
>
> On Mar 20, 2014, at 10:50 AM, Aryak Sengupta 
> wrote:
>
> > Can you please elaborate
> >
> > On 20 Mar 2014 20:17, "François Schiettecatte" 
> wrote:
> > You may be missing some middleware, eg:
> >
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.csrf.CsrfViewMiddleware',
> >
> > 'django.contrib.sessions',
> >
> > Maybe your browser is rejecting cookies.
> >
> > François
> >
> > On Mar 20, 2014, at 10:43 AM, Aryak Sengupta 
> wrote:
> >
> > > Yes I do Where am I going wrong then?
> > >
> > > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > > do you have {% csrf_token % } in your forms?
> > >
> > >
> > > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta <
> aryaksengu...@gmail.com> wrote:
> > > I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
> > >
> > >   * Creating a users class in the models.py with username and
> password as the fields (both are CharField)
> > >
> > >   * Creating  two views one named LoginView, which will depict the
> initial login page (such as a form imported from a module named  forms.py)
> and another view named LoggedInView which will show only the username of
> the logged user
> > >
> > >   * Mapping them into corresponding URLs
> > > I tried creating it with above mentioned thoughts but I got stuck with
> an error as follows:
> > >
> > > Forbidden (403)
> > > CSRF verification failed. Request aborted.
> > > Help
> > >
> > > Reason given for failure:
> > > CSRF cookie not set.
> > >
> > > I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
> > >
> > > I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.
> > >
> > > --
> > > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com
> .
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > --
> > > 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com
> .
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > > --
> > > 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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com
> .
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > 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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com
> .
> > For more options, visit http

Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
See https://docs.djangoproject.com/en/1.6/topics/http/sessions/

On Mar 20, 2014, at 10:50 AM, Aryak Sengupta  wrote:

> Can you please elaborate
> 
> On 20 Mar 2014 20:17, "François Schiettecatte"  
> wrote:
> You may be missing some middleware, eg:
> 
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 
> 'django.contrib.sessions',
> 
> Maybe your browser is rejecting cookies.
> 
> François
> 
> On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  wrote:
> 
> > Yes I do Where am I going wrong then?
> >
> > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > do you have {% csrf_token % } in your forms?
> >
> >
> > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> > wrote:
> > I am new to Django (but not new to python) and I am looking forward to 
> > create a customized  page using django.  I have read about django's inbuilt 
> > authentication system but I want build it from scratch So here are the few 
> > ideas I am stumbling upon :
> >
> >   • Creating a users class in the models.py with username and password 
> > as the fields (both are CharField)
> >
> >   • Creating  two views one named LoginView, which will depict the 
> > initial login page (such as a form imported from a module named  forms.py) 
> > and another view named LoggedInView which will show only the username of 
> > the logged user
> >
> >   • Mapping them into corresponding URLs
> > I tried creating it with above mentioned thoughts but I got stuck with an 
> > error as follows:
> >
> > Forbidden (403)
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> > CSRF cookie not set.
> >
> > I couldn't figure out why possibly I am getting this error for 
> > incorporating such a simple(and basic) functionality.
> >
> > I want to understand the best way/approach to go about this (for 
> > implementing this functionality). I am not worrying about the error for the 
> > time being since I didn't spend much time thinking about it (So I am not 
> > posting any code). I want to get my approach right first. I want to be 
> > flawless while implementing such basic and elementary stuffs.
> >
> > --
> > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > 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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Can you please elaborate
On 20 Mar 2014 20:17, "François Schiettecatte" 
wrote:

> You may be missing some middleware, eg:
>
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
>
> 'django.contrib.sessions',
>
> Maybe your browser is rejecting cookies.
>
> François
>
> On Mar 20, 2014, at 10:43 AM, Aryak Sengupta 
> wrote:
>
> > Yes I do Where am I going wrong then?
> >
> > On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> > do you have {% csrf_token % } in your forms?
> >
> >
> > On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta 
> wrote:
> > I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
> >
> >   * Creating a users class in the models.py with username and
> password as the fields (both are CharField)
> >
> >   * Creating  two views one named LoginView, which will depict the
> initial login page (such as a form imported from a module named  forms.py)
> and another view named LoggedInView which will show only the username of
> the logged user
> >
> >   * Mapping them into corresponding URLs
> > I tried creating it with above mentioned thoughts but I got stuck with
> an error as follows:
> >
> > Forbidden (403)
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> > CSRF cookie not set.
> >
> > I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
> >
> > I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.
> >
> > --
> > 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > 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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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/CALTbq1xzxJ8LmH6gkLSMcFZ5Ec0X-XW7q1N0v0YpnX_qoJVWtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread François Schiettecatte
You may be missing some middleware, eg:

'django.contrib.sessions.middleware.SessionMiddleware', 
'django.middleware.csrf.CsrfViewMiddleware', 

'django.contrib.sessions',

Maybe your browser is rejecting cookies.

François

On Mar 20, 2014, at 10:43 AM, Aryak Sengupta  wrote:

> Yes I do Where am I going wrong then?
> 
> On 20 Mar 2014 20:06, "Robin Lery"  wrote:
> do you have {% csrf_token % } in your forms?
> 
> 
> On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta  
> wrote:
> I am new to Django (but not new to python) and I am looking forward to create 
> a customized  page using django.  I have read about django's inbuilt 
> authentication system but I want build it from scratch So here are the few 
> ideas I am stumbling upon :
> 
>   • Creating a users class in the models.py with username and password as 
> the fields (both are CharField)
> 
>   • Creating  two views one named LoginView, which will depict the 
> initial login page (such as a form imported from a module named  forms.py) 
> and another view named LoggedInView which will show only the username of the 
> logged user
> 
>   • Mapping them into corresponding URLs
> I tried creating it with above mentioned thoughts but I got stuck with an 
> error as follows:
> 
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> 
> Reason given for failure:
> CSRF cookie not set.
> 
> I couldn't figure out why possibly I am getting this error for incorporating 
> such a simple(and basic) functionality.
> 
> I want to understand the best way/approach to go about this (for implementing 
> this functionality). I am not worrying about the error for the time being 
> since I didn't spend much time thinking about it (So I am not posting any 
> code). I want to get my approach right first. I want to be flawless while 
> implementing such basic and elementary stuffs.  
> 
> -- 
> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
Yes I do Where am I going wrong then?
On 20 Mar 2014 20:06, "Robin Lery"  wrote:

> do you have {% csrf_token % } in your forms?
>
>
> On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta 
> wrote:
>
>> I am new to Django (but not new to python) and I am looking forward to
>> create a customized  page using django.  I have read about django's inbuilt
>> authentication system but I want build it from scratch So here are the few
>> ideas I am stumbling upon :
>>
>>
>>1. Creating a *users* class in the models.py with username and
>>password as the fields (both are CharField)
>>
>>2. Creating  two views one named *LoginView*, which will depict the
>>initial login page (such as a *form* imported from a *module named
>> forms.py*) and another view named *LoggedInView* which will show
>>only the username of the logged user
>>
>>3. Mapping them into corresponding URLs
>>
>> I tried creating it with above mentioned thoughts but I got stuck with an
>> error as follows:
>>
>> Forbidden (403)
>>
>> CSRF verification failed. Request aborted.
>> Help
>>
>> Reason given for failure:
>>
>> CSRF cookie not set.
>>
>>
>> I couldn't figure out why possibly I am getting this error for
>> incorporating such a simple(and basic) functionality.
>>
>> *I want to understand the best way/approach to go about this (for
>> implementing this functionality). I am not worrying about the error for the
>> time being since I didn't spend much time thinking about it (So I am not
>> posting any code). I want to get my approach right first. I want to be
>> flawless while implementing such basic and elementary stuffs.  *
>>
>> --
>> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALTbq1zEC9RPPKmVvTOYqXQ5AgVghzDWd0og2FoeKBJOMyfe1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Login page in Django

2014-03-20 Thread Robin Lery
do you have {% csrf_token % } in your forms?


On Thu, Mar 20, 2014 at 7:36 PM, Aryak Sengupta wrote:

> I am new to Django (but not new to python) and I am looking forward to
> create a customized  page using django.  I have read about django's inbuilt
> authentication system but I want build it from scratch So here are the few
> ideas I am stumbling upon :
>
>
>1. Creating a *users* class in the models.py with username and
>password as the fields (both are CharField)
>
>2. Creating  two views one named *LoginView*, which will depict the
>initial login page (such as a *form* imported from a *module named
> forms.py*) and another view named *LoggedInView* which will show only
>the username of the logged user
>
>3. Mapping them into corresponding URLs
>
> I tried creating it with above mentioned thoughts but I got stuck with an
> error as follows:
>
> Forbidden (403)
>
> CSRF verification failed. Request aborted.
> Help
>
> Reason given for failure:
>
> CSRF cookie not set.
>
>
> I couldn't figure out why possibly I am getting this error for
> incorporating such a simple(and basic) functionality.
>
> *I want to understand the best way/approach to go about this (for
> implementing this functionality). I am not worrying about the error for the
> time being since I didn't spend much time thinking about it (So I am not
> posting any code). I want to get my approach right first. I want to be
> flawless while implementing such basic and elementary stuffs.  *
>
> --
> 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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2B4-nGq8taHb%2B9%2Bz3%3DxJq-Qitnuf0%3D127O9esk8LZygSQLeSZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Custom Login page in Django

2014-03-20 Thread Aryak Sengupta
I am new to Django (but not new to python) and I am looking forward to 
create a customized  page using django.  I have read about django's inbuilt 
authentication system but I want build it from scratch So here are the few 
ideas I am stumbling upon :


   1. Creating a *users* class in the models.py with username and password 
   as the fields (both are CharField)
   
   2. Creating  two views one named *LoginView*, which will depict the 
   initial login page (such as a *form* imported from a *module named 
forms.py*) and another view named *LoggedInView* which will show only 
   the username of the logged user
   
   3. Mapping them into corresponding URLs

I tried creating it with above mentioned thoughts but I got stuck with an 
error as follows:

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure:

CSRF cookie not set.


I couldn't figure out why possibly I am getting this error for 
incorporating such a simple(and basic) functionality.

*I want to understand the best way/approach to go about this (for 
implementing this functionality). I am not worrying about the error for the 
time being since I didn't spend much time thinking about it (So I am not 
posting any code). I want to get my approach right first. I want to be 
flawless while implementing such basic and elementary stuffs.  *

-- 
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/4f18d65c-8e85-434f-b584-0ab7017f6cf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Jason Sibre
Hi,
Just a hunch, but it kinda smells like your web server isn't executing the CGI 
script.  I'd suggest checking into what is necessary to get your server to 
execute CGI, vs serving it up as text.


On Oct 15, 2012, at 5:40 AM, Pervez Mulla wrote:

> Instead of CGI server path , I places perl script in static folder and given 
> path for that . 
> 
> On Mon, Oct 15, 2012 at 4:09 PM, Pervez Mulla  wrote:
> responseText: #!/usr/bin/perl -T use CGI; use DBI; use strict; use warnings; 
> use netsharkusr; my $cgi = CGI->new; my $username = $cgi->param("username"); 
> my $password = $cgi->param("password"); my $tempuser = new netsharkusr(); 
> if($tempuser->readbyusername($username) eq 1) { if($tempuser->{username} eq 
> $username) { print "success \n"; #exit; } } #$password = "123go"; my $userid; 
> my $tempuser2 = new netsharkusr(); if($tempuser2->readbypassword($password)) 
> { if($tempuser2->{password} eq $password) { print "sccess \n"; $userid = 
> $tempuser2->{userID}; } } # check the username and password in the database # 
> create a JSON string according to the database result my $json = ($userid) ? 
> qq{{"success" : "login is successful", "userid" : $userid}} : qq{{"error" : 
> "username or password is wrong"}}; # return JSON string print 
> $cgi->header(-type => "application/json", -charset => "utf-8"); print $json;, 
> textStatus: parsererror, errorThrown: undefined
> 
> 
> On Mon, Oct 15, 2012 at 4:07 PM, Sergiy Khohlov  wrote:
> please provide error
> 
> 2012/10/15 Pervez Mulla :
> > On error note its printing all pelr script itself.
> >
> >
> > On Mon, Oct 15, 2012 at 3:31 PM, Sergiy Khohlov  wrote:
> >>
> >> please provide error message
> >>
> >> 2012/10/15 Pervez Mulla :
> >> > Thank You for your response Sergiy ,
> >> >
> >> > I already try'd to run this script as shown in Django DOC as u given
> >> > .but
> >> > still it didnt work:(
> >> >
> >> > Thank You
> >> > Pervez
> >> >
> >> > On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov 
> >> > wrote:
> >> >>
> >> >>
> >> >> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
> >> >>
> >> >>  set this one in setting.py
> >> >>
> >> >> 2012/10/15 Pervez Mulla :
> >> >> > Hi,
> >> >> >
> >> >> > I have login.html , login,js ang login.pl.
> >> >> >
> >> >> > I want to integrate basic login page in Django with perl back-end
> >> >> > from
> >> >> > where
> >> >> > Am reading my DB.
> >> >> > I was trying to integrate it from last day but come out with empty
> >> >> > .There
> >> >> > might be some settings in setting.py.
> >> >> > Below is my code
> >> >> >
> >> >> > --
> >> >> > login.html
> >> >> > --
> >> >> > http://www.w3.org/1999/xhtml";>
> >> >> >   
> >> >> >  >> >> > />
> >> >> >  >> >> > src="jquery-1.7.2.min.js">
> >> >> > 
> >> >> > 
> >> >> >   #loginContent { width: 350px; margin: 100px auto; }
> >> >> >   button[type] { margin: 0.5em 0; }
> >> >> > label {font-weight:bold;}
> >> >> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px
> >> >> > solid
> >> >> > #ccc;}
> >> >> > legend
> >> >> >
> >> >> > {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
> >> >> > fieldset, #IE8#HACK {padding-top:1.4em;}
> >> >> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
> >> >> > input[type=text], input[type=password], input.text, input.title,
> >> >> > textarea
> >> >> > {background-color:#fff;border:1px solid #bbb;}
> >> >> > input[type=text]:focus, input[type=password]:focus, input.text:focus,
> >> >> > input.title:focus, textarea:focus {border-color:#666;}
> >> >> > select {background-color:#fff;border-width:1px;border-style:solid;}
> >> >> > input[type=text], input[type=password], input.text, input.title,
> >> >> > textarea,
> >> >> > select {margin:0.5em 0;}
> >> >> > input.text, input.title {width:300px;padding:5px;}
> >> >> > input.title {font-size:1.5em;}
> >> >> > textarea {width:390px;height:250px;padding:5px;}
> >> >> > form.inline {line-height:3;}
> >> >> > form.inline p {margin-bottom:0;}
> >> >> > .error, .alert, .notice, .success, .info
> >> >> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
> >> >> > .error, .alert
> >> >> > {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
> >> >> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
> >> >> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
> >> >> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
> >> >> > .error a, .alert a {color:#8a1f11;}
> >> >> > .notice a {color:#514721;}
> >> >> > .success a {color:#264409;}
> >> >> > .info a {color:#205791;}
> >> >> > 
> >> >> >   
> >> >> >   
> >> >> > 
> >> >> >   
> >> >> >   
> >> >> >   
> >> >> > 
> >> >> >   Enter information
> >> >> >   
> >> >> > Username >> >> > id="username" name="username" class="text" size="20" />
> >> >> >   
> >> >> >   
> >> >> > Password >> >> 

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Pervez Mulla
Instead of CGI server path , I places perl script in static folder and
given path for that .

On Mon, Oct 15, 2012 at 4:09 PM, Pervez Mulla  wrote:

> responseText: #!/usr/bin/perl -T use CGI; use DBI; use strict; use
> warnings; use netsharkusr; my $cgi = CGI->new; my $username =
> $cgi->param("username"); my $password = $cgi->param("password"); my
> $tempuser = new netsharkusr(); if($tempuser->readbyusername($username) eq
> 1) { if($tempuser->{username} eq $username) { print "success \n"; #exit; }
> } #$password = "123go"; my $userid; my $tempuser2 = new netsharkusr();
> if($tempuser2->readbypassword($password)) { if($tempuser2->{password} eq
> $password) { print "sccess \n"; $userid = $tempuser2->{userID}; } } # check
> the username and password in the database # create a JSON string according
> to the database result my $json = ($userid) ? qq{{"success" : "login is
> successful", "userid" : $userid}} : qq{{"error" : "username or password is
> wrong"}}; # return JSON string print $cgi->header(-type =>
> "application/json", -charset => "utf-8"); print $json;, textStatus:
> parsererror, errorThrown: undefined
>
>
> On Mon, Oct 15, 2012 at 4:07 PM, Sergiy Khohlov wrote:
>
>> please provide error
>>
>> 2012/10/15 Pervez Mulla :
>> > On error note its printing all pelr script itself.
>> >
>> >
>> > On Mon, Oct 15, 2012 at 3:31 PM, Sergiy Khohlov 
>> wrote:
>> >>
>> >> please provide error message
>> >>
>> >> 2012/10/15 Pervez Mulla :
>> >> > Thank You for your response Sergiy ,
>> >> >
>> >> > I already try'd to run this script as shown in Django DOC as u given
>> >> > .but
>> >> > still it didnt work:(
>> >> >
>> >> > Thank You
>> >> > Pervez
>> >> >
>> >> > On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov 
>> >> > wrote:
>> >> >>
>> >> >>
>> >> >>
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
>> >> >>
>> >> >>  set this one in setting.py
>> >> >>
>> >> >> 2012/10/15 Pervez Mulla :
>> >> >> > Hi,
>> >> >> >
>> >> >> > I have login.html , login,js ang login.pl.
>> >> >> >
>> >> >> > I want to integrate basic login page in Django with perl back-end
>> >> >> > from
>> >> >> > where
>> >> >> > Am reading my DB.
>> >> >> > I was trying to integrate it from last day but come out with empty
>> >> >> > .There
>> >> >> > might be some settings in setting.py.
>> >> >> > Below is my code
>> >> >> >
>> >> >> > --
>> >> >> > login.html
>> >> >> > --
>> >> >> > http://www.w3.org/1999/xhtml";>
>> >> >> >   
>> >> >> > > >> >> > />
>> >> >> > > >> >> > src="jquery-1.7.2.min.js">
>> >> >> > 
>> >> >> > 
>> >> >> >   #loginContent { width: 350px; margin: 100px auto; }
>> >> >> >   button[type] { margin: 0.5em 0; }
>> >> >> > label {font-weight:bold;}
>> >> >> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em
>> 0;border:1px
>> >> >> > solid
>> >> >> > #ccc;}
>> >> >> > legend
>> >> >> >
>> >> >> >
>> {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
>> >> >> > fieldset, #IE8#HACK {padding-top:1.4em;}
>> >> >> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
>> >> >> > input[type=text], input[type=password], input.text, input.title,
>> >> >> > textarea
>> >> >> > {background-color:#fff;border:1px solid #bbb;}
>> >> >> > input[type=text]:focus, input[type=password]:focus,
>> input.text:focus,
>> >> >> > input.title:focus, textarea:focus {border-color:#666;}
>> >> >> > select
>> {background-color:#fff;border-width:1px;border-style:solid;}
>> >> >> > input[type=text], input[type=password], input.text, input.title,
>> >> >> > textarea,
>> >> >> > select {margin:0.5em 0;}
>> >> >> > input.text, input.title {width:300px;padding:5px;}
>> >> >> > input.title {font-size:1.5em;}
>> >> >> > textarea {width:390px;height:250px;padding:5px;}
>> >> >> > form.inline {line-height:3;}
>> >> >> > form.inline p {margin-bottom:0;}
>> >> >> > .error, .alert, .notice, .success, .info
>> >> >> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
>> >> >> > .error, .alert
>> >> >> > {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
>> >> >> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
>> >> >> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
>> >> >> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
>> >> >> > .error a, .alert a {color:#8a1f11;}
>> >> >> > .notice a {color:#514721;}
>> >> >> > .success a {color:#264409;}
>> >> >> > .info a {color:#205791;}
>> >> >> > 
>> >> >> >   
>> >> >> >   
>> >> >> > 
>> >> >> >   
>> >> >> >   
>> >> >> >   > action="">
>> >> >> > 
>> >> >> >   Enter information
>> >> >> >   
>> >> >> > Username> type="text"
>> >> >> > id="username" name="username" class="text" size="20" />
>> >> >> >   
>> >> >> >   
>> >> >> > Password> >> >> > type="password"
>> >> >> > id="password" name="password" class="text" size="20" />
>> >> >> >   
>> >> >> > 

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Pervez Mulla
responseText: #!/usr/bin/perl -T use CGI; use DBI; use strict; use
warnings; use netsharkusr; my $cgi = CGI->new; my $username =
$cgi->param("username"); my $password = $cgi->param("password"); my
$tempuser = new netsharkusr(); if($tempuser->readbyusername($username) eq
1) { if($tempuser->{username} eq $username) { print "success \n"; #exit; }
} #$password = "123go"; my $userid; my $tempuser2 = new netsharkusr();
if($tempuser2->readbypassword($password)) { if($tempuser2->{password} eq
$password) { print "sccess \n"; $userid = $tempuser2->{userID}; } } # check
the username and password in the database # create a JSON string according
to the database result my $json = ($userid) ? qq{{"success" : "login is
successful", "userid" : $userid}} : qq{{"error" : "username or password is
wrong"}}; # return JSON string print $cgi->header(-type =>
"application/json", -charset => "utf-8"); print $json;, textStatus:
parsererror, errorThrown: undefined

On Mon, Oct 15, 2012 at 4:07 PM, Sergiy Khohlov  wrote:

> please provide error
>
> 2012/10/15 Pervez Mulla :
> > On error note its printing all pelr script itself.
> >
> >
> > On Mon, Oct 15, 2012 at 3:31 PM, Sergiy Khohlov 
> wrote:
> >>
> >> please provide error message
> >>
> >> 2012/10/15 Pervez Mulla :
> >> > Thank You for your response Sergiy ,
> >> >
> >> > I already try'd to run this script as shown in Django DOC as u given
> >> > .but
> >> > still it didnt work:(
> >> >
> >> > Thank You
> >> > Pervez
> >> >
> >> > On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov 
> >> > wrote:
> >> >>
> >> >>
> >> >>
> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
> >> >>
> >> >>  set this one in setting.py
> >> >>
> >> >> 2012/10/15 Pervez Mulla :
> >> >> > Hi,
> >> >> >
> >> >> > I have login.html , login,js ang login.pl.
> >> >> >
> >> >> > I want to integrate basic login page in Django with perl back-end
> >> >> > from
> >> >> > where
> >> >> > Am reading my DB.
> >> >> > I was trying to integrate it from last day but come out with empty
> >> >> > .There
> >> >> > might be some settings in setting.py.
> >> >> > Below is my code
> >> >> >
> >> >> > --
> >> >> > login.html
> >> >> > --
> >> >> > http://www.w3.org/1999/xhtml";>
> >> >> >   
> >> >> >  >> >> > />
> >> >> >  >> >> > src="jquery-1.7.2.min.js">
> >> >> > 
> >> >> > 
> >> >> >   #loginContent { width: 350px; margin: 100px auto; }
> >> >> >   button[type] { margin: 0.5em 0; }
> >> >> > label {font-weight:bold;}
> >> >> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px
> >> >> > solid
> >> >> > #ccc;}
> >> >> > legend
> >> >> >
> >> >> >
> {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
> >> >> > fieldset, #IE8#HACK {padding-top:1.4em;}
> >> >> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
> >> >> > input[type=text], input[type=password], input.text, input.title,
> >> >> > textarea
> >> >> > {background-color:#fff;border:1px solid #bbb;}
> >> >> > input[type=text]:focus, input[type=password]:focus,
> input.text:focus,
> >> >> > input.title:focus, textarea:focus {border-color:#666;}
> >> >> > select {background-color:#fff;border-width:1px;border-style:solid;}
> >> >> > input[type=text], input[type=password], input.text, input.title,
> >> >> > textarea,
> >> >> > select {margin:0.5em 0;}
> >> >> > input.text, input.title {width:300px;padding:5px;}
> >> >> > input.title {font-size:1.5em;}
> >> >> > textarea {width:390px;height:250px;padding:5px;}
> >> >> > form.inline {line-height:3;}
> >> >> > form.inline p {margin-bottom:0;}
> >> >> > .error, .alert, .notice, .success, .info
> >> >> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
> >> >> > .error, .alert
> >> >> > {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
> >> >> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
> >> >> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
> >> >> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
> >> >> > .error a, .alert a {color:#8a1f11;}
> >> >> > .notice a {color:#514721;}
> >> >> > .success a {color:#264409;}
> >> >> > .info a {color:#205791;}
> >> >> > 
> >> >> >   
> >> >> >   
> >> >> > 
> >> >> >   
> >> >> >   
> >> >> >action="">
> >> >> > 
> >> >> >   Enter information
> >> >> >   
> >> >> > Username type="text"
> >> >> > id="username" name="username" class="text" size="20" />
> >> >> >   
> >> >> >   
> >> >> > Password >> >> > type="password"
> >> >> > id="password" name="password" class="text" size="20" />
> >> >> >   
> >> >> >   
> >> >> >  >> >> > alt="ok"
> >> >> > />Login
> >> >> >   
> >> >> > 
> >> >> >   
> >> >> > 
> >> >> >   
> >> >> > 
> >> >> >
> >> >> > -
> >> >> > login.js
> >> >> > -
> >> >> > $(document).ready(function(){
> >> >> 

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Sergiy Khohlov
please provide error

2012/10/15 Pervez Mulla :
> On error note its printing all pelr script itself.
>
>
> On Mon, Oct 15, 2012 at 3:31 PM, Sergiy Khohlov  wrote:
>>
>> please provide error message
>>
>> 2012/10/15 Pervez Mulla :
>> > Thank You for your response Sergiy ,
>> >
>> > I already try'd to run this script as shown in Django DOC as u given
>> > .but
>> > still it didnt work:(
>> >
>> > Thank You
>> > Pervez
>> >
>> > On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov 
>> > wrote:
>> >>
>> >>
>> >> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
>> >>
>> >>  set this one in setting.py
>> >>
>> >> 2012/10/15 Pervez Mulla :
>> >> > Hi,
>> >> >
>> >> > I have login.html , login,js ang login.pl.
>> >> >
>> >> > I want to integrate basic login page in Django with perl back-end
>> >> > from
>> >> > where
>> >> > Am reading my DB.
>> >> > I was trying to integrate it from last day but come out with empty
>> >> > .There
>> >> > might be some settings in setting.py.
>> >> > Below is my code
>> >> >
>> >> > --
>> >> > login.html
>> >> > --
>> >> > http://www.w3.org/1999/xhtml";>
>> >> >   
>> >> > > >> > />
>> >> > > >> > src="jquery-1.7.2.min.js">
>> >> > 
>> >> > 
>> >> >   #loginContent { width: 350px; margin: 100px auto; }
>> >> >   button[type] { margin: 0.5em 0; }
>> >> > label {font-weight:bold;}
>> >> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px
>> >> > solid
>> >> > #ccc;}
>> >> > legend
>> >> >
>> >> > {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
>> >> > fieldset, #IE8#HACK {padding-top:1.4em;}
>> >> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
>> >> > input[type=text], input[type=password], input.text, input.title,
>> >> > textarea
>> >> > {background-color:#fff;border:1px solid #bbb;}
>> >> > input[type=text]:focus, input[type=password]:focus, input.text:focus,
>> >> > input.title:focus, textarea:focus {border-color:#666;}
>> >> > select {background-color:#fff;border-width:1px;border-style:solid;}
>> >> > input[type=text], input[type=password], input.text, input.title,
>> >> > textarea,
>> >> > select {margin:0.5em 0;}
>> >> > input.text, input.title {width:300px;padding:5px;}
>> >> > input.title {font-size:1.5em;}
>> >> > textarea {width:390px;height:250px;padding:5px;}
>> >> > form.inline {line-height:3;}
>> >> > form.inline p {margin-bottom:0;}
>> >> > .error, .alert, .notice, .success, .info
>> >> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
>> >> > .error, .alert
>> >> > {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
>> >> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
>> >> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
>> >> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
>> >> > .error a, .alert a {color:#8a1f11;}
>> >> > .notice a {color:#514721;}
>> >> > .success a {color:#264409;}
>> >> > .info a {color:#205791;}
>> >> > 
>> >> >   
>> >> >   
>> >> > 
>> >> >   
>> >> >   
>> >> >   
>> >> > 
>> >> >   Enter information
>> >> >   
>> >> > Username> >> > id="username" name="username" class="text" size="20" />
>> >> >   
>> >> >   
>> >> > Password> >> > type="password"
>> >> > id="password" name="password" class="text" size="20" />
>> >> >   
>> >> >   
>> >> > > >> > alt="ok"
>> >> > />Login
>> >> >   
>> >> > 
>> >> >   
>> >> > 
>> >> >   
>> >> > 
>> >> >
>> >> > -
>> >> > login.js
>> >> > -
>> >> > $(document).ready(function(){
>> >> >   $("form#loginForm").submit(function() { // loginForm is submitted
>> >> > var username = $('#username').attr('value'); // get username
>> >> > var password = $('#password').attr('value'); // get password
>> >> >
>> >> > if (username && password) { // values are not empty
>> >> >   $.ajax({
>> >> > type: "GET",
>> >> > url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the
>> >> > Perl
>> >> > script
>> >> > contentType: "application/json; charset=utf-8",
>> >> > dataType: "json",
>> >> > data: "username=" + username + "&password=" + password,
>> >> > error: function(XMLHttpRequest, textStatus, errorThrown) {
>> >> >   $('div#loginResult').text("responseText: " +
>> >> > XMLHttpRequest.responseText
>> >> > + ", textStatus: " + textStatus
>> >> > + ", errorThrown: " + errorThrown);
>> >> >   $('div#loginResult').addClass("error");
>> >> > }, // error
>> >> > success: function(data){
>> >> >   if (data.error) { // script returned error
>> >> > $('div#loginResult').text("data.error: " + data.error);
>> >> > $('div#loginResult').addClass("error");
>> >> >   } // if
>> >> >   else { // login was s

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Pervez Mulla
On error note its printing all pelr script itself.


On Mon, Oct 15, 2012 at 3:31 PM, Sergiy Khohlov  wrote:

> please provide error message
>
> 2012/10/15 Pervez Mulla :
> > Thank You for your response Sergiy ,
> >
> > I already try'd to run this script as shown in Django DOC as u given .but
> > still it didnt work:(
> >
> > Thank You
> > Pervez
> >
> > On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov 
> wrote:
> >>
> >>
> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
> >>
> >>  set this one in setting.py
> >>
> >> 2012/10/15 Pervez Mulla :
> >> > Hi,
> >> >
> >> > I have login.html , login,js ang login.pl.
> >> >
> >> > I want to integrate basic login page in Django with perl back-end from
> >> > where
> >> > Am reading my DB.
> >> > I was trying to integrate it from last day but come out with empty
> >> > .There
> >> > might be some settings in setting.py.
> >> > Below is my code
> >> >
> >> > --
> >> > login.html
> >> > --
> >> > http://www.w3.org/1999/xhtml";>
> >> >   
> >> >  >> > />
> >> > 
> >> > 
> >> > 
> >> >   #loginContent { width: 350px; margin: 100px auto; }
> >> >   button[type] { margin: 0.5em 0; }
> >> > label {font-weight:bold;}
> >> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px
> >> > solid
> >> > #ccc;}
> >> > legend
> >> >
> {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
> >> > fieldset, #IE8#HACK {padding-top:1.4em;}
> >> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
> >> > input[type=text], input[type=password], input.text, input.title,
> >> > textarea
> >> > {background-color:#fff;border:1px solid #bbb;}
> >> > input[type=text]:focus, input[type=password]:focus, input.text:focus,
> >> > input.title:focus, textarea:focus {border-color:#666;}
> >> > select {background-color:#fff;border-width:1px;border-style:solid;}
> >> > input[type=text], input[type=password], input.text, input.title,
> >> > textarea,
> >> > select {margin:0.5em 0;}
> >> > input.text, input.title {width:300px;padding:5px;}
> >> > input.title {font-size:1.5em;}
> >> > textarea {width:390px;height:250px;padding:5px;}
> >> > form.inline {line-height:3;}
> >> > form.inline p {margin-bottom:0;}
> >> > .error, .alert, .notice, .success, .info
> >> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
> >> > .error, .alert
> {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
> >> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
> >> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
> >> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
> >> > .error a, .alert a {color:#8a1f11;}
> >> > .notice a {color:#514721;}
> >> > .success a {color:#264409;}
> >> > .info a {color:#205791;}
> >> > 
> >> >   
> >> >   
> >> > 
> >> >   
> >> >   
> >> >   
> >> > 
> >> >   Enter information
> >> >   
> >> > Username >> > id="username" name="username" class="text" size="20" />
> >> >   
> >> >   
> >> > Password type="password"
> >> > id="password" name="password" class="text" size="20" />
> >> >   
> >> >   
> >> >  alt="ok"
> >> > />Login
> >> >   
> >> > 
> >> >   
> >> > 
> >> >   
> >> > 
> >> >
> >> > -
> >> > login.js
> >> > -
> >> > $(document).ready(function(){
> >> >   $("form#loginForm").submit(function() { // loginForm is submitted
> >> > var username = $('#username').attr('value'); // get username
> >> > var password = $('#password').attr('value'); // get password
> >> >
> >> > if (username && password) { // values are not empty
> >> >   $.ajax({
> >> > type: "GET",
> >> > url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the
> >> > Perl
> >> > script
> >> > contentType: "application/json; charset=utf-8",
> >> > dataType: "json",
> >> > data: "username=" + username + "&password=" + password,
> >> > error: function(XMLHttpRequest, textStatus, errorThrown) {
> >> >   $('div#loginResult').text("responseText: " +
> >> > XMLHttpRequest.responseText
> >> > + ", textStatus: " + textStatus
> >> > + ", errorThrown: " + errorThrown);
> >> >   $('div#loginResult').addClass("error");
> >> > }, // error
> >> > success: function(data){
> >> >   if (data.error) { // script returned error
> >> > $('div#loginResult').text("data.error: " + data.error);
> >> > $('div#loginResult').addClass("error");
> >> >   } // if
> >> >   else { // login was successful
> >> > $('form#loginForm').hide();
> >> > $('div#loginResult').text("data.success: " + data.success
> >> >   + ", data.userid: " + data.userid);
> >> > $('div#loginResult').addClass("success");
> >> >  

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Sergiy Khohlov
please provide error message

2012/10/15 Pervez Mulla :
> Thank You for your response Sergiy ,
>
> I already try'd to run this script as shown in Django DOC as u given .but
> still it didnt work:(
>
> Thank You
> Pervez
>
> On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov  wrote:
>>
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
>>
>>  set this one in setting.py
>>
>> 2012/10/15 Pervez Mulla :
>> > Hi,
>> >
>> > I have login.html , login,js ang login.pl.
>> >
>> > I want to integrate basic login page in Django with perl back-end from
>> > where
>> > Am reading my DB.
>> > I was trying to integrate it from last day but come out with empty
>> > .There
>> > might be some settings in setting.py.
>> > Below is my code
>> >
>> > --
>> > login.html
>> > --
>> > http://www.w3.org/1999/xhtml";>
>> >   
>> > > > />
>> > 
>> > 
>> > 
>> >   #loginContent { width: 350px; margin: 100px auto; }
>> >   button[type] { margin: 0.5em 0; }
>> > label {font-weight:bold;}
>> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px
>> > solid
>> > #ccc;}
>> > legend
>> > {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
>> > fieldset, #IE8#HACK {padding-top:1.4em;}
>> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
>> > input[type=text], input[type=password], input.text, input.title,
>> > textarea
>> > {background-color:#fff;border:1px solid #bbb;}
>> > input[type=text]:focus, input[type=password]:focus, input.text:focus,
>> > input.title:focus, textarea:focus {border-color:#666;}
>> > select {background-color:#fff;border-width:1px;border-style:solid;}
>> > input[type=text], input[type=password], input.text, input.title,
>> > textarea,
>> > select {margin:0.5em 0;}
>> > input.text, input.title {width:300px;padding:5px;}
>> > input.title {font-size:1.5em;}
>> > textarea {width:390px;height:250px;padding:5px;}
>> > form.inline {line-height:3;}
>> > form.inline p {margin-bottom:0;}
>> > .error, .alert, .notice, .success, .info
>> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
>> > .error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
>> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
>> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
>> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
>> > .error a, .alert a {color:#8a1f11;}
>> > .notice a {color:#514721;}
>> > .success a {color:#264409;}
>> > .info a {color:#205791;}
>> > 
>> >   
>> >   
>> > 
>> >   
>> >   
>> >   
>> > 
>> >   Enter information
>> >   
>> > Username> > id="username" name="username" class="text" size="20" />
>> >   
>> >   
>> > Password> > id="password" name="password" class="text" size="20" />
>> >   
>> >   
>> > > > />Login
>> >   
>> > 
>> >   
>> > 
>> >   
>> > 
>> >
>> > -
>> > login.js
>> > -
>> > $(document).ready(function(){
>> >   $("form#loginForm").submit(function() { // loginForm is submitted
>> > var username = $('#username').attr('value'); // get username
>> > var password = $('#password').attr('value'); // get password
>> >
>> > if (username && password) { // values are not empty
>> >   $.ajax({
>> > type: "GET",
>> > url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the
>> > Perl
>> > script
>> > contentType: "application/json; charset=utf-8",
>> > dataType: "json",
>> > data: "username=" + username + "&password=" + password,
>> > error: function(XMLHttpRequest, textStatus, errorThrown) {
>> >   $('div#loginResult').text("responseText: " +
>> > XMLHttpRequest.responseText
>> > + ", textStatus: " + textStatus
>> > + ", errorThrown: " + errorThrown);
>> >   $('div#loginResult').addClass("error");
>> > }, // error
>> > success: function(data){
>> >   if (data.error) { // script returned error
>> > $('div#loginResult').text("data.error: " + data.error);
>> > $('div#loginResult').addClass("error");
>> >   } // if
>> >   else { // login was successful
>> > $('form#loginForm').hide();
>> > $('div#loginResult').text("data.success: " + data.success
>> >   + ", data.userid: " + data.userid);
>> > $('div#loginResult').addClass("success");
>> >   } //else
>> > } // success
>> >   }); // ajax
>> > } // if
>> > else {
>> >   $('div#loginResult').text("enter username and password");
>> >   $('div#loginResult').addClass("error");
>> > } // else
>> > $('div#loginResult').fadeIn();
>> > return false;
>> >   });
>> > });
>> >
>> > --
>> > login.pl
>> > --
>> > #!/usr/bin/perl -T
>> >
>> >

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Pervez Mulla
Thank You for your response Sergiy ,

I already try'd to run this script as shown in Django DOC as u given .but
still it didnt work:(

Thank You
Pervez

On Mon, Oct 15, 2012 at 1:28 PM, Sergiy Khohlov  wrote:

> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL
>
>  set this one in setting.py
>
> 2012/10/15 Pervez Mulla :
> > Hi,
> >
> > I have login.html , login,js ang login.pl.
> >
> > I want to integrate basic login page in Django with perl back-end from
> where
> > Am reading my DB.
> > I was trying to integrate it from last day but come out with empty .There
> > might be some settings in setting.py.
> > Below is my code
> >
> > --
> > login.html
> > --
> > http://www.w3.org/1999/xhtml";>
> >   
> > 
> > 
> > 
> > 
> >   #loginContent { width: 350px; margin: 100px auto; }
> >   button[type] { margin: 0.5em 0; }
> > label {font-weight:bold;}
> > fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px solid
> > #ccc;}
> > legend
> > {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
> > fieldset, #IE8#HACK {padding-top:1.4em;}
> > legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
> > input[type=text], input[type=password], input.text, input.title, textarea
> > {background-color:#fff;border:1px solid #bbb;}
> > input[type=text]:focus, input[type=password]:focus, input.text:focus,
> > input.title:focus, textarea:focus {border-color:#666;}
> > select {background-color:#fff;border-width:1px;border-style:solid;}
> > input[type=text], input[type=password], input.text, input.title,
> textarea,
> > select {margin:0.5em 0;}
> > input.text, input.title {width:300px;padding:5px;}
> > input.title {font-size:1.5em;}
> > textarea {width:390px;height:250px;padding:5px;}
> > form.inline {line-height:3;}
> > form.inline p {margin-bottom:0;}
> > .error, .alert, .notice, .success, .info
> > {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
> > .error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
> > .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
> > .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
> > .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
> > .error a, .alert a {color:#8a1f11;}
> > .notice a {color:#514721;}
> > .success a {color:#264409;}
> > .info a {color:#205791;}
> > 
> >   
> >   
> > 
> >   
> >   
> >   
> > 
> >   Enter information
> >   
> > Username > id="username" name="username" class="text" size="20" />
> >   
> >   
> > Password > id="password" name="password" class="text" size="20" />
> >   
> >   
> >  > />Login
> >   
> > 
> >   
> > 
> >   
> > 
> >
> > -
> > login.js
> > -
> > $(document).ready(function(){
> >   $("form#loginForm").submit(function() { // loginForm is submitted
> > var username = $('#username').attr('value'); // get username
> > var password = $('#password').attr('value'); // get password
> >
> > if (username && password) { // values are not empty
> >   $.ajax({
> > type: "GET",
> > url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the
> Perl
> > script
> > contentType: "application/json; charset=utf-8",
> > dataType: "json",
> > data: "username=" + username + "&password=" + password,
> > error: function(XMLHttpRequest, textStatus, errorThrown) {
> >   $('div#loginResult').text("responseText: " +
> > XMLHttpRequest.responseText
> > + ", textStatus: " + textStatus
> > + ", errorThrown: " + errorThrown);
> >   $('div#loginResult').addClass("error");
> > }, // error
> > success: function(data){
> >   if (data.error) { // script returned error
> > $('div#loginResult').text("data.error: " + data.error);
> > $('div#loginResult').addClass("error");
> >   } // if
> >   else { // login was successful
> > $('form#loginForm').hide();
> > $('div#loginResult').text("data.success: " + data.success
> >   + ", data.userid: " + data.userid);
> > $('div#loginResult').addClass("success");
> >   } //else
> > } // success
> >   }); // ajax
> > } // if
> > else {
> >   $('div#loginResult').text("enter username and password");
> >   $('div#loginResult').addClass("error");
> > } // else
> > $('div#loginResult').fadeIn();
> > return false;
> >   });
> > });
> >
> > --
> > login.pl
> > --
> > #!/usr/bin/perl -T
> >
> > use CGI;
> > use DBI;
> > use strict;
> > use warnings;
> > use netsharkusr;
> >
> > my $cgi = CGI->new;
> > my $username = $cgi->param("username");
> > my $password = $cgi->param("password");
> >  my $tempuser = new netsharkusr();
> > 

Re: How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Sergiy Khohlov
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL

 set this one in setting.py

2012/10/15 Pervez Mulla :
> Hi,
>
> I have login.html , login,js ang login.pl.
>
> I want to integrate basic login page in Django with perl back-end from where
> Am reading my DB.
> I was trying to integrate it from last day but come out with empty .There
> might be some settings in setting.py.
> Below is my code
>
> --
> login.html
> --
> http://www.w3.org/1999/xhtml";>
>   
> 
> 
> 
> 
>   #loginContent { width: 350px; margin: 100px auto; }
>   button[type] { margin: 0.5em 0; }
> label {font-weight:bold;}
> fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px solid
> #ccc;}
> legend
> {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
> fieldset, #IE8#HACK {padding-top:1.4em;}
> legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
> input[type=text], input[type=password], input.text, input.title, textarea
> {background-color:#fff;border:1px solid #bbb;}
> input[type=text]:focus, input[type=password]:focus, input.text:focus,
> input.title:focus, textarea:focus {border-color:#666;}
> select {background-color:#fff;border-width:1px;border-style:solid;}
> input[type=text], input[type=password], input.text, input.title, textarea,
> select {margin:0.5em 0;}
> input.text, input.title {width:300px;padding:5px;}
> input.title {font-size:1.5em;}
> textarea {width:390px;height:250px;padding:5px;}
> form.inline {line-height:3;}
> form.inline p {margin-bottom:0;}
> .error, .alert, .notice, .success, .info
> {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
> .error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
> .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
> .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
> .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
> .error a, .alert a {color:#8a1f11;}
> .notice a {color:#514721;}
> .success a {color:#264409;}
> .info a {color:#205791;}
> 
>   
>   
> 
>   
>   
>   
> 
>   Enter information
>   
> Username id="username" name="username" class="text" size="20" />
>   
>   
> Password id="password" name="password" class="text" size="20" />
>   
>   
>  />Login
>   
> 
>   
> 
>   
> 
>
> -
> login.js
> -
> $(document).ready(function(){
>   $("form#loginForm").submit(function() { // loginForm is submitted
> var username = $('#username').attr('value'); // get username
> var password = $('#password').attr('value'); // get password
>
> if (username && password) { // values are not empty
>   $.ajax({
> type: "GET",
> url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the Perl
> script
> contentType: "application/json; charset=utf-8",
> dataType: "json",
> data: "username=" + username + "&password=" + password,
> error: function(XMLHttpRequest, textStatus, errorThrown) {
>   $('div#loginResult').text("responseText: " +
> XMLHttpRequest.responseText
> + ", textStatus: " + textStatus
> + ", errorThrown: " + errorThrown);
>   $('div#loginResult').addClass("error");
> }, // error
> success: function(data){
>   if (data.error) { // script returned error
> $('div#loginResult').text("data.error: " + data.error);
> $('div#loginResult').addClass("error");
>   } // if
>   else { // login was successful
> $('form#loginForm').hide();
> $('div#loginResult').text("data.success: " + data.success
>   + ", data.userid: " + data.userid);
> $('div#loginResult').addClass("success");
>   } //else
> } // success
>   }); // ajax
> } // if
> else {
>   $('div#loginResult').text("enter username and password");
>   $('div#loginResult').addClass("error");
> } // else
> $('div#loginResult').fadeIn();
> return false;
>   });
> });
>
> --
> login.pl
> --
> #!/usr/bin/perl -T
>
> use CGI;
> use DBI;
> use strict;
> use warnings;
> use netsharkusr;
>
> my $cgi = CGI->new;
> my $username = $cgi->param("username");
> my $password = $cgi->param("password");
>  my $tempuser = new netsharkusr();
>  if($tempuser->readbyusername($username) eq 1) {
> if($tempuser->{username} eq $username)
> {
> print "success \n";
> #exit;
> }
>  }
>
> #$password = "123go";
> my $userid;
> my $tempuser2 = new netsharkusr();
> if($tempuser2->readbypassword($password)) {
> if($tempuser2->{password} eq $password)
> {
> print "sccess \n";
> $userid = $tempuser2->{userID};
>   

How can I integrate simple Custom login page in Django.......?

2012-10-15 Thread Pervez Mulla
Hi,

I have login.html , login,js ang login.pl.

I want to integrate basic login page in Django with perl back-end from 
where Am reading my DB.
I was trying to integrate it from last day but come out with empty .There 
might be some settings in setting.py.
Below is my code

--
login.html
--
http://www.w3.org/1999/xhtml";>
  




  #loginContent { width: 350px; margin: 100px auto; }
  button[type] { margin: 0.5em 0; }
label {font-weight:bold;}
fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px solid 
#ccc;}
legend 
{font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
fieldset, #IE8#HACK {padding-top:1.4em;}
legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
input[type=text], input[type=password], input.text, input.title, textarea 
{background-color:#fff;border:1px solid #bbb;}
input[type=text]:focus, input[type=password]:focus, input.text:focus, 
input.title:focus, textarea:focus {border-color:#666;}
select {background-color:#fff;border-width:1px;border-style:solid;}
input[type=text], input[type=password], input.text, input.title, textarea, 
select {margin:0.5em 0;}
input.text, input.title {width:300px;padding:5px;}
input.title {font-size:1.5em;}
textarea {width:390px;height:250px;padding:5px;}
form.inline {line-height:3;}
form.inline p {margin-bottom:0;}
.error, .alert, .notice, .success, .info 
{padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
.error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
.notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
.success {background:#e6efc2;color:#264409;border-color:#c6d880;}
.info {background:#d5edf8;color:#205791;border-color:#92cae4;}
.error a, .alert a {color:#8a1f11;}
.notice a {color:#514721;}
.success a {color:#264409;}
.info a {color:#205791;}

  
  

  
  
  

  Enter information
  
Username
  
  
Password
  
  
Login
  

  

  


-
login.js
-
$(document).ready(function(){
  $("form#loginForm").submit(function() { // loginForm is submitted
var username = $('#username').attr('value'); // get username
var password = $('#password').attr('value'); // get password

if (username && password) { // values are not empty
  $.ajax({
type: "GET",
url: "http://localhost:8080/cgi-bin/login.pl";, // URL of the Perl 
script
contentType: "application/json; charset=utf-8",
dataType: "json",
data: "username=" + username + "&password=" + password,
error: function(XMLHttpRequest, textStatus, errorThrown) { 
  $('div#loginResult').text("responseText: " + 
XMLHttpRequest.responseText 
+ ", textStatus: " + textStatus 
+ ", errorThrown: " + errorThrown);
  $('div#loginResult').addClass("error");
}, // error 
success: function(data){
  if (data.error) { // script returned error
$('div#loginResult').text("data.error: " + data.error);
$('div#loginResult').addClass("error");
  } // if
  else { // login was successful
$('form#loginForm').hide();
$('div#loginResult').text("data.success: " + data.success 
  + ", data.userid: " + data.userid);
$('div#loginResult').addClass("success");
  } //else
} // success
  }); // ajax
} // if
else {
  $('div#loginResult').text("enter username and password");
  $('div#loginResult').addClass("error");
} // else
$('div#loginResult').fadeIn();
return false;
  });
});

--
login.pl
--
#!/usr/bin/perl -T

use CGI;
use DBI;
use strict;
use warnings;
use netsharkusr;

my $cgi = CGI->new;
my $username = $cgi->param("username");
my $password = $cgi->param("password");
 my $tempuser = new netsharkusr();
 if($tempuser->readbyusername($username) eq 1) {
if($tempuser->{username} eq $username)
{
print "success \n";
#exit;
}
 }

#$password = "123go";
my $userid;
my $tempuser2 = new netsharkusr();
if($tempuser2->readbypassword($password)) {
if($tempuser2->{password} eq $password)
{
print "sccess \n";
$userid = $tempuser2->{userID};
}
}

# check the username and password in the database

# create a JSON string according to the database result
my $json = ($userid) ? 
  qq{{"success" : "login is successful", "userid" : $userid}} : 
  qq{{"error" : "username or password is wrong"}};

# return JSON string
print $cgi->header(-type => "application/json", -charset => "utf-8");
print $json;

 How can I do this ..? Please Help  


Thank You
Pervez

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