// Retrieves main user properties.
/** TODO: Move needed informations to account tables */
/** TODO: Currently suppressed data are matricule, promo */
- /** TODO: Data to move are: banana_last, watch_last, last_version */
/** TODO: Use the User object to fetch all this */
$res = XDB::query("SELECT a.uid, a.hruid, a.display_name, a.full_name, a.password,
a.sex = 'female' AS femme, a.email_format,
a.token, FIND_IN_SET('watch', a.flags) AS watch_account,
- UNIX_TIMESTAMP(fp.last_seen) AS banana_last, q.watch_last,
- q.last_version, g.g_account_name IS NOT NULL AS googleapps,
+ UNIX_TIMESTAMP(fp.last_seen) AS banana_last, w.last AS watch_last,
+ a.last_version, g.g_account_name IS NOT NULL AS googleapps,
UNIX_TIMESTAMP(s.start) AS lastlogin, s.host,
a.is_admin, at.perms
FROM accounts AS a
INNER JOIN account_types AS at ON(a.type = at.type)
- INNER JOIN auth_user_quick AS q ON(a.uid = q.user_id)
+ INNER JOIN watch AS w ON(w.uid = a.uid)
LEFT JOIN forum_profiles AS fp ON(fp.uid = a.uid)
LEFT JOIN gapps_accounts AS g ON(a.uid = g.l_userid AND g.g_status = 'active')
LEFT JOIN logger.last_sessions AS ls ON (ls.uid = a.uid)
if (Env::v('op') == "Valider" && strlen($pass) >= 6
&& Env::v('smtppass1') == Env::v('smtppass2')) {
- // FIXME: Put smtppass somewhere
- XDB::execute('UPDATE auth_user_md5
- SET smtppass = {?}
- WHERE user_id = {?}', $pass, $uid);
+ XDB::execute('UPDATE accounts
+ SET weak_password = {?}
+ WHERE uid = {?}', $pass, $uid);
$page->trigSuccess('Mot de passe enregistré');
S::logger()->log("passwd_ssl");
} elseif (Env::v('op') == "Supprimer") {
- // FIXME: Put smtppass somewhere
- XDB::execute('UPDATE auth_user_md5
- SET smtppass = ""
- WHERE user_id = {?}', $uid);
+ XDB::execute('UPDATE accounts
+ SET weak_password = NULL
+ WHERE uid = {?}', $uid);
$page->trigSuccess('Compte SMTP et NNTP supprimé');
S::logger()->log("passwd_del");
}
- $res = XDB::query("SELECT IF(smtppass != '', 'actif', '')
- FROM auth_user_md5
- WHERE user_id = {?}", $uid);
+ $res = XDB::query("SELECT weak_password IS NOT NULL
+ FROM accounts
+ WHERE uid = {?}", $uid);
$page->assign('actif', $res->fetchOneCell());
}
# Access
password char(40) default null,
token varchar(32) default null,
+ weak_password varchar(256) default null,
registration_date datetime not null,
# Administrative tools
sex enum('female', 'male') not null default 'male',
email_format enum('text', 'html') not null default 'html',
skin varchar(32) default null,
+ last_version varchar(16) not null,
primary key uid (uid),
unique key hruid (hruid),
--- /dev/null
+create table watch (
+ uid int(6) not null auto_increment,
+ flags set('contacts', 'mail') not null default 'contacts',
+ last timestamp not null default '0000-00-00',
+
+ primary key uid (uid),
+ key flags (flags)
+);
+
+# vim:set syntax=mysql:
IF(perms = 'admin' or perms = 'user', 'active', perms) AS state,
IF(LENGTH(password) = 40, password, NULL) AS password,
IF(LENGTH(q.core_rss_hash) > 0, q.core_rss_hash, NULL) AS token,
+ IF(LENGTH(smtppass) = 0, NULL, smtppass) AS weak_password,
date_ins AS registration_date,
IF(FIND_IN_SET('watch', flags), 'watch', '') AS flags,
IF(LENGTH(comment) > 0, comment, NULL) AS comment,
prenom AS display_name,
IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex,
IF(q.core_mail_fmt = 'html', 'html', 'text') AS email_format,
- q.skin AS skin
+ q.skin AS skin,
+ q.last_version AS last_version
from auth_user_md5 as u
left join auth_user_quick as q on (q.user_id = u.user_id)
where hruid is not null;
+# Insert carnet-relative data
+insert into watch
+ select user_id as uid, watch_flags as flags, watch_last as last
+ from auth_user_quick;
+
# Insert all existing profiles
insert into profiles
select user_id AS pid, hruid AS hrpid, matricule AS xorg_id,
News:
* authentication must use account + account_types with weakpass.
* forums base dropped and moved to forum_ namespace.
+
+
+Email:
+* auth_user_md5.smtppass -> accounts.weak_password. This password is NULL when empty, but a check must be added for empty passwords.