eliminate duplicate password message

This commit is contained in:
Enno Rehling 2017-01-22 18:51:20 +01:00
parent 4cbeb03590
commit f09259f2b3
4 changed files with 8 additions and 9 deletions

View File

@ -17,7 +17,7 @@ function setup()
end
function test_faction_flags()
assert_equal(2, f.flags) -- FFL_ISNEW
assert_equal(6, f.flags) -- FFL_ISNEW|FFL_PWMSG
f.flags = 42
assert_equal(42, f.flags)
end

View File

@ -247,11 +247,6 @@ faction *addfaction(const char *email, const char *password,
log_warning("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
}
if (!password) password = itoa36(rng_int());
faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT));
ADDMSG(&f->msgs, msg_message("changepasswd", "value", password));
f->flags |= FFL_PWMSG;
f->alliance_joindate = turn;
f->lastorders = turn;
f->_alive = true;
@ -260,7 +255,11 @@ faction *addfaction(const char *email, const char *password,
f->magiegebiet = 0;
f->locale = loc;
f->subscription = subscription;
f->flags = FFL_ISNEW;
f->flags = FFL_ISNEW|FFL_PWMSG;
if (!password) password = itoa36(rng_int());
faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT));
ADDMSG(&f->msgs, msg_message("changepasswd", "value", password));
f->options =
want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_COMPUTER) | want(O_COMPRESS) |

View File

@ -117,7 +117,7 @@ static void test_addfaction(CuTest *tc) {
CuAssertTrue(tc, checkpasswd(f, "hurrdurr"));
CuAssertPtrEquals(tc, (void *)lang, (void *)f->locale);
CuAssertIntEquals(tc, 1234, f->subscription);
CuAssertIntEquals(tc, FFL_ISNEW, f->flags);
CuAssertIntEquals(tc, FFL_ISNEW|FFL_PWMSG, f->flags);
CuAssertIntEquals(tc, 0, f->age);
CuAssertTrue(tc, faction_alive(f));
CuAssertIntEquals(tc, M_GRAY, f->magiegebiet);

View File

@ -232,7 +232,7 @@ static void test_newbie_password_message(CuTest *tc) {
test_setup();
f = test_create_faction(0);
f->age = 5;
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
f->flags = 0;
prepare_report(&ctx, f);
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "changepasswd"));