@@ -1247,7 +1247,10 @@ class Edit_User extends \NDB_Form
12471247 if ($ values ['Email ' ] === $ values ['Password_hash ' ]
12481248 && $ values ['Password_hash ' ] !== ''
12491249 ) {
1250- $ errors ['Password ' ] = self ::PASSWORD_ERROR_IS_EMAIL ;
1250+ $ errors ['Password ' ] = dgettext (
1251+ "user_accounts " ,
1252+ "Your password cannot be your email. "
1253+ );
12511254 }
12521255
12531256 // Make sure the user is not using their username as their password.
@@ -1260,7 +1263,10 @@ class Edit_User extends \NDB_Form
12601263 || (!empty ($ this ->identifier )
12611264 && $ this ->identifier === $ values ['Password_hash ' ])
12621265 ) {
1263- $ errors ['Password ' ] = self ::PASSWORD_ERROR_IS_USER ;
1266+ $ errors ['Password ' ] = dgettext (
1267+ "user_accounts " ,
1268+ "Your password cannot be your user name. "
1269+ );
12641270 }
12651271
12661272 if (!is_null ($ this ->identifier )) {
@@ -1286,7 +1292,10 @@ class Edit_User extends \NDB_Form
12861292 // Ensure that the password and confirm password fields match.
12871293 // TODO This validation should be done on the front-end instead.
12881294 if ($ plaintext !== $ values ['__Confirm ' ]) {
1289- $ errors ['Password ' ] = self ::PASSWORD_ERROR_NO_MATCH ;
1295+ $ errors ['Password ' ] = dgettext (
1296+ "user_accounts " ,
1297+ "The passwords do not match. "
1298+ );
12901299 }
12911300
12921301 // if password is user-defined, and user wants to change password
@@ -1302,7 +1311,10 @@ class Edit_User extends \NDB_Form
13021311 $ isPasswordDifferent = \User::factory ($ this ->identifier )
13031312 ->isPasswordDifferent ($ decoded );
13041313 if (! $ isPasswordDifferent ) {
1305- $ errors ['Password ' ] = self ::PASSWORD_ERROR_NO_CHANGE ;
1314+ $ errors ['Password ' ] = dgettext (
1315+ "user_accounts " ,
1316+ "New and old passwords are identical "
1317+ );
13061318 }
13071319 } catch (\InvalidArgumentException $ e ) {
13081320 $ errors ['Password ' ] = $ e ->getMessage ();
@@ -1314,17 +1326,22 @@ class Edit_User extends \NDB_Form
13141326 && $ values ['NA_Password ' ] == "on "
13151327 && $ values ['SendEmail ' ] != "on "
13161328 ) {
1317- $ errors ['Email ' ]
1318- = 'When generating a new password, '
1319- . 'please notify the user by checking Send email to user box ' ;
1329+ $ errors ['Email ' ] = dgettext (
1330+ "user_accounts " ,
1331+ "When generating a new password, please notify the user by checking "
1332+ + " 'Send email to user' box "
1333+ );
13201334 }
13211335
13221336 if (isset ($ values ['NA_Password ' ])
13231337 && $ values ['NA_Password ' ] == 'on '
13241338 && $ plaintext != ''
13251339 ) {
1326- $ errors ['Password ' ] = 'You must leave the password field empty '
1327- . 'if you want the system to generate one for you ' ;
1340+ $ errors ['Password ' ] = dgettext (
1341+ "user_accounts " ,
1342+ "You must leave the password field empty if you want the system to "
1343+ + " generate one for you "
1344+ );
13281345 }
13291346
13301347 if (is_null ($ this ->identifier )
@@ -1474,7 +1491,10 @@ class Edit_User extends \NDB_Form
14741491
14751492 // Email already exists in database
14761493 if ($ result > 0 ) {
1477- return self ::EMAIL_NOT_UNIQUE ;
1494+ return dgettext (
1495+ "user_accounts " ,
1496+ "This email address is already in use "
1497+ );
14781498 }
14791499
14801500 return null ;
0 commit comments