Ticket #65: lostpassword.patch

File lostpassword.patch, 6.9 kB (added by mauser, 5 months ago)
  • plugins/Login/lang/en.php

    old new  
    1414         
    1515        'Login_MailTopicPasswordRecovery' => 'Password recovery', 
    1616        'Login_MailBodyPasswordRecovery' => "Hi %1s,\n\nYour new password is: %2s\n\nYou can login now at: %3s", 
    17         'Login_PasswordSent' => 'Password has been just sent. Check your e-mail.' 
     17        'Login_PasswordSent' => 'Password has been just sent. Check your e-mail.', 
     18        'Login_ContactAdmin' => 'Please contact with site administrator.' 
    1819); 
  • plugins/Login/Controller.php

    old new  
    107107                         
    108108                        // if user exists 
    109109                        if( $user != null ) 
    110                         { 
     110                        { 
     111                                $view = new Piwik_View('Login/templates/passwordsent.tpl'); 
     112                                                         
    111113                                $login = $user['login']; 
    112114                                $email = $user['email']; 
    113115                                                         
     
    116118                                Piwik_UsersManager_API::updateUser($login, $randomPassword); 
    117119 
    118120                                // send email with new password 
    119                                 $mail = new Piwik_Mail();                                
    120                                 $mail->addTo($email, $login); 
    121                                 $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery'));                           
    122                                 $mail->setBodyText(sprintf(Piwik_Translate('Login_MailBodyPasswordRecovery'), 
    123                                         $login, $randomPassword, Piwik_Url::getCurrentUrlWithoutQueryString()));                                 
    124                                 $mail->send(); 
    125                                                  
    126                                 $view = new Piwik_View('Login/templates/passwordsent.tpl'); 
     121                                try  
     122                                { 
     123                                        $mail = new Piwik_Mail();                                
     124                                        $mail->addTo($email, $login); 
     125                                        $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery'));                           
     126                                        $mail->setBodyText(sprintf(Piwik_Translate('Login_MailBodyPasswordRecovery'), 
     127                                                $login, $randomPassword, Piwik_Url::getCurrentUrlWithoutQueryString()));                                 
     128                                        $mail->send(); 
     129                                } 
     130                                catch(Exception $e) 
     131                                { 
     132                                        $view->ErrorString = $e->getMessage(); 
     133                                } 
     134 
    127135                                $view->linkTitle = Piwik::getRandomTitle(); 
    128136                                $view->urlToRedirect = $urlToRedirect; 
    129137                                echo $view->render(); 
  • plugins/Login/templates/lostpassword.tpl

    old new  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
    3 <head> 
    4         <title>Piwik &rsaquo; Lost password</title> 
    5         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    6          
    7         {literal} 
    8         <script type="text/javascript"> 
    9                 function focusit() { 
    10                         document.getElementById('form_login').focus(); 
    11                 } 
    12                 window.onload = focusit; 
    13         </script> 
    14         {/literal} 
    15 <link rel="stylesheet" href="plugins/Login/templates/login.css"> 
    16 </head> 
     1{include file="Login/templates/header.tpl"} 
    172 
    18 <body class="login"> 
    19 <!-- shamelessly taken from wordpress 2.5 - thank you guys!!! --> 
    20  
    21 <div id="logo"> 
    22         <a href="http://piwik.org" title="{$linkTitle}"><span class="h1">Piwik <span class="description"># open source web analytics</span></span></a> 
    23 </div> 
    24  
    253<div id="login"> 
    264 
    275{if $form_data.errors} 
  • plugins/Login/templates/login.tpl

    old new  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
    3 <head> 
    4         <title>Piwik &rsaquo; Login</title> 
    5         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    6          
    7         {literal} 
    8         <script type="text/javascript"> 
    9                 function focusit() { 
    10                         document.getElementById('form_login').focus(); 
    11                 } 
    12                 window.onload = focusit; 
    13         </script> 
    14         {/literal} 
    15 <link rel="stylesheet" href="plugins/Login/templates/login.css"> 
    16 </head> 
     1{include file="Login/templates/header.tpl"} 
    172 
    18 <body class="login"> 
    19 <!-- shamelessly taken from wordpress 2.5 - thank you guys!!! --> 
    20  
    21 <div id="logo"> 
    22         <a href="http://piwik.org" title="{$linkTitle}"><span class="h1">Piwik <span class="description"># open source web analytics</span></span></a> 
    23 </div> 
    24  
    253<div id="login"> 
    264 
    275{if $form_data.errors} 
  • plugins/Login/templates/header.tpl

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
     3<head> 
     4        <title>Piwik &rsaquo; Lost password</title> 
     5        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
     6         
     7        {literal} 
     8        <script type="text/javascript"> 
     9                function focusit() { 
     10                        document.getElementById('form_login').focus(); 
     11                } 
     12                window.onload = focusit; 
     13        </script> 
     14        {/literal} 
     15<link rel="stylesheet" href="plugins/Login/templates/login.css"> 
     16</head> 
     17 
     18<body class="login"> 
     19<!-- shamelessly taken from wordpress 2.5 - thank you guys!!! --> 
     20 
     21<div id="logo"> 
     22        <a href="http://piwik.org" title="{$linkTitle}"><span class="h1">Piwik <span class="description"># open source web analytics</span></span></a> 
     23</div> 
  • plugins/Login/templates/passwordsent.tpl

    old new  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
    3 <head> 
    4         <title>Piwik &rsaquo; Lost password</title> 
    5         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    6         <link rel="stylesheet" href="plugins/Login/templates/login.css"> 
    7 </head> 
     1{include file="Login/templates/header.tpl"} 
    82 
    9 <body class="login"> 
    10 <!-- shamelessly taken from wordpress 2.5 - thank you guys!!! --> 
    11  
    12 <div id="logo"> 
    13         <a href="http://piwik.org" title="{$linkTitle}"><span class="h1">Piwik <span class="description"># open source web analytics</span></span></a> 
    14 </div> 
    15  
    163<div id="login"> 
     4 
     5{if $ErrorString} 
     6        <div id="login_error"><strong>{'General_Error'|translate}</strong>: {$ErrorString}<br /> 
     7        {'Login_ContactAdmin'|translate} 
     8        </div> 
     9{else} 
     10        <p class="message"> 
     11        {'Login_PasswordSent'|translate} 
     12        </p> 
     13{/if} 
    1714 
    18 <p class="message"> 
    19 {'Login_PasswordSent'|translate} 
    20 </p> 
    21  
    2215<p id="nav"> 
    2316<a href="?module=Login&form_url={$urlToRedirect}" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> 
    2417</p>