forked from github/server
allow setting password to null
This commit is contained in:
parent
2ec6021278
commit
8868855837
|
@ -383,7 +383,8 @@ static int tolua_faction_set_password(lua_State * L)
|
|||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char * passw = tolua_tostring(L, 2, NULL);
|
||||
faction_setpassword(self, password_hash(passw, PASSWORD_DEFAULT));
|
||||
faction_setpassword(self,
|
||||
passw ? password_hash(passw, PASSWORD_DEFAULT) : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -564,8 +564,12 @@ const char *faction_getpassword(const faction *f) {
|
|||
|
||||
void faction_setpassword(faction * f, const char *pwhash)
|
||||
{
|
||||
assert(pwhash);
|
||||
f->password_id = dbstring_save(pwhash);
|
||||
if (pwhash) {
|
||||
f->password_id = dbstring_save(pwhash);
|
||||
}
|
||||
else {
|
||||
f->password_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool valid_race(const struct faction *f, const struct race *rc)
|
||||
|
|
Loading…
Reference in New Issue