mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Bug #2503: Add rollback in case of error
This commit is contained in:
parent
0a3ba8aca9
commit
2e8dc65fd6
@ -21,7 +21,6 @@
|
|||||||
#include "UserTemplate.h"
|
#include "UserTemplate.h"
|
||||||
#include "ObjectCollection.h"
|
#include "ObjectCollection.h"
|
||||||
#include "QuotasSQL.h"
|
#include "QuotasSQL.h"
|
||||||
#include "NebulaUtil.h"
|
|
||||||
|
|
||||||
class UserQuotas;
|
class UserQuotas;
|
||||||
|
|
||||||
|
@ -119,11 +119,20 @@ int UserChangeAuth::user_action(int user_id,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string old_auth = user->get_auth_driver();
|
||||||
|
|
||||||
rc = user->set_auth_driver(new_auth, error_str);
|
rc = user->set_auth_driver(new_auth, error_str);
|
||||||
|
|
||||||
if ( rc == 0 && !new_pass.empty() )
|
if ( rc == 0 && !new_pass.empty() )
|
||||||
{
|
{
|
||||||
rc = user->set_password(new_pass, error_str);
|
rc = user->set_password(new_pass, error_str);
|
||||||
|
|
||||||
|
if (rc != 0)
|
||||||
|
{
|
||||||
|
string tmp_str;
|
||||||
|
|
||||||
|
user->set_auth_driver(old_auth, tmp_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc == 0 )
|
if ( rc == 0 )
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Nebula.h"
|
#include "Nebula.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
#include "NebulaUtil.h"
|
||||||
|
|
||||||
const string User::INVALID_NAME_CHARS = " :\t\n\v\f\r";
|
const string User::INVALID_NAME_CHARS = " :\t\n\v\f\r";
|
||||||
const string User::INVALID_PASS_CHARS = " \t\n\v\f\r";
|
const string User::INVALID_PASS_CHARS = " \t\n\v\f\r";
|
||||||
@ -314,6 +314,7 @@ int User::from_xml(const string& xml)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -363,6 +364,8 @@ int User::set_password(const string& passwd, string& error_str)
|
|||||||
return rc;
|
return rc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bool User::pass_is_valid(const string& pass, string& error_str)
|
bool User::pass_is_valid(const string& pass, string& error_str)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user