Changeset 915

Show
Ignore:
Timestamp:
07/28/08 22:13:31 (4 months ago)
Author:
bsmith
Message:

Adding js to check for #_login & #_logout

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Vanilla/templates/vanilla+authentication+userpics/javascript.mtml

    r910 r915  
    77<$mt:var name="show_userpic" value="1"$> 
    88 
    9 /* section *****************************************************************/ 
     9/* Section *****************************************************************/ 
    1010 
    1111// The cookie name to use for storing the blog-side comment session cookie. 
     
    1616var is_preview; 
    1717var user; 
     18 
     19/* Login Functions *****************************************************************/ 
    1820 
    1921<mt:Ignore> 
     
    110112} 
    111113 
     114<mt:IfBlog> 
     115<mt:IfRegistrationAllowed> 
     116/*** 
     117 * If request contains a '#_login' or '#_logout' hash, use this to 
     118 * also delete the blog-side user cookie, since we're coming back from 
     119 * a login, logout or edit profile operation. 
     120 */ 
     121var clearCookie = ( window.location.hash && window.location.hash.match( /^#_log(in|out)/ ) ) ? true : false; 
     122if (clearCookie) { 
     123    // clear any logged in state 
     124    mtClearUser(); 
     125    if (RegExp.$1 == 'in') 
     126        mtFetchUser(); 
     127} else { 
     128    <mt:Ignore> 
     129    /*** 
     130     * Uncondition this call to fetch the current user state (if available) 
     131     * from MT upon page load if no user cookie is already present. 
     132     * This is okay if you have a private install, such as an Intranet; 
     133     * not recommended for public web sites! 
     134     */ 
     135    </mt:Ignore> 
     136    if ( is_preview && !user ) 
     137        mtFetchUser(); 
     138} 
     139</mt:IfRegistrationAllowed> 
     140</mt:IfBlog> 
     141 
    112142<mt:Ignore> 
    113143/***