Merge remote-tracking branch 'github-dhruvgoel92/feature/delete-auto-logins' into develop

* github-dhruvgoel92/feature/delete-auto-logins:
  [feature-delete-auto-logins] adds module to database update
  [feature/delete-auto-logins] fixes style
  [feature/delete-auto-logins] improves styling
  [feature/delete-auto-logins] fixes language entry
  [feature/delete-auto-logins] fix language keys and styling
  [feature/delete-auto-logins] explain persistent keys in the ucp.
  [feature/delete-auto-logins] template added for subsilver2
  [feature/delete-auto-logins] improved styling and fixes language
  [feature/delete-auto-logins] using loop for errors
  [feature/delete-auto-logins] fixes css corners
  [feature/delete-auto-logins] Fixes language entries
  [feature/delete-auto-logins] checks form key
  [feature/delete-auto-logins] Fixes language entries and redirection.
  [feature/delete-auto-logins] User can view/delete auto logins.
This commit is contained in:
Nils Adermann 2012-06-11 23:39:09 +02:00
commit 5acbf0980d
6 changed files with 170 additions and 0 deletions

View file

@ -23,6 +23,7 @@ class ucp_profile_info
'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => 'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)', 'cat' => array('UCP_PROFILE')),
'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'autologin_keys'=> array('title' => 'UCP_PROFILE_AUTOLOGIN_KEYS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
),
);
}

View file

