login form: use dojo, remove profile hacks
This commit is contained in:
parent
a1407b35e4
commit
29c890b495
|
@ -262,23 +262,24 @@ class Handler_Public extends Handler {
|
||||||
|
|
||||||
function getProfiles() {
|
function getProfiles() {
|
||||||
$login = clean($_REQUEST["login"]);
|
$login = clean($_REQUEST["login"]);
|
||||||
|
$rv = [];
|
||||||
|
|
||||||
$sth = $this->pdo->prepare("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users
|
if ($login) {
|
||||||
|
$sth = $this->pdo->prepare("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users
|
||||||
WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = ? ORDER BY title");
|
WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = ? ORDER BY title");
|
||||||
$sth->execute([$login]);
|
$sth->execute([$login]);
|
||||||
|
|
||||||
print "<select dojoType='dijit.form.Select' style='width : 220px; margin : 0px' name='profile'>";
|
$rv = [ [ "value" => 0, "label" => __("Default profile") ] ];
|
||||||
|
|
||||||
print "<option value='0'>" . __("Default profile") . "</option>";
|
while ($line = $sth->fetch()) {
|
||||||
|
$id = $line["id"];
|
||||||
|
$title = $line["title"];
|
||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
array_push($rv, [ "label" => $title, "value" => $id ]);
|
||||||
$id = $line["id"];
|
}
|
||||||
$title = $line["title"];
|
}
|
||||||
|
|
||||||
print "<option value='$id'>$title</option>";
|
print json_encode($rv);
|
||||||
}
|
|
||||||
|
|
||||||
print "</select>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Tiny Tiny RSS : Login</title>
|
<title>Tiny Tiny RSS : Login</title>
|
||||||
<?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css") ?>
|
|
||||||
<?php echo stylesheet_tag("css/default.css") ?>
|
<?php echo stylesheet_tag("css/default.css") ?>
|
||||||
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
|
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
@ -22,36 +21,32 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="claro ttrss_main ttrss_login">
|
<body class="flat ttrss_main ttrss_login">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
|
require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox', 'dijit/form/Form',
|
||||||
'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
|
'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
|
||||||
ready(function() {
|
ready(function() {
|
||||||
parser.parse();
|
parser.parse();
|
||||||
|
|
||||||
//show tooltip node only after this widget is instaniated.
|
|
||||||
dojo.query('div[dojoType="dijit.Tooltip"]').style({
|
|
||||||
display:''
|
|
||||||
});
|
|
||||||
|
|
||||||
fetchProfiles();
|
|
||||||
dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
|
dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
|
||||||
document.forms.loginForm.login.focus();
|
dijit.byId("login").focus();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function fetchProfiles() {
|
function fetchProfiles() {
|
||||||
const query = "op=getProfiles&login=" + encodeURIComponent(document.forms["loginForm"].login.value);
|
xhrJson("public.php", { op: "getprofiles", login: dijit.byId("login").attr('value') },
|
||||||
|
(reply) => {
|
||||||
|
const profile = dijit.byId('profile');
|
||||||
|
|
||||||
new Ajax.Request("public.php", {
|
profile.removeOption(profile.getOptions());
|
||||||
parameters: query,
|
|
||||||
onComplete: function(transport) {
|
reply.each((p) => {
|
||||||
if (transport.responseText.match("select")) {
|
profile
|
||||||
$('profile_box').innerHTML = transport.responseText;
|
.attr("disabled", false)
|
||||||
//dojo.parser.parse('profile_box');
|
.addOption(p);
|
||||||
}
|
});
|
||||||
} });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotoRegForm() {
|
function gotoRegForm() {
|
||||||
|
@ -87,7 +82,7 @@ function bwLimitChange(elem) {
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label><?php echo __("Login:") ?></label>
|
<label><?php echo __("Login:") ?></label>
|
||||||
<input name="login" class="input input-text" type="text"
|
<input name="login" id="login" dojoType="dijit.form.TextBox" type="text"
|
||||||
onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
|
onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
|
||||||
style="width : 220px"
|
style="width : 220px"
|
||||||
required="1"
|
required="1"
|
||||||
|
@ -98,6 +93,7 @@ function bwLimitChange(elem) {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label><?php echo __("Password:") ?></label>
|
<label><?php echo __("Password:") ?></label>
|
||||||
<input type="password" name="password" required="1"
|
<input type="password" name="password" required="1"
|
||||||
|
dojoType="dijit.form.TextBox"
|
||||||
style="width : 220px" class="input input-text"
|
style="width : 220px" class="input input-text"
|
||||||
value="<?php echo $_SESSION["fake_password"] ?>"/>
|
value="<?php echo $_SESSION["fake_password"] ?>"/>
|
||||||
<label></label>
|
<label></label>
|
||||||
|
@ -110,9 +106,9 @@ function bwLimitChange(elem) {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label><?php echo __("Profile:") ?></label>
|
<label><?php echo __("Profile:") ?></label>
|
||||||
|
|
||||||
<span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
|
<select disabled='disabled' name="profile" id="profile" dojoType='dijit.form.Select'
|
||||||
style='width : 220px; margin : 0px'>
|
style='width : 220px; margin : 0px'>
|
||||||
<option><?php echo __("Default profile") ?></option></select></span>
|
<option><?php echo __("Default profile") ?></option></select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue