aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-27 01:19:24 -0800
committerfriendica <info@friendica.com>2013-01-27 01:19:24 -0800
commit28ab6d5bf508120956d575e260ed2fa2b8417e59 (patch)
tree2bb7a313ecfa5d900cd6a53dfe6fe926c4b7c8e4 /mod
parent22bde9b2b797f17841f0ee12df1d12ea9616216f (diff)
downloadvolse-hubzilla-28ab6d5bf508120956d575e260ed2fa2b8417e59.tar.gz
volse-hubzilla-28ab6d5bf508120956d575e260ed2fa2b8417e59.tar.bz2
volse-hubzilla-28ab6d5bf508120956d575e260ed2fa2b8417e59.zip
lostpass fixes and login/logout flow if authenticated but no default channel exists
Diffstat (limited to 'mod')
-rw-r--r--mod/home.php4
-rw-r--r--mod/lostpass.php18
2 files changed, 13 insertions, 9 deletions
diff --git a/mod/home.php b/mod/home.php
index f70ff1d02..1bb0148d2 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -11,6 +11,10 @@ function home_init(&$a) {
if(local_user() && $channel && $channel['xchan_url'])
goaway( $channel['xchan_url']);
+ if(get_account_id()) {
+ goaway('new_channel');
+ }
+
}}
diff --git a/mod/lostpass.php b/mod/lostpass.php
index ca93457aa..dd7c7a7d5 100644
--- a/mod/lostpass.php
+++ b/mod/lostpass.php
@@ -30,15 +30,14 @@ function lostpass_post(&$a) {
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$message = replace_macros($email_tpl, array(
- '$sitename' => $a->config['sitename'],
+ '$sitename' => get_config('system','sitename'),
'$siteurl' => $a->get_baseurl(),
- '$username' => $email,
+ '$username' => sprintf( t('Site Member (%s)'), $email),
'$email' => $email,
'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $hash
));
- require_once('include/email.php');
- $subject = email_header_encode(sprintf( t('Password reset requested at %s'),$a->config['sitename']), 'UTF-8');
+ $subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
$res = mail($email, $subject ,
$message,
@@ -65,19 +64,21 @@ function lostpass_content(&$a) {
goaway(z_root());
return;
}
+
$aid = $r[0]['account_id'];
$email = $r[0]['account_email'];
- $password = autoname(6) . mt_rand(100,9999);
+ $new_password = autoname(6) . mt_rand(100,9999);
$salt = random_string(32);
- $password_encoded = hash('whirlpool', $salt . $password);
+ $password_encoded = hash('whirlpool', $salt . $new_password);
$r = q("UPDATE account SET account_salt = '%s', account_password = '%s', account_reset = '' where account_id = %d limit 1",
dbesc($salt),
dbesc($password_encoded),
intval($aid)
);
+
if($r) {
$tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl,array(
@@ -98,12 +99,11 @@ function lostpass_content(&$a) {
$message = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
- '$username' => $email,
+ '$username' => sprintf( t('Site Member (%s)'), $email),
'$email' => $email,
- '$new_password' => $password,
+ '$new_password' => $new_password,
'$uid' => $newuid ));
- require_once('include/email.php');
$subject = email_header_encode( sprintf( t('Your password has changed at %s'), get_config('system','sitename')), 'UTF-8');
$res = mail($email,$subject,$message,