offer change password only when the action is supported by the user backend
This commit is contained in:
parent
e6400b3059
commit
5221ee0c5a
18
lib/user.php
18
lib/user.php
|
@ -419,6 +419,24 @@ class OC_User {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check whether user can change his password
|
||||||
|
* @param $uid The username
|
||||||
|
* @returns true/false
|
||||||
|
*
|
||||||
|
* Check whether a specified user can change his password
|
||||||
|
*/
|
||||||
|
public static function canUserChangePassword($uid) {
|
||||||
|
foreach(self::$_usedBackends as $backend) {
|
||||||
|
if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) {
|
||||||
|
if($backend->userExists($uid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the password is correct
|
* @brief Check if the password is correct
|
||||||
* @param $uid The username
|
* @param $uid The username
|
||||||
|
|
|
@ -47,6 +47,7 @@ $tmpl->assign('total_space', OC_Helper::humanFileSize($storageInfo['total']));
|
||||||
$tmpl->assign('usage_relative', $storageInfo['relative']);
|
$tmpl->assign('usage_relative', $storageInfo['relative']);
|
||||||
$tmpl->assign('email', $email);
|
$tmpl->assign('email', $email);
|
||||||
$tmpl->assign('languages', $languages);
|
$tmpl->assign('languages', $languages);
|
||||||
|
$tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
|
||||||
|
|
||||||
$forms=OC_App::getForms('personal');
|
$forms=OC_App::getForms('personal');
|
||||||
$tmpl->assign('forms', array());
|
$tmpl->assign('forms', array());
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
<a class="button" href="https://itunes.apple.com/us/app/owncloud/id543672169?mt=8" target="_blank"><?php echo $l->t('Download iOS Client');?></a>
|
<a class="button" href="https://itunes.apple.com/us/app/owncloud/id543672169?mt=8" target="_blank"><?php echo $l->t('Download iOS Client');?></a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if($_['passwordChangeSupported']) {
|
||||||
|
?>
|
||||||
<form id="passwordform">
|
<form id="passwordform">
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<legend><strong><?php echo $l->t('Password');?></strong></legend>
|
<legend><strong><?php echo $l->t('Password');?></strong></legend>
|
||||||
|
@ -27,6 +29,9 @@
|
||||||
<input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" />
|
<input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<form id="lostpassword">
|
<form id="lostpassword">
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
|
|
Loading…
Reference in New Issue