如何在登录时修复此代码 [英] How can I fix this code when login

查看:69
本文介绍了如何在登录时修复此代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="java"> public void onClick(View p1){
 EditText password =(EditText)findViewById(R.id.editText);
 String passwordIs="asd";
 if(password.getText().toString()==passwordIs){
 Toast.makeText(getBaseContext(),"true"+password.getText().toString(),Toast.LENGTH_SHORT).show();
 }
 else if(password.getText().toString()!=passwordIs){
 Toast.makeText(getBaseContext(),"false",Toast.LENGTH_SHORT).show();
 } 

推荐答案

你真的比较UI的密码和密码字符串吗?这意味着您将密码存储在目标系统上。这不是在安全系统中如何完成的。原始形式的密码不会存储在任何地方,因此无论访问级别如何,都无法学习密码;密码属于创建密码的人,不属于其他人。验证绝对不需要存储密码。惊讶,不同意?那么请看我过去的答案:

以安全的方式存储密码值int sql server [ ^ ],

解密加密密码 [ ^ ],

我已经加密了我的密码但是当我登录时它给了我一个错误。如何解密 [ ^ ] 。



-SA
Do you really compare password and password string from UI? It means you store the password on the target system. This is no how it''s done in secure systems. Passwords in their original forms are not stored anywhere, so no one can learn them, regardless the access level; a password belongs to the person who creates it, no one else. Storing passwords is absolutely not needed for authentication. Surprised, disagree? Then please see my past answers:
storing password value int sql server with secure way[^],
Decryption of Encrypted Password[^],
i already encrypt my password but when i log in it gives me an error. how can decrypte it[^].

—SA


我使用此代码解决了这个问题





I fixed this by using this code


 	public void c(View p1){
		EditText password =(EditText)findViewById(R.id.editText);
		String passwordIs="asd";
		if((password.getText().toString()).equals( passwordIs)){
			Toast.makeText(getBaseContext(),"true",Toast.LENGTH_SHORT).show();
		}
		else if((password.getText().toString())!=(passwordIs)){
			Toast.makeText(getBaseContext(),"false",Toast.LENGTH_SHORT).show();
		}
	}
} 


这篇关于如何在登录时修复此代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