//exclude admins and currently pending requests $found_editable_password = false; if ($res) { $text = $langPassResetIntro . $emailhelpdesk; $text .= $langHowToResetTitle; if (password_is_editable($res->password)) { $found_editable_password = true; //prepare instruction for password reset $text .= $langPassResetGoHere; $text .= $urlServer . "modules/auth/lostpass.php?u={$res->id}&h=" . token_generate('password' . $res->id, true); // store the timestamp of this action (password reminding and token generation) Database::get()->query("UPDATE user SET last_passreminder = CURRENT_TIMESTAMP WHERE id = ?d", $res->id); } else { //other type of auth... $auth = array_search($res->password, $auth_ids) or 1; $tool_content = "<div class='alert alert-danger'>\n <p><strong>{$langPassCannotChange1}</strong></p>\n <p>{$langPassCannotChange2} " . get_auth_info($auth) . ". {$langPassCannotChange3} <a href='mailto:{$emailhelpdesk}'>{$emailhelpdesk}</a> {$langPassCannotChange4}</p>\n {$homelink}</div>"; } /* * *** Account details found, now send e-mail **** */ if ($found_editable_password) { $emailsubject = $lang_remind_pass; if (!send_mail('', '', '', $email, $emailsubject, $text, $charset)) { $tool_content = "<div class='alert alert-danger'>\n <p><strong>{$langAccountEmailError1}</strong></p>\n <p>{$langAccountEmailError2} {$email}.</p>\n <p>{$langAccountEmailError3} <a href='mailto:{$emailhelpdesk}'>{$emailhelpdesk}</a>.</p></div>\n {$homelink}"; } elseif (!isset($auth)) { $tool_content .= "<div class='alert alert-success'>{$lang_pass_email_ok} <strong>" . q($email) . "</strong></div>{$homelink}"; } } } else { $res = Database::get()->querySingle("SELECT u.id, u.surname, u.givenname, u.username, u.password, u.status FROM user u\n\t LEFT JOIN admin a ON (a.user_id = u.id)\n\t WHERE u.email = ?s AND\n\t BINARY u.username = ?s AND \n\t a.user_id IS NULL AND \n\t (u.last_passreminder IS NOT NULL OR DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 HOUR) < u.last_passreminder)", $email, $userName); if ($res) { $tool_content .= "<div class='alert alert-danger'>\n <p>{$langLostPassPending}</p></div>\n {$homelink}"; } else {
} if ($_SESSION['u_prof'] and !$alt_auth_prof_reg) { $tool_content .= "<div class='alert alert-danger'>{$langForbidden}</div>"; draw($tool_content, 0); exit; } $phone_required = $prof; if (!$prof and $alt_auth_stud_reg == 2) { $autoregister = TRUE; } else { $autoregister = FALSE; } $comment_required = !$autoregister; $email_required = !$autoregister || get_config('email_required'); $am_required = !$prof && get_config('am_required'); $pageName = ($prof ? $langReqRegProf : $langUserData) . ' (' . get_auth_info($auth) . ')'; $email_message = $langEmailNotice; $navigation[] = array('url' => 'registration.php', 'name' => $langNewUser); register_posted_variables(array('uname' => true, 'passwd' => true, 'is_submit' => true, 'submit' => true)); $lastpage = 'altnewuser.php?' . ($prof ? 'p=1&' : '') . "auth={$auth}&uname=" . urlencode($uname); $navigation[] = array('url' => $lastpage, 'name' => $langConfirmUser); $errormessage = "<br/><p>{$ldapback} <a href='{$lastpage}'>{$ldaplastpage}</a></p>"; $init_auth = $is_valid = false; if (!isset($_SESSION['was_validated']) or $_SESSION['was_validated']['auth'] != $auth or $_SESSION['was_validated']['uname'] != $uname) { $init_auth = true; // If user wasn't authenticated in the previous step, try // an authentication step now: // First check for Shibboleth if (isset($_SESSION['shib_auth']) and $_SESSION['shib_auth'] == true) { $r = Database::get()->querySingle("SELECT auth_settings FROM auth WHERE auth_id = 6"); if ($r) {
$toolName = $langMyProfile; $pageName = $langModifyProfile; $navigation[] = array('url' => 'display_profile.php', 'name' => $langMyProfile); $tree = new Hierarchy(); $userObj = new User(); $image_path = $webDir . '/courses/userimg/' . $_SESSION['uid']; load_js('jstree'); load_js('tools.js'); $head_content .= "<script type='text/javascript'>\nvar lang = { \n addPicture: '" . js_escape($langAddPicture) . "',\n confirmDelete: '" . js_escape($langConfirmDelete) . "'}; \n\$(profile_init);</script>"; $myrow = Database::get()->querySingle("SELECT surname, givenname, username, email, am, phone,\n lang, status, has_icon, description,\n email_public, phone_public, am_public, password\n FROM user WHERE id = ?d", $uid); $password = $myrow->password; $auth = array_search($password, $auth_ids); if (!$auth) { $auth = 1; } $auth_text = get_auth_info($auth); if ($auth != 1) { $allow_username_change = false; $allow_password_change = false; } else { $allow_username_change = !get_config('block_username_change'); $allow_password_change = true; } if (in_array($password, array('shibboleth', 'cas', 'ldap'))) { $allow_name_change = false; } else { $allow_name_change = true; } // Handle AJAX profile image delete if (isset($_POST['delimage'])) { @unlink($image_path . '_' . IMAGESIZE_LARGE . '.jpg');
exit; } if (isset($_REQUEST['auth'])) { $auth = intval($_REQUEST['auth']); $_SESSION['u_tmp'] = $auth; } if (!isset($_REQUEST['auth'])) { $auth = 0; $auth = $_SESSION['u_tmp']; } unset($_SESSION['was_validated']); $authmethods = get_auth_active_methods(); $msg = get_auth_info($auth); $settings = get_auth_settings($auth); if (!empty($msg)) { $pageName = "$langConfirmUser ($msg)"; } if (isset($_GET['p']) and $_GET['p']) { $_SESSION['u_prof'] = 1; } else { $_SESSION['u_prof'] = 0; } if (!$_SESSION['u_prof'] and !$alt_auth_stud_reg) { $tool_content .= "<div class='alert alert-danger'>$langForbidden</div>"; draw($tool_content, 0);
} } if (!$target) { $target_field .= "<div class='form-group'><label class='col-sm-3 control-label'>$langUserMergeTarget:</label> <div class='col-sm-9'><input type='text' name='target' size='50'></div></div>"; } $tool_content = "<div class='form-wrapper'> <form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]'> <fieldset> <div class='form-group'> <label class='col-sm-3 control-label'>$langUser:</label> <div class='col-sm-9'>" . display_user($info['id']) . "</div> </div> <div class='form-group'> <label class='col-sm-3 control-label'>$langEditAuthMethod:</label> <div class='col-sm-9'>" . get_auth_info($auth_id) . "</div> </div> <div class='form-group'> <label class='col-sm-3 control-label'>$langProperty:</label> <div class='col-sm-9'>" . q($status_names[$info['status']]) . "</div> </div> $target_field <input type='hidden' name='u' value='$u'> <div class='col-sm-offset-3 col-sm-9'> <input class='btn btn-primary' type='submit' name='submit' value='$submit_button'> </div> </fieldset> $target_user_input </form></div>"; } } else {
$tool_content .= "<table class='table-default'>"; $tool_content .= "<tr class='list-header'><th>$langOfTeacher</th></tr>"; if ($eclass_prof_reg) { if(empty($provider)) $tool_content .= "<tr><td><a href='formuser.php?p=1'>$langUserAccountInfo1</a></td></tr>"; else $tool_content .= "<tr><td><a href='formuser.php$provider$provider_user_data&p=1'>$langUserAccountInfo1</a></td></tr>"; } if (count($auth) > 1 and $alt_auth_prof_reg) { $tool_content .= "<td>$langUserAccountInfo1 $langWith:"; foreach ($auth as $k => $v) { if ($v != 1) { // bypass the eclass auth method //hybridauth registration is performed in newuser.php rather than altnewuser if ($v < 8) { $tool_content .= "<br /><a href='altnewuser.php?auth=" . $v . "'>" . get_auth_info($v) . "</a>"; } else { if ($alt_auth_prof_reg) $tool_content .= "<br /><a href='formuser.php?auth=" . $v . "&p=1'>" . get_auth_info($v) . "</a>"; else $tool_content .= "<br /><a href='newuser.php?auth=" . $v . "&p=1'>" . get_auth_info($v) . "</a>"; } } } $tool_content .= "</td>"; } $tool_content .= "</table>"; } else { $tool_content .= "<div class='alert alert-info'>$langTeacherCannotRegister</div>"; } } else { // disable registration $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $urlServer, 'icon' => 'fa-reply', 'level' => 'primary-label',
$tool_content .= "<li>" . get_auth_info($v) . " ({$langNbUsers}: {$lc}{$l})</li>"; } $tool_content .= "</ul>"; } $tool_content .= "</div>"; } else { if (empty($settings)) { $tool_content .= "<div class='alert alert-danger'>{$langErrActiv} {$langActFailure}</div>"; } else { if ($active == 'yes') { $tool_content .= "<div class='alert alert-success'>"; $tool_content .= "{$langActSuccess}" . get_auth_info($auth); $tool_content .= "</div>"; } else { $tool_content .= "<div class='alert alert-success'>"; $tool_content .= "{$langDeactSuccess}" . get_auth_info($auth); $tool_content .= "</div>"; } } } $tool_content .= "<table class='table-default'>"; $tool_content .= "<th>{$langAllAuthTypes}</th><th class='text-center'>" . icon('fa-gears', $langActions) . "</th>"; foreach ($auth_ids as $auth_id => $auth_name) { $tool_content .= "<tr><td>" . strtoupper($auth_name) . ":</td><td class='option-btn-cell'>"; if (in_array($auth_id, $auth_methods)) { $activation_url = "auth.php?auth={$auth_id}&active=no"; $activation_title = $langDeactivate; $activation_icon = "fa-toggle-off"; } else { $activation_url = "auth.php?auth={$auth_id}&active=yes"; $activation_title = $langActivate;
'defaults' => $depid, 'tree' => null, 'where' => "AND node.allow_user = true", 'multiple' => false); if (isDepartmentAdmin()) { $nodePickerParams['allowables'] = $user->getDepartmentIds($uid); } list($tree_js, $tree_html) = $tree->buildNodePicker($nodePickerParams); $head_content .= $tree_js; if ($eclass_method_unique) { $tool_content .= "<input type='hidden' name='auth_form' value='1'>"; } else { $auth_m = array(); foreach ($active_auth_methods as $m) { $auth_m[$m] = get_auth_info($m); } formGroup('auth_selection', $langEditAuthMethod, selection($auth_m, 'auth_form', '', "id='auth_selection' class='form-control'")); } formGroup('passsword_form', $langPass, "<input class='form-control' type='text' name='password'" . getValue('password', genPass()) . " id='password' autocomplete='off' placeholder='" . q($langPass) . "'><span id='result'></span>"); if (get_config('email_required')) { $email_message = "$langEmail $langCompulsory"; } else { $email_message = "$langEmail $langOptional"; } formGroup('email_form', $langEmail, "<input class='form-control' id='email_form' type='text' name='email_form'" .
if ($res) { $text = $langPassResetIntro . $emailhelpdesk; $text .= $langHowToResetTitle; if (password_is_editable($res->password)) { $found_editable_password = true; //prepare instruction for password reset $text .= $langPassResetGoHere; $text .= $urlServer . "modules/auth/lostpass.php?u=$res->id&h=" . token_generate('password' . $res->id, true); // store the timestamp of this action (password reminding and token generation) Database::get()->query("UPDATE user SET last_passreminder = CURRENT_TIMESTAMP WHERE id = ?d" , $res->id); } else { //other type of auth... $auth = array_search($res->password, $auth_ids) or 1; $tool_content = "<div class='alert alert-danger'> <p><strong>$langPassCannotChange1</strong></p> <p>$langPassCannotChange2 " . get_auth_info($auth) . ". $langPassCannotChange3 <a href='mailto:$emailhelpdesk'>$emailhelpdesk</a> $langPassCannotChange4</p> $homelink</div>"; } /* * *** Account details found, now send e-mail **** */ if ($found_editable_password) { $emailsubject = $lang_remind_pass; if (!send_mail('', '', '', $email, $emailsubject, $text, $charset)) { $tool_content = "<div class='alert alert-danger'> <p><strong>$langAccountEmailError1</strong></p> <p>$langAccountEmailError2 $email.</p> <p>$langAccountEmailError3 <a href='mailto:$emailhelpdesk'>$emailhelpdesk</a>.</p></div> $homelink"; } elseif (!isset($auth)) { $tool_content .= "<div class='alert alert-success'>$lang_pass_email_ok <strong>" .
$eclass_method_unique = TRUE; $auth = get_auth_active_methods(); foreach ($auth as $methods) { if ($methods != 1) { $eclass_method_unique = FALSE; } } if (!$eclass_method_unique) { $auth_m = array(); $tool_content .= "<div class='form-group'> <label for='passsword' class='col-sm-3 control-label'>$langMethods</label> <div class='col-sm-9'>"; foreach ($auth as $methods) { $auth_text = get_auth_info($methods); $auth_m[$methods] = $auth_text; } $tool_content .= selection($auth_m, "auth_methods_form", '', "class='form-control'"); $tool_content .= "</div></div>"; } $tool_content .= "<div class='form-group'> <label for='prefix' class='col-sm-3 control-label'>$langMultiRegPrefix:</label> <div class='col-sm-9'> <input class='form-control' type='text' name='prefix' id='prefix' value='user'> </div> </div> <div class='form-group'> <label class='col-sm-3 control-label'>$langFaculty:</label> <div class='col-sm-9'>";
$require_usermanage_user = TRUE; include '../../include/baseTheme.php'; include 'include/sendMail.inc.php'; require_once 'auth.inc.php'; require_once 'include/lib/user.class.php'; require_once 'include/lib/hierarchy.class.php'; $tree = new Hierarchy(); $userObj = new User(); load_js('jstree3'); $auth = isset($_REQUEST['auth']) ? intval($_REQUEST['auth']) : ''; $msg = "$langProfReg (" . (get_auth_info($auth)) . ")"; $toolName = $msg; $navigation[] = array("url" => "../admin/index.php", "name" => $langAdmin); $navigation[] = array("url" => "../admin/listreq.php", "name" => $langOpenProfessorRequests); $submit = isset($_POST['submit']) ? $_POST['submit'] : ''; // professor registration if ($submit) { $rid = $_POST['rid']; $pn = $_POST['pn']; $ps = $_POST['ps']; $pu = $_POST['pu']; $pe = $_POST['pe']; $phone = $_POST['phone']; $department = $_POST['department'];
$target_field .= "<tr><th width='170' class='left'>{$langUserMergeTarget}:</th>\n <td>" . display_user($target) . " (" . q($target['username']) . ")</td></tr>\n <tr><th width='170' class='left'>{$langEditAuthMethod}</th>\n <td>" . get_auth_info($target_auth_id) . "</td></tr>\n <tr><th width='170' class='left'>{$langProperty}:</th>\n <td>" . q($status_names[$target['status']]) . "</td></tr>"; if ($info['status'] == 1 and $target['status'] != 1) { $target = false; $target_field .= "<tr><td colspan='2' class='alert alert-warning'>{$langUserMergeForbidden}</td></tr>"; } else { if ($_POST['submit'] == $langUserMerge) { do_user_merge($info, $target); } $submit_button = $langUserMerge; $target_user_input = '<input type="hidden" name="target" value="' . q($target['username']) . '">'; } } if (!$target) { $target_field .= "<tr><th width='170' class='left'>{$langUserMergeTarget}:</th>\n <td><input type='text' name='target' size='50'></td></tr>"; } $tool_content = "<form method='post' action='{$_SERVER['SCRIPT_NAME']}'>\n <fieldset>\n <legend>{$legend}</legend>\n <table class='tbl' width='100%'>\n <tr><th width='170' class='left'>{$langUser}:</th>\n <td>" . display_user($info) . "</td></tr>\n <tr><th width='170' class='left'>{$langEditAuthMethod}</th>\n <td>" . get_auth_info($auth_id) . "</td></tr>\n <tr><th width='170' class='left'>{$langProperty}:</th>\n <td>" . q($status_names[$info['status']]) . "</td></tr>\n {$target_field}\n <tr><th> </th>\n <td class='right'>\n <input type='hidden' name='u' value='{$u}'>\n <input class='btn btn-primary' type='submit' name='submit' value='{$submit_button}'></td></tr>\n </table>\n </fieldset>\n {$target_user_input}\n </form>"; } } else { $tool_content .= "<h1>{$langError}</h1>\n<p><a href='search_user.php'>{$langBack}</p>\n"; } draw($tool_content, 3, null, $head_content); function do_user_merge($source, $target) { global $langUserMergeSuccess, $langBack; $source_id = $source['user_id']; $target_id = $target['user_id']; $courses = array(); Database::get()->queryFunc("SELECT code FROM course_user, course\n WHERE course.id = course_user.course_id AND\n user_id = ?d", function ($row) use(&$courses) { $courses[] = $row->code; }, $target_id); $tmp_table = "user_merge_{$source_id}_{$target_id}";
$auth_count = count_auth_users($auth_id); $auth_active = in_array($auth_id, $auth_active_ids); if ($auth_count > 0 or $auth_active) { $auth_search_link = ($auth_count == 0)? '0': "<a href='listusers.php?fname=&lname=&am=&user_type=0&auth_type=$auth_id&reg_flag=1&user_registered_at=&verified_mail=3&email=&uname=&department=0'>$auth_count</a>"; if ($auth_id != 1 and $auth_count > 0) { $auth_change_link = " - <a href='auth_change.php?auth=$auth_id'>$langAuthChangeUser</a>"; } else { $auth_change_link = ''; } if (!$auth_active) { $auth_warn = "<br><span class='label label-warning'>$langAuthWarnInactive</span>"; } else { $auth_warn = ''; } $tool_content .= "<li>" . get_auth_info($auth_id) . " ($langNbUsers: $auth_search_link$auth_change_link)$auth_warn</li>"; } } $tool_content .= "</ul></div>"; $authMethods = Database::get()->queryArray("SELECT * FROM auth ORDER BY auth_default DESC, auth_id"); $tool_content .= "<div class='table-responsive'><table class='table-default'>"; $tool_content .= "<th>$langAllAuthTypes</th><th class='text-right'>".icon('fa-gears', $langActions)."</th>"; foreach ($authMethods as $info) { $auth_id = $info->auth_id; $auth_name = $info->auth_name; $active = $info->auth_default; $primary = $info->auth_default > 1; $primaryLabel = $primary? " <small><span class='label label-default'>$langPrimaryAuthType</span></small>": ''; $visibility = $active? '': ' class=not_visible'; $activation_url = "$_SERVER[PHP_SELF]?auth=$auth_id&q=" . !$active;
$tool_content .= "</table>"; } else { $tool_content .= "<div class='alert alert-info'>{$langStudentCannotRegister}</div>"; } // teacher registration if ($eclass_prof_reg or $alt_auth_prof_reg) { // allow teacher registration $tool_content .= "<table class='table table-striped table-bordered table-hover'>"; $tool_content .= "<tr><th>{$langOfTeacher}</th></tr>"; if ($eclass_prof_reg) { $tool_content .= "<tr><td><a href='formuser.php?p=1'>{$langUserAccountInfo1}</a></td></tr>"; } if (count($auth) > 1 and $alt_auth_prof_reg) { $tool_content .= "<tr><td>{$langUserAccountInfo1} {$langWith}:"; foreach ($auth as $k => $v) { if ($v != 1) { // bypass the eclass auth method $tool_content .= "<br /><a href='altnewuser.php?p=1&auth=" . $v . "'>" . get_auth_info($v) . "</a>"; } } $tool_content .= "</td></tr>"; } $tool_content .= "</table>"; } else { $tool_content .= "<div class='alert alert-info'>{$langTeacherCannotRegister}</div>"; } } else { // disable registration $tool_content .= "<div class='alert alert-info'>{$langCannotRegister}</div>"; } draw($tool_content, 0);
function get_auth_timezone() { return get_auth_info('timezone'); }
$tool_content .= "<div class='alert alert-success'>$langHasActivate</div>"; } else { $tool_content .= "<div class='alert alert-warning'>$langAlreadyActiv</div>"; } } } } } else { // handle reloads on auth_process.php after authentication check // also handles requests with empty $auth // without this, a form with just username/password is displayed if (!$auth) { redirect_to_home_page('modules/admin/auth.php'); } $pageName = get_auth_info($auth); // get authentication settings if ($auth != 6) { $auth_data = get_auth_settings($auth); } // display form $tool_content .= "<div class='form-wrapper'> <form class='form-horizontal' name='authmenu' method='post' action='$_SERVER[SCRIPT_NAME]'> <fieldset> <input type='hidden' name='auth' value='" . intval($auth) . "'>"; if (!empty($_SESSION['cas_warn']) && $_SESSION['cas_do']) { $auth = 7; $tool_content .= "<div class='alert alert-warning'>$langCASnochange</div>"; }
@Description: This script/file tries to authenticate the user, using his user/pass pair and the authentication method defined by the admin ============================================================================== */ $require_usermanage_user = TRUE; include '../../include/baseTheme.php'; include 'include/sendMail.inc.php'; require_once 'auth.inc.php'; require_once 'include/lib/user.class.php'; require_once 'include/lib/hierarchy.class.php'; $tree = new Hierarchy(); $userObj = new User(); load_js('jstree'); $auth = isset($_REQUEST['auth']) ? intval($_REQUEST['auth']) : ''; $msg = "{$langProfReg} (" . get_auth_info($auth) . ")"; $pageName = $msg; $navigation[] = array("url" => "../admin/index.php", "name" => $langAdmin); $navigation[] = array("url" => "../admin/listreq.php", "name" => $langOpenProfessorRequests); $tool_content = ""; $submit = isset($_POST['submit']) ? $_POST['submit'] : ''; // professor registration if ($submit) { $rid = $_POST['rid']; $pn = $_POST['pn']; $ps = $_POST['ps']; $pu = $_POST['pu']; $pe = $_POST['pe']; $department = $_POST['department']; $comment = isset($_POST['comment']) ? $_POST['comment'] : ''; $lang = $session->validate_language_code(@$_POST['language']);