mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-02 05:01:04 -04:00
Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev
Conflicts: modules/gallery/tests/xss_data.txt
This commit is contained in:
@@ -57,6 +57,51 @@ class IdentityProvider_Core {
|
||||
Kohana_Config::instance()->clear("identity");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a commen confirmation message
|
||||
*/
|
||||
static function confirmation_message() {
|
||||
return t("Are you sure you want to change your Identity Provider? " .
|
||||
"Continuing will delete all existing users.");
|
||||
}
|
||||
|
||||
static function change_provider($new_provider) {
|
||||
$current_provider = module::get_var("gallery", "identity_provider");
|
||||
if (!empty($current_provider)) {
|
||||
module::uninstall($current_provider);
|
||||
}
|
||||
|
||||
try {
|
||||
IdentityProvider::reset();
|
||||
$provider = new IdentityProvider($new_provider);
|
||||
|
||||
module::set_var("gallery", "identity_provider", $new_provider);
|
||||
|
||||
if (method_exists("{$new_provider}_installer", "initialize")) {
|
||||
call_user_func("{$new_provider}_installer::initialize");
|
||||
}
|
||||
|
||||
module::event("identity_provider_changed", $current_provider, $new_provider);
|
||||
|
||||
auth::login($provider->admin_user());
|
||||
Session::instance()->regenerate();
|
||||
} catch (Exception $e) {
|
||||
// Make sure new provider is not in the database
|
||||
module::uninstall($new_provider);
|
||||
|
||||
// Lets reset to the current provider so that the gallery installation is still
|
||||
// working.
|
||||
module::set_var("gallery", "identity_provider", null);
|
||||
IdentityProvider::change_provider($current_provider);
|
||||
module::activate($current_provider);
|
||||
message::error(
|
||||
t("Error attempting to enable \"%new_provider\" identity provider, " .
|
||||
"reverted to \"%old_provider\" identity provider",
|
||||
array("new_provider" => $new_provider, "old_provider" => $current_provider)));
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the configured driver and validates it.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user