Show
Ignore:
Timestamp:
07/30/08 00:08:49 (16 months ago)
Author:
bsmith
Message:

various updates

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Vanilla/templates/vanilla+authentication/javascript.mtml

    r915 r919  
    181181<mt:Ignore> 
    182182/*** 
    183  * Persists a copy of the current user cookie into the browser cookie stash. 
    184  */ 
    185 </mt:Ignore> 
    186 function mtSaveUser(f) { 
    187     // We can't reliably store the user cookie during a preview. 
    188     if (is_preview) return; 
    189  
    190     var u = mtGetUser(); 
    191  
    192     if (f && (!u || u.is_anonymous)) { 
    193         if ( !u ) { 
    194             u = {}; 
    195             u.is_authenticated = false; 
    196             u.can_comment = true; 
    197             u.is_author = false; 
    198             u.is_banned = false; 
    199             u.is_anonymous = true; 
    200             u.is_trusted = false; 
    201         } 
    202         if (f.author != undefined) u.name = f.author.value; 
    203         if (f.email != undefined) u.email = f.email.value; 
    204         if (f.url != undefined) u.url = f.url.value; 
    205     } 
    206  
    207     if (!u) return; 
    208  
    209     var cache_period = mtCookieTimeout * 1000; 
    210  
    211     // cache anonymous user info for a long period if the 
    212     // user has requested to be remembered 
    213     if (u.is_anonymous && f && f.bakecookie && f.bakecookie.checked) 
    214         cache_period = 365 * 24 * 60 * 60 * 1000; 
    215  
    216     var now = new Date(); 
    217     mtFixDate(now); 
    218     now.setTime(now.getTime() + cache_period); 
    219  
    220     var cmtcookie = mtBakeUserCookie(u); 
    221     mtSetCookie(mtCookieName, cmtcookie, now, mtCookiePath, mtCookieDomain, 
    222         location.protocol == 'https:'); 
    223 } 
    224  
    225 <mt:Ignore> 
    226 /*** 
    227183 * Handles the action of the "Sign in" link. First clears any existing 
    228184 * user cookie, then directs to the MT comment script to sign the user in.