我目前正在开发一个在列表视图中显示用户的应用,当您点击用户时,您可以看到详细信息。
现在你可以添加'用户通过使用他或她的信息填写editText字段。现在我希望只有这个人自己可以添加他或她的信息。我添加了editText
询问您的电子邮件,并editText
要求输入密码。这些凭据应与先前在Firebase中的应用中创建的帐户相匹配。我似乎没有完成它。
这是我的代码:
String email2 = mEmailField.getText().toString();
String pw = mPassword.getText().toString();
firebaseAuth.signInWithEmailAndPassword(email2, pw).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
当用户填写他的电子邮件和密码时,一切正常,但是当输入错误的密码时,它也会起作用,这不应该发生。我做错了什么?
答案 0 :(得分:2)
在OnComplete内部检查身份验证是否成功。
<?php
$dtpickerdate = isset($_GET['dtpickerdate']) ? $_GET['dtpickerdate'] : "2016-06-06";
$con = pg_connect("dbname=patient user=spo password=secretpass") or die("db connection failed!");
$d1 = (string)strtotime($dtpickerdate.' 12:00:00');
$nday = (int)substr($dtpickerdate, -2) + 1;
$ndat = substr($dtpickerdate, 0, 8).(string)$nday;
$d2 = (string)strtotime($ndat.' 12:00:00');
$sth = pg_query($con, "select * from stats where utc between ".$d1." and ".$d2);
$table['cols'] = array(
array(id => 'utc', label => 'Time', type => 'datetime'),
array(id => 'spo', label => 'spO2', type => 'number'),
array(id => 'hr', label => 'PulseRate', type => 'number')
);
while($r = pg_fetch_assoc($sth)) {
$temp = array();
$mon = (int)date("m", $r['utc']) - 1;
$mdat = "Date(".date("Y, ", $r['utc']).(string)$mon.date(", d, H, i, s)", $r['utc']);
$temp[] = array(v => (string) $mdat);
$temp[] = array(v => (int) $r['spo']);
$temp[] = array(v => (int) $r['hr']);
$rows[] = array(c => $temp);
}
$table['rows'] = $rows;
$json = json_encode($table);
//echo $json;
?>
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable(<?=$json?>);
var options = {
chartArea: {'width': '92%', 'height': '86%'},
title: 'spO2/hr monitor',
legend: { position: 'bottom' },
vAxis: {viewWindow:{max:100, min:50}, gridlines:{count:6}, minorGridlines:{count:4}},
hAxis: {
gridlines: {
count: -1,
units: {
days: {format: ['MMM dd']},
hours: {format: ['HH:mm', 'ha']},
}
},
minorGridlines: {
units: {
hours: {format: ['hh:mm:ss a', 'ha']},
minutes: {format: ['HH:mm a Z', ':mm']}
}
}
}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 100%; height: 100%"></div>
</body>
</html>
答案 1 :(得分:0)
mAuth.signInWithEmailAndPassword(et_LogIn_Email.getText().toString(),et_LogIn_Pasword.getText().toString())
.addOnCompleteListener((EntryActivity) requireActivity(), new OnCompleteListener<AuthResult>() {
@SuppressLint("SetTextI18n")
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Toast.makeText((EntryActivity) requireActivity(), "LogIn...", Toast.LENGTH_SHORT).show();
loadingDialog.stopLoading();
gotoUiPage();
} else {
Toast.makeText((EntryActivity) requireActivity(), "Error! try again...", Toast.LENGTH_SHORT).show();
tv_LogIn_warning.setText("Enter Carefully!...");
loadingDialog.stopLoading();
}
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
tv_LogIn_warning.setText(e.getMessage());
}
});
onFailureListener提供一个处理异常的方法。