Changeset 2403
- Timestamp:
- 05/20/08 20:16:24 (21 months ago)
- Location:
- branches/release-38
- Files:
-
- 2 modified
-
lib/MT/App/Comments.pm (modified) (10 diffs)
-
tmpl/comment/profile.tmpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-38/lib/MT/App/Comments.pm
r2393 r2403 103 103 # one already exists corresponding to the browser's session. 104 104 # 105 # Returns a pair ($session_key, $commenter) where $session_key is the 106 # key to the MT::Session object (as well as the cookie value) and 107 # $commenter is an MT::Author record. Both values are undef when no 108 # session is active. 105 # Returns a pair ($session_obj, $commenter) where $session_obj is 106 # a MT::Session object and $commenter is an MT::Author record. Both 107 # values are undef when no session is active. 109 108 # 110 109 sub _get_commenter_session { … … 153 152 154 153 # session is valid! 155 return ( $sess ion_key, $user );154 return ( $sess_obj, $user ); 156 155 } 157 156 … … 860 859 # validate session parameter 861 860 if ( my $sid = $q->param('sid') ) { 862 my ( $sess ion, $commenter ) = $app->_get_commenter_session();863 if ( $sess ion && $commenter && ( $sessioneq $sid ) ) {861 my ( $sess_obj, $commenter ) = $app->_get_commenter_session(); 862 if ( $sess_obj && $commenter && ( $sess_obj->id eq $sid ) ) { 864 863 # well, everything is okay 865 864 } else { … … 1233 1232 my $nick = $q->param('author'); 1234 1233 my $email = $q->param('email'); 1235 my ( $sess ion, $commenter );1234 my ( $sess_obj, $commenter ); 1236 1235 if ( $blog->accepts_registered_comments ) { 1237 ( $sess ion, $commenter ) = $app->_get_commenter_session();1236 ( $sess_obj, $commenter ) = $app->_get_commenter_session(); 1238 1237 } 1239 1238 if ( $commenter && ( 'do_reply' ne $app->mode ) ) { … … 1455 1454 my $c; 1456 1455 if ( $blog_id && $blog ) { 1457 my ( $sess ion, $commenter ) = $app->_get_commenter_session();1458 if ( $sess ion&& $commenter ) {1456 my ( $sessobj, $commenter ) = $app->_get_commenter_session(); 1457 if ( $sessobj && $commenter ) { 1459 1458 my $blog_perms = $commenter->blog_perm($blog_id); 1460 1459 my $banned = $commenter->is_banned($blog_id) ? "1" : "0"; … … 1462 1461 $banned ||= 1 if $commenter->status == MT::Author::BANNED(); 1463 1462 1464 my $sessobj = MT::Session->load( $session );1465 1463 if ($banned) { 1466 1464 $sessobj->remove; … … 1746 1744 my $app = shift; 1747 1745 1748 my ( $sess ion, $commenter ) = $app->_get_commenter_session();1746 my ( $sess_obj, $commenter ) = $app->_get_commenter_session(); 1749 1747 if ($commenter) { 1750 1748 my $url; … … 1760 1758 } 1761 1759 1762 #require MT::Auth;1763 #my $ctx = MT::Auth->fetch_credentials( { app => $app } );1764 #my $cmntr_sess =1765 # $app->session_user( $commenter, $ctx->{session_id},1766 # permanent => $ctx->{permanent} );1767 #return $app->handle_error( $app->translate('Invalid login') )1768 # unless $cmntr_sess;1769 1770 1760 my $blog_id = $app->param('blog_id'); 1761 $app->{session} = $sess_obj; 1771 1762 $app->user($commenter); 1772 1763 my $param = { … … 1791 1782 my $q = $app->param; 1792 1783 1784 my ( $sess_obj, $cmntr ) = $app->_get_commenter_session(); 1785 return $app->handle_error( $app->translate('Invalid login') ) 1786 unless $cmntr; 1787 1793 1788 my %param = 1794 1789 map { $_ => scalar( $q->param($_) ) } 1795 qw( id name nickname email password pass_verify hint url entry_url return_url external_auth); 1796 1797 unless ( $param{id} =~ /\d+/ ) { 1798 $param{error} = $app->translate('Invalid commenter ID'); 1799 return $app->build_page( 'profile.tmpl', \%param ); 1800 } 1801 1802 my $cmntr = MT::Author->load( $param{id} ); 1803 unless ($cmntr) { 1804 $param{error} = $app->translate('Invalid commenter ID'); 1805 return $app->build_page( 'profile.tmpl', \%param ); 1806 } 1790 qw( name nickname email password pass_verify hint url entry_url return_url external_auth); 1807 1791 1808 1792 $param{ 'auth_mode_' . $cmntr->auth_type } = 1; 1809 1793 1810 # require MT::Auth;1811 # my $ctx = MT::Auth->fetch_credentials( { app => $app } );1812 # my $cmntr_sess =1813 # $app->session_user( $cmntr, $ctx->{session_id},1814 # permanent => $ctx->{permanent} );1815 # return $app->handle_error( $app->translate('Invalid login') )1816 # unless $cmntr_sess;1817 1818 1794 $app->user($cmntr); 1795 $app->{session} = $sess_obj; 1796 1819 1797 $app->validate_magic 1820 1798 or return $app->handle_error( $app->translate('Invalid request') ); … … 1860 1838 $app->make_commenter_session( $cmntr ); 1861 1839 } 1840 $param{magic_token} = $app->current_magic; 1862 1841 1863 1842 return $app->build_page( 'profile.tmpl', \%param ); -
branches/release-38/tmpl/comment/profile.tmpl
r2136 r2403 22 22 <input type="hidden" name="__mode" value="save_profile" /> 23 23 <input type="hidden" name="magic_token" value="<mt:var name="magic_token">" /> 24 <input type="hidden" name="id" value="<mt:var name="id" escape="html">" />25 24 <input type="hidden" name="entry_url" value="<mt:var name="entry_url" escape="html">" /> 26 25 <input type="hidden" name="return_url" value="<mt:var name="return_url" escape="html">" />
