if ($functionname != 'tmp_get_token') {
throw new moodle_exception('identifyfirst');
} else {
- if (optional_param('username',null,PARAM_ALPHANUM) == 'admin' && optional_param('password',null,PARAM_ALPHANUM) == 'admin') {
+ ///TODO: authentication + token generation need to be implemented
+ if (optional_param('username',null,PARAM_ALPHANUM) == 'wsuser' && optional_param('password',null,PARAM_ALPHANUM) == 'wspassword') {
return '465465465468468464';
} else {
throw new moodle_exception('wrongusernamepassword');
}
}
} else {
+ ///TDO: following function will need to be modified
$user = mock_check_token($token);
if (empty($user)) {
throw new moodle_exception('wrongidentification');
}
else {
+ ///TODO: probably change this
$USER = $user;
}
}
if ($token == 465465465468468464) {
///retrieve the user
global $DB;
- $user = $DB->get_record('user', array('username'=>'admin', 'mnethostid'=>1));
+ $user = $DB->get_record('user', array('username'=>'wsuser', 'mnethostid'=>1));
if (empty($user)) {
return false;
var_dump($data);
//we are asking for a token
-$connectiondata['username'] = 'admin';
-$connectiondata['password'] = 'admin';
+$connectiondata['username'] = 'wsuser';
+$connectiondata['password'] = 'wspassword';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($username) {
//we are asking for a token
- $connectiondata['username'] = 'admin';
- $connectiondata['password'] = 'admin';
+ $connectiondata['username'] = 'wsuser';
+ $connectiondata['password'] = 'wspassword';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//we are asking for a token
- $connectiondata['username'] = 'admin';
- $connectiondata['password'] = 'admin';
+ $connectiondata['username'] = 'wsuser';
+ $connectiondata['password'] = 'wspassword';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($username) {
//we are asking for a token
- $connectiondata['username'] = 'admin';
- $connectiondata['password'] = 'admin';
+ $connectiondata['username'] = 'wsuser';
+ $connectiondata['password'] = 'wspassword';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);