Changeset 5827
- Timestamp:
- Oct 26, 2011, 12:51:52 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/3rd-party-components.txt
r5676 r5827 194 194 Jar files : mail-1.4.3.jar 195 195 196 197 jBCrypt 198 ------- 199 Package for safe encryption of passwords using the 'bcrypt' algorithm. 200 201 More info : http://www.mindrot.org/projects/jBCrypt/ 202 Version : 0.3 203 License : ISC/BSD licence (jbcrypt-license.txt) 204 Jar files : None. Distributed as source only. All code is in net/sf/basedb/util/bcrypt/BCrypt.java 196 205 197 206 JSON.simple -
trunk/doc/src/docbook/developer/migrate_2_3.xml
r5802 r5827 239 239 </para> 240 240 </listitem> 241 242 <listitem> 243 <para> 244 Encrypting passwords before logging in is no longer supported. The 245 <methodname>SessionControl.login()</methodname> has been changed to 246 reflect this. While this may seem like a reduction in security it is not. 247 The previously used scheme with MD5 hashes can be cracked by brute-force on 248 a moderate computer today. If additional security is needed we recommend that 249 BASE is installed with HTTPS access only. See <ulink 250 url="http://base.thep.lu.se/ticket/1641">ticket #1641 (Use bcrypt for storing 251 passwords instead of MD5)</ulink> for more information. 252 </para> 253 </listitem> 254 241 255 </itemizedlist> 242 256 -
trunk/doc/src/docbook/developer/plugins.xml
r5822 r5827 3591 3591 </itemizedlist> 3592 3592 3593 <note>3594 <para>3595 The <guilabel>Encrypt password</guilabel> option that is3596 available on the login page does not work with external3597 authentication. The simple reason is that the password is3598 encrypted with a one-way algorithm making it impossible to3599 call <methodname>Authenticator.authenticate()</methodname>.3600 </para>3601 </note>3602 3603 3593 </para> 3604 3594 </sect3> -
trunk/doc/src/docbook/developer/webservices.xml
r5818 r5827 211 211 212 212 // Login 213 session.login(login, password, null , false);213 session.login(login, password, null); 214 214 215 215 // Get all projects and print out name and ID -
trunk/doc/src/docbook/user/webclient.xml
r5817 r5827 64 64 Logging in is simple, just enter your <guilabel>login</guilabel> 65 65 and <guilabel>password</guilabel> in the form on the front page 66 and click the <guibutton>Login</guibutton> button. There is 67 a checkbox which allows you to <guilabel>encrypt the password</guilabel> 68 before it is sent to the BASE server. It is checked by default, and 69 it is a good idea to leave it checked unless you have problems logging 70 in. If you are sure you are entering the correct login and password, 71 but still cannot log in, try unchecking the encryption option. 72 If the checkbox is not visible, which happens if the server is 73 using an external authentication server, the password is not encrypted. 66 and click the <guibutton>Login</guibutton> button. 74 67 </para> 75 68 </sect2> -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/Agent.java
r5689 r5827 889 889 { 890 890 log.info("Logging in as user: " + login); 891 sc.login(login, password, "Job agent running on host " + getServerName() , false);891 sc.login(login, password, "Job agent running on host " + getServerName()); 892 892 } 893 893 return sc; -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java
r4512 r5827 174 174 sc = Application.newSessionControl("net.sf.basedb.clients.jobagent", 175 175 SocketUtil.getLocalHost().toString(), null); 176 sc.login(login, password, loginComment , false);176 sc.login(login, password, loginComment); 177 177 dc = sc.newDbControl(); 178 178 Job job = Job.getById(dc, jobId); -
trunk/src/core/net/sf/basedb/core/Install.java
r5788 r5827 68 68 69 69 import net.sf.basedb.util.FileUtil; 70 import net.sf.basedb.util.MD5;71 70 import net.sf.basedb.util.Values; 72 71 import net.sf.basedb.util.XMLUtil; … … 211 210 "This is the root user account of BASE. It has full permission to everything.", 212 211 roleAdmin, quotaUnlimit, false, false); 213 UserData jobAgentUser = createUser(null, "jobagent", "", "Job agent",212 UserData jobAgentUser = createUser(null, "jobagent", null, "Job agent", 214 213 "This user account is used by the job agents to login and execute jobs. You must "+ 215 214 "activate it and set a password before it can be used.", … … 218 217 // Now that we have a root user let's create a session 219 218 sessionControl = Application.newSessionControl( null, null, null ); 220 sessionControl.login(rootLogin, rootPassword, "InitDBSessionId" , false);219 sessionControl.login(rootLogin, rootPassword, "InitDBSessionId"); 221 220 222 221 progressStep++; … … 1230 1229 if (systemId != null) user.setSystemId(systemId); 1231 1230 user.setLogin(login); 1232 user.getPassword().setMd5Password(MD5.getHashString(password)); 1231 if (password != null) 1232 { 1233 user.getPassword().setCryptedPassword(User.encryptPassword(password)); 1234 } 1233 1235 user.setName(name); 1234 1236 user.setDescription(description); -
trunk/src/core/net/sf/basedb/core/PluginSessionControl.java
r5319 r5827 64 64 */ 65 65 @Override 66 public synchronized void login(String login, String password, String comment , boolean encryptedPassword)66 public synchronized void login(String login, String password, String comment) 67 67 throws ItemNotFoundException, PermissionDeniedException, InvalidPasswordException, BaseException 68 68 { -
trunk/src/core/net/sf/basedb/core/SessionControl.java
r5822 r5827 27 27 import net.sf.basedb.core.data.PermissionTemplateData; 28 28 import net.sf.basedb.core.data.UserData; 29 import net.sf.basedb.core.data.PasswordData;30 29 import net.sf.basedb.core.data.SessionData; 31 30 import net.sf.basedb.core.data.ClientData; … … 42 41 import net.sf.basedb.core.data.ContextData; 43 42 import net.sf.basedb.core.data.ContextIndex; 44 import net.sf.basedb.util.MD5;45 43 import net.sf.basedb.util.Enumeration; 46 44 … … 126 124 */ 127 125 private LoginInfo loginInfo; 128 129 /**130 The last generated challenge for password encryption.131 */132 private String lastChallenge;133 126 134 127 /** … … 335 328 336 329 /** 337 Generate a new random string to be used for password encryption338 in the login method. Using encryption prevents that user passwords339 are sent in clear text between client and server (ie. web browser and340 web server).341 <p>342 The client application should use the challenge as follows:343 <ol>344 <li>Calculate the MD5 of the real UTF-8 encoded password345 <li>Concatenate this with the challenge with a colon inbetween:346 <code>MD5:challenge</code>347 <li>Calculate the MD5 of the concatenated string. This is the348 encrypted password, which should be sent to the login method.349 </ol>350 <p>351 Note! This is not intended as a replacement for SSL encrypted352 communication.353 <p>354 Note! Each call to this method generates a new random challenge.355 356 @return A challenge string used to encrypt the password357 @see #login(String, String, String, boolean)358 */359 public String getChallenge()360 {361 lastChallenge = Application.generateRandomId(16);362 return lastChallenge;363 }364 365 /**366 Get the last challenge generated.367 */368 private String getLastChallenge()369 {370 return lastChallenge;371 }372 373 /**374 330 Log in to BASE. The method checks that the given login is valid, 375 331 the password is correct and that the user has USE permission for … … 394 350 @see #isLoggedIn() 395 351 @see #getLoggedInUserId() 396 */ 397 public synchronized void login(String login, String password, String comment, boolean encryptedPassword) 352 @since 3.0 (the option to use encrypted passwords has been removed) 353 */ 354 public synchronized void login(String login, String password, String comment) 398 355 throws ItemNotFoundException, PermissionDeniedException, 399 356 InvalidPasswordException, BaseException … … 421 378 if (Application.isUsingInternalAuthentication() || login.equals(root.getLogin())) 422 379 { 423 userData = verifyUserInternal(session, login, password , encryptedPassword);380 userData = verifyUserInternal(session, login, password); 424 381 } 425 382 else 426 383 { 427 if (encryptedPassword)428 {429 throw new BaseException("Encrypted passwords are not supported when using external authentication");430 }431 384 userData = verifyUserExternal(session, login, password); 432 385 } … … 451 404 internal authentication. 452 405 */ 453 private UserData verifyUserInternal(org.hibernate.Session session, String login, String password , boolean encryptedPassword)406 private UserData verifyUserInternal(org.hibernate.Session session, String login, String password) 454 407 throws ItemNotFoundException, InvalidPasswordException, AccountExpiredException, BaseException 455 408 { … … 479 432 throw new AccountExpiredException(login, expirationDate); 480 433 } 481 PasswordData passwordData = userData.getPassword(); 482 String md5Password = passwordData.getMd5Password(); 483 if (encryptedPassword) 484 { 485 md5Password = MD5.getHashString(md5Password + ":" + getLastChallenge()); 486 } 487 else 488 { 489 password = MD5.getHashString(password); 490 } 491 if (!md5Password.equals(password)) 434 435 // Check the password 436 String cryptedPassword = userData.getPassword().getCryptedPassword(); 437 if (cryptedPassword == null || !User.checkPassword(password, cryptedPassword)) 492 438 { 493 439 throw new InvalidPasswordException("User[login="+login+"]"); … … 525 471 if (Config.getBoolean("auth.cachepasswords")) 526 472 { 527 return verifyUserInternal(session, login, password , false);473 return verifyUserInternal(session, login, password); 528 474 } 529 475 throw new BaseException(ex); … … 544 490 userData.setLogin(info.login); 545 491 userData.setName(info.name == null ? info.login : info.name); 546 userData.getPassword().setMd5Password("");547 492 userData.setQuota(HibernateUtil.loadData(session, QuotaData.class, SystemItems.getId(Quota.DEFAULT))); 548 493 User.addDefultRolesAndGroups(session, userData); … … 550 495 if (Config.getBoolean("auth.cachepasswords")) 551 496 { 552 userData.getPassword().set Md5Password(MD5.getHashString(password));497 userData.getPassword().setCryptedPassword(User.encryptPassword(password)); 553 498 int daysToCache = Config.getInt("auth.daystocache", 0); 554 499 userData.setExpirationDate(daysToCache > 0 ? new Date(System.currentTimeMillis()+daysToCache*24L*3600L*1000L) : null); -
trunk/src/core/net/sf/basedb/core/Update.java
r5803 r5827 131 131 // Test root user account 132 132 SessionControl sc = Application.newSessionControl(null, null, null); 133 sc.login(rootLogin, rootPassword, null , false);133 sc.login(rootLogin, rootPassword, null); 134 134 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 135 135 { … … 251 251 // Test root user account 252 252 SessionControl sc = Application.newSessionControl(null, null, null); 253 sc.login(rootLogin, rootPassword, null , false);253 sc.login(rootLogin, rootPassword, null); 254 254 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 255 255 { … … 385 385 // Test root user account 386 386 SessionControl sc = Application.newSessionControl(null, null, null); 387 sc.login(rootLogin, rootPassword, null , false);387 sc.login(rootLogin, rootPassword, null); 388 388 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 389 389 { -
trunk/src/core/net/sf/basedb/core/User.java
r5590 r5827 34 34 import net.sf.basedb.core.hibernate.TypeWrapper; 35 35 import net.sf.basedb.util.MD5; 36 import net.sf.basedb.util.bcrypt.BCrypt; 36 37 import net.sf.basedb.core.query.Restriction; 37 38 import net.sf.basedb.core.query.Restrictions; … … 48 49 import java.util.Set; 49 50 import java.util.Collections; 51 50 52 51 53 /** … … 252 254 } 253 255 256 /** 257 Encrypt the plain-text password. The password is ecnrypted 258 by first calculating the MD5 of the password and then 259 using bcrypt with a random salt on the MD5. 260 261 @param password The plain-text password 262 */ 263 static String encryptPassword(String password) 264 { 265 String md5 = MD5.getHashString(password); 266 return BCrypt.hashpw(md5, BCrypt.gensalt()); 267 } 268 269 /** 270 Check the plain-text password against the crypted password. 271 @param password The plain-text password 272 @param cryptedPassword The crypted password 273 @return 274 */ 275 static boolean checkPassword(String password, String cryptedPassword) 276 { 277 String md5 = MD5.getHashString(password); 278 return BCrypt.checkpw(md5, cryptedPassword); 279 } 280 254 281 User(UserData userData) 255 282 { … … 434 461 checkPermission(Permission.RESTRICTED_WRITE); 435 462 if (password == null) throw new InvalidUseOfNullException("password"); 436 getData().getPassword().setMd5Password(MD5.getHashString(password)); 437 } 438 439 /** 440 Set the encrypted password from BASE 1. This method is only intended 441 to be used from the migration application, and will throw a 442 {@link PermissionDeniedException} unless the logged in user is the root and 443 the user account is a newly created account. 444 @param md5Password The MD5 password from a BASE 1 installation 445 @throws PermissionDeniedException If it is not a new user or 446 root isn't logged in 447 @throws BaseException If there is some other kind of error. 448 */ 449 public void setBase1Password(String md5Password) 450 throws PermissionDeniedException, BaseException 451 { 452 if (isInDatabase() || (SystemItems.getId(User.ROOT) != getSessionControl().getLoggedInUserId())) 453 { 454 throw new PermissionDeniedException(Permission.WRITE, "Password[login="+getLogin()+"]"); 455 } 456 getData().getPassword().setMd5Password(md5Password); 463 getData().getPassword().setCryptedPassword(encryptPassword(password)); 457 464 } 458 465 -
trunk/src/core/net/sf/basedb/core/data/PasswordData.java
r5818 r5827 22 22 package net.sf.basedb.core.data; 23 23 24 import net.sf.basedb.core.User; 25 24 26 /** 25 27 This class holds the password for a user. It has a one-to-one … … 40 42 {} 41 43 42 private String md5Password;44 private String cryptedPassword; 43 45 /** 44 Get the MD5 encrypted password. It is always returned as a string45 with 32 hexadecimal characters.46 @ hibernate.property column="`md5password`" type="string" length="32" not-null="true"46 Get the crypted password. 47 @hibernate.property column="`crypted_password`" type="string" length="255" not-null="false" 48 @since 3.0 47 49 */ 48 public String get Md5Password()50 public String getCryptedPassword() 49 51 { 50 return md5Password;52 return cryptedPassword; 51 53 } 52 public void setMd5Password(String md5Password) 54 /** 55 Set the encrypted password. The password should be encrypted with 56 {@link User#encryptPassword(String)}. 57 @since 3.0 58 */ 59 public void setCryptedPassword(String cryptedPassword) 53 60 { 54 this. md5Password = md5Password;61 this.cryptedPassword = cryptedPassword; 55 62 } 63 56 64 57 65 private UserData user; -
trunk/src/install/net/sf/basedb/install/Webclient.java
r5661 r5827 93 93 Application.start(false); 94 94 SessionControl sc = Application.newSessionControl(null, null, null); 95 sc.login(login, password, "Installing web client" , false);95 sc.login(login, password, "Installing web client"); 96 96 97 97 DbControl dc = sc.newDbControl(); -
trunk/src/test/TestClient.java
r5340 r5827 204 204 Client c = Client.getById(dc, id); 205 205 SessionControl sc = Application.newSessionControl(c.getExternalId(), null, null); 206 sc.login(TestUtil.getLogin(), TestUtil.getPassword(), "Running test program" , false);206 sc.login(TestUtil.getLogin(), TestUtil.getPassword(), "Running test program"); 207 207 sc.logout(); 208 208 write("--Login/logout OK"); -
trunk/src/test/TestSessionControl.java
r4889 r5827 40 40 test_get_session_control(TestUtil.getLocalIp(), false); 41 41 test_get_session_control("unknown.ip.address", true); 42 test_login_encrypted_password();43 42 test_user_default_setting("test.default", "This is the users default setting"); 44 43 test_user_client_setting("test.client", "This is the users client setting"); … … 78 77 ok = false; 79 78 } 80 }81 }82 83 static void test_login_encrypted_password()84 {85 try86 {87 TestUtil.logout();88 TestUtil.loginEncrypted();89 write("--Login with encrypted password OK");90 }91 catch (Throwable ex)92 {93 write("--Login with encrypted password FAILED");94 ex.printStackTrace();95 ok = false;96 79 } 97 80 } -
trunk/src/test/TestUser.java
r5690 r5827 47 47 int id2 = test_create(true); 48 48 int id = test_create(false); 49 int base1Id = test_create_base1_user();50 49 test_load(id); 51 50 test_list(-1); … … 91 90 // Standard test: Delete 92 91 TestTag.test_delete(tag_id); 93 test_delete(base1Id);94 92 test_delete(id); 95 93 test_delete(id2); … … 140 138 } 141 139 142 static int test_create_base1_user()143 {144 if (TestUtil.getSessionControl().getLoggedInUserId() != SystemItems.getId(User.ROOT)) return 0;145 int id = 0;146 DbControl dc = null;147 try148 {149 dc = TestUtil.getDbControl();150 String login = "base1user"+Application.generateRandomId(4);151 User u = User.getNew(dc, login, "password");152 u.setName("Base 1 user");153 u.setDescription("Added at "+new Date());154 dc.saveItem(u);155 u.setBase1Password("63a9f0ea7bb98050796b649e85481845");156 dc.commit();157 id = u.getId();158 write_item(0, u);159 write("--Create BASE 1 user OK");160 }161 catch (Throwable ex)162 {163 write("--Create BASE 1 user FAILED");164 ex.printStackTrace();165 ok = false;166 }167 finally168 {169 if (dc != null) dc.close();170 }171 return id;172 }173 174 140 static void test_load(int id) 175 141 { -
trunk/src/test/TestUtil.java
r5689 r5827 28 28 import net.sf.basedb.core.Permission; 29 29 import net.sf.basedb.core.Version; 30 import net.sf.basedb.util.MD5;31 30 32 31 import java.io.File; … … 183 182 throws BaseException 184 183 { 185 login(login, password, false); 186 } 187 188 public static void loginEncrypted() 189 { 190 String encrypted = MD5.getHashString(MD5.getHashString(password) + ":" + sc.getChallenge()); 191 login(login, encrypted, true); 192 } 193 194 public static void login(String login, String password, boolean encrypted) 195 throws BaseException 196 { 197 sc.login(login, password, "Running test program", encrypted); 184 login(login, password); 185 } 186 187 public static void login(String login, String password) 188 throws BaseException 189 { 190 sc.login(login, password, "Running test program"); 198 191 } 199 192 -
trunk/src/test/TestWebservices.java
r5748 r5827 530 530 write("--Using url: " + url); 531 531 client = new SessionClient(url, null, TestUtil.getClient()); 532 client.login(TestUtil.getLogin(), TestUtil.getPassword(), "Test webservices" , false);532 client.login(TestUtil.getLogin(), TestUtil.getPassword(), "Test webservices"); 533 533 write("--Create/login session OK: ID=" + client.getId()); 534 534 } -
trunk/src/test/net/sf/basedb/test/TestUtil.java
r5146 r5827 162 162 Login to BASE. 163 163 */ 164 public static void login(String login, String password , boolean encrypted)164 public static void login(String login, String password) 165 165 { 166 166 write("--Logging in as: " + login + "\n"); 167 getSessionControl().login(login, password, "Running test program" , encrypted);167 getSessionControl().login(login, password, "Running test program"); 168 168 } 169 169 -
trunk/src/test/net/sf/basedb/test/merge/MergeTest.java
r5060 r5827 95 95 try 96 96 { 97 TestUtil.login("root", "root" , false);97 TestUtil.login("root", "root"); 98 98 99 99 // Reporters -
trunk/src/test/net/sf/basedb/test/performance/ExportTest.java
r4806 r5827 65 65 try 66 66 { 67 TestUtil.login(user, password , false);67 TestUtil.login(user, password); 68 68 69 69 // Configuration options -
trunk/src/test/net/sf/basedb/test/performance/FilterTest.java
r4806 r5827 63 63 try 64 64 { 65 TestUtil.login(user, password , false);65 TestUtil.login(user, password); 66 66 67 67 // Configuration options -
trunk/src/test/net/sf/basedb/test/performance/LowessTest.java
r4806 r5827 66 66 try 67 67 { 68 TestUtil.login(user, password , false);68 TestUtil.login(user, password); 69 69 70 70 // Configuration options -
trunk/src/test/net/sf/basedb/test/performance/PrepareTest.java
r5630 r5827 82 82 try 83 83 { 84 TestUtil.login(user, password , false);84 TestUtil.login(user, password); 85 85 dc = TestUtil.getDbControl(); 86 86 … … 181 181 try 182 182 { 183 TestUtil.login(user, password , false);183 TestUtil.login(user, password); 184 184 185 185 List<BasicItem> itemsToRemove = new ArrayList<BasicItem>(); -
trunk/src/test/net/sf/basedb/test/performance/RawDataTest.java
r5060 r5827 64 64 try 65 65 { 66 TestUtil.login(user, password , false);66 TestUtil.login(user, password); 67 67 68 68 // Create raw bioassays -
trunk/src/test/net/sf/basedb/test/performance/RootTest.java
r4806 r5827 67 67 try 68 68 { 69 TestUtil.login(user, password , false);69 TestUtil.login(user, password); 70 70 71 71 dc = TestUtil.getDbControl(); -
trunk/src/test/net/sf/basedb/test/roles/AdminTest.java
r5788 r5827 86 86 try 87 87 { 88 TestUtil.login("admin", "admin" , false);88 TestUtil.login("admin", "admin"); 89 89 dc = TestUtil.getDbControl(); 90 90 Group g = createGroup(dc); -
trunk/src/test/net/sf/basedb/test/roles/GuestTest.java
r4514 r5827 49 49 try 50 50 { 51 TestUtil.login("guest", "guest" , false);51 TestUtil.login("guest", "guest"); 52 52 // Activate project 53 53 dc = TestUtil.getDbControl(); -
trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java
r5813 r5827 105 105 try 106 106 { 107 TestUtil.login("power", "power" , false);107 TestUtil.login("power", "power"); 108 108 109 109 // Project -
trunk/src/test/net/sf/basedb/test/roles/RootTest.java
r5778 r5827 56 56 try 57 57 { 58 TestUtil.login("root", "root" , false);58 TestUtil.login("root", "root"); 59 59 dc = TestUtil.getDbControl(); 60 60 User admin = createAdmin(dc); -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5788 r5827 97 97 try 98 98 { 99 TestUtil.login("user", "user" , false);99 TestUtil.login("user", "user"); 100 100 PluginDefinition bioSourceBatchImporter = null; 101 101 PluginDefinition sampleBatchImporter = null; -
trunk/src/webservices/client/java/net/sf/basedb/ws/client/SessionClient.java
r4513 r5827 90 90 91 91 /** 92 Calling the getChallenge method.93 @return Gets a random string to use with password encryption.94 @throws AxisFault If communication with web service fails.95 */96 public String getChallenge()97 throws AxisFault98 {99 return invokeBlocking("getChallenge", String.class, ID);100 }101 102 /**103 92 Login to BASE 104 93 @param login Login name on BASE server 105 94 @param password Password on BASE server 106 95 @param comment A comment to put on the session 107 @param encrypted If the password should be encrypted when logging in.108 96 @throws AxisFault If something goes wrong when calling the login service 97 @since 3.0 109 98 */ 110 public void login(String login, String password, String comment , boolean encrypted)99 public void login(String login, String password, String comment) 111 100 throws AxisFault 112 101 { 113 invokeBlocking("login", ID, login, password, comment , encrypted);102 invokeBlocking("login", ID, login, password, comment); 114 103 } 115 104 -
trunk/src/webservices/server/net/sf/basedb/ws/server/SessionService.java
r4513 r5827 54 54 55 55 /** 56 Service for net.sf.basedb.core.SessionControl#getChallenge()57 @param ID58 @return String A radom string59 */60 public String getChallenge(String ID)61 {62 SessionControl sc = getSessionControl(ID);63 return sc.getChallenge();64 }65 66 /**67 56 Service to login to BASE 68 57 @param ID Id of a session control … … 70 59 @param password Password for the login above. 71 60 @param comment Comment to be used with the new session 72 @param encrypted If encrypted password should be used or not.73 61 @return The Session ID 62 @since 3.0 74 63 */ 75 public String login(String ID, String login, String password, String comment , boolean encrypted)64 public String login(String ID, String login, String password, String comment) 76 65 { 77 66 SessionControl sc = getSessionControl(ID); 78 sc.login(login, password, comment , encrypted);67 sc.login(login, password, comment); 79 68 return ID; 80 69 } -
trunk/www/exception/not_logged_in.jsp
r5812 r5827 52 52 %> 53 53 <base:page type="default" menu="exception" title="Not logged in"> 54 <base:head scripts=" md5.js,exception.js" styles="login.css">54 <base:head scripts="exception.js" styles="login.css"> 55 55 <script language="JavaScript"> 56 56 // hide menubar and resize if it is a popup window … … 69 69 frm.login.value = topWindow.lastLogin; 70 70 Main.show('timeout'); 71 }72 if (frm.encrypt && topWindow.encrypt != undefined)73 {74 frm.encrypt.checked = topWindow.encrypt;75 71 } 76 72 if (frm.login.value == '') … … 109 105 { 110 106 var frm = document.forms['login']; 111 if (frm.encrypt && frm.encrypt.checked)112 {113 var password = frm.password.value;114 var md5password = hex_md5(password);115 md5password = hex_md5(md5password + ':<%=sc.getChallenge()%>');116 frm.encrypted_password.value = md5password;117 frm.password.value = '';118 }119 107 Main.openPopup('', 'Login', 300, 200); 120 108 frm.submit(); … … 127 115 <input type="hidden" name="ID" value="<%=ID%>"> 128 116 <input type="hidden" name="redirect" value="<%=redirect%>"> 129 <input type="hidden" name="encrypted_password" value="">130 117 131 118 <table class="loginform" width="100%" border="0" align="center"> … … 159 146 <td><base:button onclick="mainPage();" title="Cancel" /></td> 160 147 </tr> 161 <%162 if (Application.isUsingInternalAuthentication())163 {164 %>165 <tr>166 <td class="prompt"><label for="encryptPassword">Encrypt password</label></td>167 <td>168 <input type="checkbox" name="encrypt" id="encryptPassword" checked value="1"><br>169 </td>170 </tr>171 <%172 }173 %>174 148 <tr> 175 149 <td colspan="4"> -
trunk/www/login.jsp
r5822 r5827 55 55 if ("Login".equals(cmd) || cmd == null) 56 56 { 57 boolean encrypted = Values.getBoolean(request.getParameter("encrypt")); 58 String password = encrypted ? request.getParameter("encrypted_password") : request.getParameter("password"); 57 String password = request.getParameter("password"); 59 58 try 60 59 { 61 60 if (sc.isLoggedIn()) sc.logout(); 62 sc.login(login, password, null , encrypted);61 sc.login(login, password, null); 63 62 } 64 63 catch (LoginException ex) -
trunk/www/main.jsp
r5812 r5827 66 66 %> 67 67 <base:page type="default" title=""> 68 <base:head s cripts="md5.js" styles="login.css">68 <base:head styles="login.css"> 69 69 <script language="JavaScript" type="text/javascript"> 70 70 // Set foucs on the login form … … 80 80 frm = document.forms['login']; 81 81 if (frm.login.value == '' && window.parent.lastLogin) frm.login.value = window.parent.lastLogin; 82 if (frm.encrypt && window.parent.encrypt != undefined) frm.encrypt.checked = window.parent.encrypt;83 82 if (frm.login.value == '') 84 83 { … … 95 94 var frm = document.forms['login']; 96 95 window.parent.lastLogin = frm.login.value; 97 98 if (frm.encrypt)99 {100 window.parent.encrypt = frm.encrypt.checked;101 if (frm.encrypt.checked)102 {103 var password = frm.password.value;104 var md5password = hex_md5(password);105 md5password = hex_md5(md5password + ':<%=sc.getChallenge()%>');106 frm.encrypted_password.value = md5password;107 frm.password.value = '';108 }109 }110 96 return true; 111 97 } … … 154 140 <input type="hidden" name="ID" value="<%=ID%>"> 155 141 <input type="hidden" name="nextpage" value="<%=root%>my_base/user/index.jsp"> 156 <input type="hidden" name="encrypted_password" value="">157 142 158 143 <div id="loginForm" <%=denyLogin ? "style=\"display:none;\"" : ""%>> … … 174 159 onclick="doLogin();" title="Login" tooltip="<%=HTML.encodeTags(broadcastTitle)%>" /></td> 175 160 </tr> 176 <%177 if (Application.isUsingInternalAuthentication())178 {179 %>180 <tr>181 <td class="prompt"><label for="encrypt">Encrypt password</label></td>182 <td>183 <input type="checkbox" name="encrypt" id="encrypt" <%=false ? "" : "checked"%> value="1"><br>184 </td>185 </tr>186 <%187 }188 %>189 161 <tr> 190 162 <td colspan="3"> -
trunk/www/switch.jsp
r5812 r5827 49 49 %> 50 50 <base:page type="popup" title="Switch user"> 51 <base:head s cripts="md5.js" styles="login.css">51 <base:head styles="login.css"> 52 52 <script language="JavaScript" type="text/javascript"> 53 53 // Set foucs on the login form … … 77 77 var frm = document.forms['login']; 78 78 window.opener.parent.lastLogin = frm.login.value; 79 80 if (frm.encrypt)81 {82 window.opener.parent.encrypt = frm.encrypt.checked;83 if (frm.encrypt.checked)84 {85 var password = frm.password.value;86 var md5password = hex_md5(password);87 md5password = hex_md5(md5password + ':<%=sc.getChallenge()%>');88 frm.encrypted_password.value = md5password;89 frm.password.value = '';90 }91 }92 79 return true; 93 80 } … … 114 101 <input type="hidden" name="again" value="1"> 115 102 <input type="hidden" name="redirect" value=""> 116 <input type="hidden" name="encrypted_password" value="">117 103 118 104 <h3 class="docked">Switch user <base:help helpid="switchuser" /></h3> … … 142 128 </td> 143 129 </tr> 144 <%145 if (Application.isUsingInternalAuthentication())146 {147 %>148 <tr>149 <td class="prompt"><label for="encrypt">Encrypt password</label></td>150 <td>151 <input type="checkbox" name="encrypt" id="encrypt" checked value="1">152 </td>153 </tr>154 <%155 }156 %>157 130 <tr> 158 131 <td class="prompt"><label for="remainOnPage">Remain on this page</label></td>
Note: See TracChangeset
for help on using the changeset viewer.