forked from github/server
eliminate duplicate password message
This commit is contained in:
parent
4cbeb03590
commit
f09259f2b3
|
@ -17,7 +17,7 @@ function setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_faction_flags()
|
function test_faction_flags()
|
||||||
assert_equal(2, f.flags) -- FFL_ISNEW
|
assert_equal(6, f.flags) -- FFL_ISNEW|FFL_PWMSG
|
||||||
f.flags = 42
|
f.flags = 42
|
||||||
assert_equal(42, f.flags)
|
assert_equal(42, f.flags)
|
||||||
end
|
end
|
||||||
|
|
|
@ -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);
|
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->alliance_joindate = turn;
|
||||||
f->lastorders = turn;
|
f->lastorders = turn;
|
||||||
f->_alive = true;
|
f->_alive = true;
|
||||||
|
@ -260,7 +255,11 @@ faction *addfaction(const char *email, const char *password,
|
||||||
f->magiegebiet = 0;
|
f->magiegebiet = 0;
|
||||||
f->locale = loc;
|
f->locale = loc;
|
||||||
f->subscription = subscription;
|
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 =
|
f->options =
|
||||||
want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_COMPUTER) | want(O_COMPRESS) |
|
want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_COMPUTER) | want(O_COMPRESS) |
|
||||||
|
|
|
@ -117,7 +117,7 @@ static void test_addfaction(CuTest *tc) {
|
||||||
CuAssertTrue(tc, checkpasswd(f, "hurrdurr"));
|
CuAssertTrue(tc, checkpasswd(f, "hurrdurr"));
|
||||||
CuAssertPtrEquals(tc, (void *)lang, (void *)f->locale);
|
CuAssertPtrEquals(tc, (void *)lang, (void *)f->locale);
|
||||||
CuAssertIntEquals(tc, 1234, f->subscription);
|
CuAssertIntEquals(tc, 1234, f->subscription);
|
||||||
CuAssertIntEquals(tc, FFL_ISNEW, f->flags);
|
CuAssertIntEquals(tc, FFL_ISNEW|FFL_PWMSG, f->flags);
|
||||||
CuAssertIntEquals(tc, 0, f->age);
|
CuAssertIntEquals(tc, 0, f->age);
|
||||||
CuAssertTrue(tc, faction_alive(f));
|
CuAssertTrue(tc, faction_alive(f));
|
||||||
CuAssertIntEquals(tc, M_GRAY, f->magiegebiet);
|
CuAssertIntEquals(tc, M_GRAY, f->magiegebiet);
|
||||||
|
|
|
@ -232,7 +232,7 @@ static void test_newbie_password_message(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
f->age = 5;
|
f->age = 5;
|
||||||
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
|
f->flags = 0;
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
|
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "changepasswd"));
|
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "changepasswd"));
|
||||||
|
|
Loading…
Reference in New Issue