@ -618,6 +618,60 @@ class ucp_profile
}
break;
case 'autologin_keys':
add_form_key('ucp_autologin_keys');
if ($submit)
{
$keys = request_var('keys', array(''));
if (!check_form_key('ucp_autologin_keys'))
{
$error[] = 'FORM_INVALID';
}
if (!sizeof($error))
{
if (!empty($keys))
{
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
AND ' . $db->sql_in_set('key_id', $keys) ;
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['AUTOLOGIN_SESSION_KEYS_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
}
$sql = 'SELECT key_id, last_ip, last_login
FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('sessions', array(
'errors' => $error,
'KEY' => $row['key_id'],
'IP' => $row['last_ip'],
'LOGIN_TIME' => $user->format_date($row['last_login']),
));
}
$db->sql_freeresult($result);
break;
}
$template->assign_vars(array(

View file

@ -2343,6 +2343,13 @@ function change_database_data(&$no_updates, $version)
'auth' => 'acl_a_styles',
'cat' => 'ACP_STYLE_MANAGEMENT',
),
'autologin_keys' => array(
'base' => 'ucp_profile',
'class' => 'ucp',
'title' => 'UCP_PROFILE_AUTOLOGIN_KEYS',
'auth' => '',
'cat' => 'UCP_PROFILE',
),
);
_add_modules($modules_to_install);

View file

@ -87,6 +87,7 @@ $lang = array_merge($lang, array(
'ATTACHMENTS_EXPLAIN' => 'This is a list of attachments you have made in posts to this board.',
'ATTACHMENTS_DELETED' => 'Attachments successfully deleted.',
'ATTACHMENT_DELETED' => 'Attachment successfully deleted.',
'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected persistent login keys were successfully deleted.',
'AVATAR_CATEGORY' => 'Category',
'AVATAR_EXPLAIN' => 'Maximum dimensions; width: %1$s, height: %2$s, file size: %3$.2f KiB.',
'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.',
@ -256,6 +257,8 @@ $lang = array_merge($lang, array(
'LINK_REMOTE_SIZE' => 'Avatar dimensions',
'LINK_REMOTE_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.',
'LOGIN_EXPLAIN_UCP' => 'Please login in order to access the User Control Panel.',
'LOGIN_KEY' => 'Login Key',
'LOGIN_TIME' => 'Login Time',
'LOGIN_REDIRECT' => 'You have been successfully logged in.',
'LOGOUT_FAILED' => 'You were not logged out, as the request did not match your session. Please contact the board administrator if you continue to experience problems.',
'LOGOUT_REDIRECT' => 'You have been successfully logged out.',
@ -377,6 +380,8 @@ $lang = array_merge($lang, array(
'PREFERENCES_UPDATED' => 'Your preferences have been updated.',
'PROFILE_INFO_NOTICE' => 'Please note that this information may be viewable to other members. Be careful when including any personal details. Any fields marked with a * must be completed.',
'PROFILE_UPDATED' => 'Your profile has been updated.',
'PROFILE_AUTOLOGIN_KEYS' => 'The persistent login keys automatically log you in when you visit the board. If you logout, the persistent login key is deleted only on the computer you are using to logout. Here you can see persistent login keys created on other computers you used to access this site.',
'PROFILE_NO_AUTOLOGIN_KEYS' => 'There are no saved persistent login keys.',
'RECIPIENT' => 'Recipient',
'RECIPIENTS' => 'Recipients',
@ -466,6 +471,7 @@ $lang = array_merge($lang, array(
'UCP_PROFILE_PROFILE_INFO' => 'Edit profile',
'UCP_PROFILE_REG_DETAILS' => 'Edit account settings',
'UCP_PROFILE_SIGNATURE' => 'Edit signature',
'UCP_PROFILE_AUTOLOGIN_KEYS'=> 'Edit persistent login keys',
'UCP_USERGROUPS' => 'Usergroups',
'UCP_USERGROUPS_MEMBER' => 'Edit memberships',

View file

@ -0,0 +1,53 @@
<!-- INCLUDE ucp_header.html -->
<form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}>
<h2>{L_TITLE}</h2>
<div class="panel">
<div class="inner">
<fieldset>
<!-- IF .errors -->
<p class="error">
<!-- BEGIN errors -->
{errors} <br />
<!-- END errors -->
</p>
<!-- ENDIF -->
<p>{L_PROFILE_AUTOLOGIN_KEYS}</p><br />
<table cellspacing="1" class="table1">
<thead>
<tr>
<th>{L_MARK}</th>
<th>{L_LOGIN_KEY}</th>
<th>{L_IP}</th>
<th>{L_LOGIN_TIME}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN sessions -->
<!-- IF sessions.S_ROW_COUNT is even --><tr class="bg1"><!-- ELSE --><tr class="bg2"><!-- ENDIF -->
<td style="text-align: center"><input type="checkbox" name="keys[]" value="{sessions.KEY}" id="{sessions.KEY}"/></td>
<td><label for="{sessions.KEY}">{sessions.KEY}</label></td>
<td style="text-align: center">{sessions.IP}</td>
<td style="text-align: center">{sessions.LOGIN_TIME}</td>
</tr>
<!-- BEGINELSE -->
<tr><td colspan="4" class="bg1" style="text-align: center">{L_PROFILE_NO_AUTOLOGIN_KEYS}</td></tr>
<!-- END sessions -->
</tbody>
</table>
</fieldset>
</div>
</div>
<!-- IF .sessions -->
<fieldset class="submit-buttons">
{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_DELETE}" class="button1" />
{S_FORM_TOKEN}
</fieldset>
<!-- ENDIF -->
</form>
<!-- INCLUDE ucp_footer.html -->

View file

@ -0,0 +1,49 @@
<!-- INCLUDE ucp_header.html -->
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th colspan="4" valign="middle">{L_TITLE}</th>
</tr>
<!-- IF .errors -->
<tr>
<td class="row3" colspan="2" align="center"><span class="gensmall error">
<!-- BEGIN errors -->
{errors} <br />
<!-- END errors -->
</td>
</tr>
<!-- ENDIF -->
<tr>
<td colspan="4" class="row1">{L_PROFILE_AUTOLOGIN_KEYS}</td>
</tr>
<tr>
<th>{L_MARK}</th>
<th>{L_LOGIN_KEY}</th>
<th>{L_IP}</th>
<th>{L_LOGIN_TIME}</th>
</tr>
<!-- BEGIN sessions -->
<!-- IF sessions.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td class="genmed" style="text-align: center"><input type="checkbox" name="keys[]" value="{sessions.KEY}" id="{sessions.KEY}"/></td>
<td class="genmed"><label for="{sessions.KEY}">{sessions.KEY}</label></td>
<td class="genmed" style="text-align: center">{sessions.IP}</td>
<td class="genmed" style="text-align: center">{sessions.LOGIN_TIME}</td>
</tr>
<!-- BEGINELSE -->
<tr>
<td colspan="4" class="row1" style="text-align: center">{L_PROFILE_NO_AUTOLOGIN_KEYS}</td>
</tr>
<!-- END sessions -->
<!-- IF .sessions -->
<tr>
<td class="cat" colspan="4" align="center">
{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_DELETE}" />
{S_FORM_TOKEN}
</td>
</tr>
<!-- ENDIF -->
</table>
<!-- INCLUDE ucp_footer.html -->