📄 userprofile.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: UserProfile.java
package org.gudy.azureus2.ui.console;
import com.aelitis.azureus.core.AzureusCoreException;
import org.gudy.azureus2.ui.console.util.StringEncrypter;
public class UserProfile
{
private String username;
private String userType;
private String encryptedPassword;
private String defaultSaveDirectory;
public static final String ADMIN = "admin";
public static final String USER = "user";
public static final String GUEST = "guest";
public static final String DEFAULT_USER_TYPE = "admin";
public static final UserProfile DEFAULT_USER_PROFILE = new UserProfile("admin", "admin");
public static boolean isValidUserType(String userType)
{
return "admin".equals(userType) || "user".equals(userType) || "guest".equals(userType);
}
public UserProfile()
{
userType = "admin";
}
public UserProfile(String name, String userType)
{
username = name;
setUserType(userType);
}
public boolean authenticate(String password)
{
StringEncrypter encrypter = new StringEncrypter("DES");
return encrypter.decrypt(encryptedPassword).equals(password);
org.gudy.azureus2.ui.console.util.StringEncrypter.EncryptionException e;
e;
throw new AzureusCoreException("Unable to decrypt password", e);
}
public void setPassword(String password)
{
try
{
StringEncrypter encrypter = new StringEncrypter("DES");
setEncryptedPassword(encrypter.encrypt(password));
}
catch (org.gudy.azureus2.ui.console.util.StringEncrypter.EncryptionException e)
{
throw new AzureusCoreException("Unable to encrypt password", e);
}
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUserType()
{
return userType;
}
public void setUserType(String userType)
{
if (userType.equalsIgnoreCase("admin"))
userType = "admin";
else
if (userType.equalsIgnoreCase("user"))
userType = "user";
else
if (userType.equalsIgnoreCase("guest"))
userType = "guest";
else
userType = "admin";
this.userType = userType;
}
public boolean equals(Object obj)
{
if (obj == null || !(obj instanceof UserProfile))
return false;
UserProfile other = (UserProfile)obj;
if (getUsername() != null)
return getUsername().equals(other.getUsername());
if (other.getUsername() != null)
return false;
if (getEncryptedPassword() != null)
return getEncryptedPassword().equals(other.getEncryptedPassword());
return other.getEncryptedPassword() == null;
}
public String getEncryptedPassword()
{
return encryptedPassword;
}
public void setEncryptedPassword(String encryptedPassword)
{
this.encryptedPassword = encryptedPassword;
}
public String getDefaultSaveDirectory()
{
return defaultSaveDirectory;
}
public void setDefaultSaveDirectory(String newValue)
{
defaultSaveDirectory = newValue;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -