/[theodore]/bunnyblog/modules/logintools/login.pyc


UCC Code Repository

Contents of /bunnyblog/modules/logintools/login.pyc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Tue Jan 29 14:32:01 2008 UTC (12 years, 2 months ago) by svn-admin
File MIME type: application/octet-stream
File size: 8162 byte(s)
Error occurred while calculating annotation data.
Re-import of repository after repository database corruption.

1
2 ĩ‹Gc@s-dkZdkZdkZdkZdklZdkZeiƒeiidƒdk l
3 Z
4 dk l Z l Z lZlZlZdklZdkTdkTdkTdZd Zd
5 Zd Zddd „Zddd „Zddd„Zddd„Zd„Zd„Z d„Z!d„Z"d„Z#dS(N(stimes
6 ../modules(s ConfigObj(spass_encspass_decs unexpireds table_encs table_dec(s SimpleCookie(t*iis admin.cgislogin_page.htmlslogin_nojs.txtcCsXt}
7 d}|djo
8 t}nt|idƒp|ƒ}y|di
9 }Wn4t j
10 o(t |||ƒ\}}} t}
11 nX|idƒo†t||||ƒ\}}} tt|dƒdƒ|d<|iƒ|d djo
12 d}q|d d jo
13 d
14 }qt}
15 n|
16 onÐ|d jot||ƒnē|d jot|ƒGHt||ƒn‰|d jo!dkl} | |||ƒn[|idƒo$dkl}|||||ƒn'|djo?dkl}||||ƒ\}}} ttƒƒ|d<nÛ|idƒoŠdkl}|d djo#t ||d|ƒ\}}} n|d}t|dƒptdƒn||||t|ƒ| ƒnA|idƒoudkl} t |||ƒ\}}} t|dƒptdƒn| ||||t|ƒ| ƒ\}}} nž|d
17 joždk l } |d d jo#t ||d |ƒ\}}} n|d}t|d
18 ƒ}|ptdƒn| ||||t|ƒ| ƒ\}}} nt|||ƒ| GH|djo
19 d}nttƒƒ|d<tt|dƒdƒ|d<|iƒ||fS(s,From the form decide which function to call.ttactiontlogint numloginsii s edacc-mjf||t editaccounts admin-mjf||tadmint showlogintlogouttnewlogin(snewlogint
20 donewlogin(s
21 donewlogintconfirm(sconfirmtcreated(s editaccountteditables%Sorry, this account cannot be edited.t doeditaccount(s doeditaccount(sadmins(You're not authorised to do that. Sorry.t EMPTY_VAL_MJFtlastusedtnumusedN("tFalsetbrt loginactiont
22 thisscripttNonet
23 THISSCRIPTt
24 sortactionttheformtgetfirstRtvaluetKeyErrort
25 checklogintuserdirt
26 userconfigt newcookietTruet
27 startswithtdologintstrtinttwritet displayloginRR R
28 R ttimeRtistrueterrorRRt
29 adminlevel(RRRRRRRR
30 R R RR RRR+((t./modules/logintools/login.pyR`sŠ 
31   
32 
33 
34 
35          #
36   .  #
37 . 
38 
39 cCsW|djo
40 t}nt|ƒ}|o||d|dfSnt|||ƒdS(snCheck if a user has a valid cookie and return an updated one
41 or display the default login screen and exit.iiN(RRRt
42 isloggedinRttestRR'(RRRR.((R,RÄs 
43  cCsĄ|di}tddg|ƒ}|djo
44 t}n|djoG|d}|d}t |||||ƒ}|pt |||ƒSnt |||ƒdS(sŌThs is the function called by login when the results of a login form are posted.
45 I.e. this actually does the login
46 If any errors occur (like wrong/missing password) it calls displaylogin and exits.
47 Rtusernametpasst loginnojsN(RRRtgetformRRRR/tpasswordt checkpassRRR.R'(RRRRR/R3RR.((R,R#Ïs  
48  
49 
50 cCs|d jo
51 t}nt|dƒ}|d}t|tƒ}|i
52 d|ƒ}t|t ƒ}|i
53 d|ƒ}t |dƒo>|i
54 ddƒ}|i
55 ddƒ}|i
56 d |d
57 ƒ}n|o|i
58 d t|ƒ}ntGHd GH|GHtiƒd S(s‡This function will display the login page and then exit.
59 Usually called if the user has no cookie or an expired/forged cookie.
60 s
61 config.init templatedirs
62 **script**s**login form**t newloginlinks<!-- **commstart**Rs**commend** -->s**new login link**s?login=newlogins<!-- **action** -->s N(RRRt ConfigObjRtconfigR5treadfilet form_nojst loginformtreplacet logintemplatet loginpageR)Rt
63 actionlinet
64 serverlinetsystexit(RRRR5R;R>R8((R,R'ßs& 
65 
66 cCs$t|dƒ}|d}t|ƒS(s<Returns the cookie header in the case of an explicit logout.s
67 config.init
68 cookiepathN(R7RR8RCt emptycookie(RR8RC((R,Rûs
69 cCsŦytid}Wntj
70 o tSnXt|ƒ}y|di}Wntj
71 o tSnXt ||ƒ}|ptSn|\}}}t|||ƒ}||fS(skIf user has sent us an in date, valid cookie then return updated cookie header,
72 otherwise return False.t HTTP_COOKIEtuseridN(tostenviront rawcookieRRt SimpleCookiet thecookieRt cookiestringt decodestringRR.tuserR3RCt
73 makecookie(RRLRIRKRNR.R3RC((R,R-s    cCsbyt|ƒ\}} }Wn tSnXt| |tƒptSny|idƒ\}} } Wnt j
74 o tSnXt | ƒdjptSn|tjptii||dƒ otSnt||dƒ}|d}|d}t|dƒd}
75 yt|ƒ\} } }Wn tSnXti| | ƒiƒ}|| jotSn|| |
76 fS( sžGiven a username/password encoded into a string - decode it and check it's validity.
77 It checks the username against the one stored in the user file..
78 s||i
79 s.iniR3smax-ages
80 config.iniRCN(tpass_decRLtinstringt daynumbert timestampRt unexpiredtAGETESTtsplitR/tpasshasht ranstringt
81 ValueErrortlent RESERVEDNAMESRGtpathtisfileRR7RNt stampedpasstmaxageRCR3tshatnewt hexdigesttthishash(RLRRQR_RcR/RSRNR^R3RCRWRRRX((R,RMs6 )
82 
83  cCsMtdƒ}ti||ƒiƒ}tdi|||gƒdt
84 dt
85 ƒS(sRGiven a username and password return a new encoded string for use by decodecookie.i
86 s||RRRSN( t randomstringRXR`RaR3RbRctpass_enctjoinR/R!(R/R3RcRX((R,t encodestring;s c CsÏ|tjotSntii||dƒptSnt||dƒ} | d}
87 t|dƒd}t |
88 ƒ\}} }||jotSntddƒit| ƒƒt| ||ƒ}|| |fS(s$Check the password from a new login.s.iniR3s
89 config.iniRCstest.txttwN(R/R[RRGR\R]RR7RNR^RCRPtrealpassRRRSR3topenR&R$RORKR( R/R3RRRRCRSRKRiRNR^RR((R,R4As 
90  (iii($RAtcgiRGR`R(tcgitbtenableR\tappendt configobjR7tdataencReRPRTt table_enct table_dectCookieRJt pathutilstcgiutilst
91 loginutilsRURR=R:RRRR#R'RR-RMRgR4(R7RRURrR'R-RTR4R=R#RkR:RMRqRlRRgRPRAReR`R(RJRRGR((R,t?s6      
92  % +d    % 

Properties

Name Value
svn:mime-type application/octet-stream

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26