Conflicts: core/templates/login.php index.php lib/util.phpremotes/origin/stable
commit
21a88613a1
@ -0,0 +1,32 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
$RUNTIME_NOAPPS = TRUE; //no apps |
||||
require_once('../lib/base.php'); |
||||
|
||||
// Someone lost their password: |
||||
if (isset($_POST['user'])) { |
||||
if (OC_User::userExists($_POST['user'])) { |
||||
$token = sha1($_POST['user']+uniqId()); |
||||
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token); |
||||
$email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', ''); |
||||
if (!empty($email)) { |
||||
$link = OC_Helper::linkTo('lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; |
||||
$tmpl = new OC_Template('lostpassword', 'email'); |
||||
$tmpl->assign('link', $link); |
||||
$msg = $tmpl->fetchPage(); |
||||
$l = new OC_L10N('core'); |
||||
mail($email, $l->t('Owncloud password reset'), $msg); |
||||
} |
||||
OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => true)); |
||||
} else { |
||||
OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => true, 'requested' => false)); |
||||
} |
||||
} else { |
||||
OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false)); |
||||
} |
@ -0,0 +1,27 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
$RUNTIME_NOAPPS = TRUE; //no apps |
||||
require_once('../lib/base.php'); |
||||
|
||||
// Someone wants to reset their password: |
||||
if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === $_GET['token']) { |
||||
if (isset($_POST['password'])) { |
||||
if (OC_User::setPassword($_GET['user'], $_POST['password'])) { |
||||
OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword'); |
||||
OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => true)); |
||||
} else { |
||||
OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false)); |
||||
} |
||||
} else { |
||||
OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false)); |
||||
} |
||||
} else { |
||||
// Someone lost their password |
||||
OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false)); |
||||
} |
@ -0,0 +1 @@ |
||||
<?php echo str_replace('{link}', $_['link'], $l->t('Use the following link to reset your password: {link}')) ?> |
@ -1,7 +1,8 @@ |
||||
<form action="<?php echo 'index.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<form action="<?php echo 'resetpassword.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<fieldset> |
||||
<?php if($_['success']): ?> |
||||
<?php echo $l->t('Your password was reset'); ?> |
||||
<h1><?php echo $l->t('Your password was reset'); ?></h1>
|
||||
<p><a href="<?php echo OC::$WEBROOT ?>/"><?php echo $l->t('To login page'); ?></a></p>
|
||||
<?php else: ?> |
||||
<input type="password" name="password" id="password" placeholder="<?php echo $l->t('New password'); ?>" value="" required />
|
||||
<input type="submit" id="submit" value="<?php echo $l->t('Reset password'); ?>" />
|
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
// Init owncloud |
||||
require_once('../../lib/base.php'); |
||||
|
||||
OC_JSON::checkLoggedIn(); |
||||
|
||||
$l=new OC_L10N('core'); |
||||
|
||||
// Get data |
||||
if( isset( $_POST['email'] ) ){ |
||||
$email=trim($_POST['email']); |
||||
OC_Preferences::setValue(OC_User::getUser(),'settings','email',$email); |
||||
OC_JSON::success(array("data" => array( "message" => $l->t("email Changed") ))); |
||||
}else{ |
||||
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") ))); |
||||
} |
||||
|
||||
?> |
Loading…
Reference in new issue