diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-01-13 10:27:17 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-01-13 10:27:17 +0000 |
commit | 85709aa77e14a02866cdbb7ede40a0b52ef12b74 (patch) | |
tree | d3366a214e62e5751126e6d9be029a7fff98e567 /src | |
parent | 0e628dcfe81a8067def049d0bfaafdcefbd1a847 (diff) | |
download | hercules-85709aa77e14a02866cdbb7ede40a0b52ef12b74.tar.gz hercules-85709aa77e14a02866cdbb7ede40a0b52ef12b74.tar.bz2 hercules-85709aa77e14a02866cdbb7ede40a0b52ef12b74.tar.xz hercules-85709aa77e14a02866cdbb7ede40a0b52ef12b74.zip |
* Added support for creating account through the console-plugin on login-server (replaces ladmin functionality unavailable through atcommands).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14665 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/login/login.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/login/login.c b/src/login/login.c index 1bce63900..567bbddf3 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -70,6 +70,7 @@ struct s_subnet { int subnet_count = 0; +int mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip); //----------------------------------------------------- // Auth database @@ -337,6 +338,35 @@ int parse_console(const char* command) ShowInfo(" 'shutdown|exit|quit|end'\n"); ShowInfo("To know if server is alive:\n"); ShowInfo(" 'alive|status'\n"); + ShowInfo("To create a new account:\n"); + ShowInfo(" 'create'\n"); + } + else + {// commands with parameters + char cmd[128], params[256]; + + if( sscanf(command, "%127s %255[^\r\n]", cmd, params) < 2 ) + { + return 0; + } + + if( strcmpi(cmd, "create") == 0 ) + { + char username[NAME_LENGTH], password[NAME_LENGTH], sex; + + if( sscanf(params, "%23s %23s %c", username, password, &sex) < 3 || strnlen(username, sizeof(username)) < 4 || strnlen(password, sizeof(password)) < 1 ) + { + ShowWarning("Console: Invalid parameters for '%s'. Usage: %s <username> <password> <sex:F/M>\n", cmd, cmd); + return 0; + } + + if( mmo_auth_new(username, password, TOUPPER(sex), "0.0.0.0") != -1 ) + { + ShowError("Console: Account creation failed.\n"); + return 0; + } + ShowStatus("Console: Account '%s' created successfully.\n", username); + } } return 0; |