version 1.79 | | version 1.80 |
---|
| | |
/* | | /* |
* static char *rcsid_c_misc_c = | | * static char *rcsid_c_misc_c = |
* "$Id: c_misc.c,v 1.79 2006/06/06 21:38:41 akirschbaum Exp $"; | | * "$Id: c_misc.c,v 1.80 2006/08/08 10:05:34 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
unsigned int pwd_len=strlen(op->contr->write_buf); | | unsigned int pwd_len=strlen(op->contr->write_buf); |
if(pwd_len<=1||pwd_len>17) { | | if(pwd_len<=1||pwd_len>17) { |
| | if (op->contr->state == ST_CHANGE_PASSWORD_OLD || op->contr->state == ST_CHANGE_PASSWORD_NEW || op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) { |
| | new_draw_info(NDI_UNIQUE, 0, op, "Password changed cancelled."); |
| | op->contr->state = ST_PLAYING; |
| | } |
| | else |
get_name(op); | | get_name(op); |
return; | | return; |
} | | } |
| | |
op->contr->state=ST_ROLL_STAT; | | op->contr->state=ST_ROLL_STAT; |
return; | | return; |
} | | } |
| | |
| | if (op->contr->state == ST_CHANGE_PASSWORD_OLD) { |
| | if (!check_password(op->contr->write_buf + 1, op->contr->password)) { |
| | new_draw_info(NDI_UNIQUE, 0, op, "You entered the wrong current password."); |
| | op->contr->state = ST_PLAYING; |
| | } else { |
| | send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "Please enter your new password, or blank to cancel:"); |
| | op->contr->state = ST_CHANGE_PASSWORD_NEW; |
| | } |
| | return; |
| | } |
| | |
| | if (op->contr->state == ST_CHANGE_PASSWORD_NEW) { |
| | strcpy(op->contr->new_password, crypt_string(op->contr->write_buf + 1, NULL)); |
| | send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "Please confirm your new password, or blank to cancel:"); |
| | op->contr->state = ST_CHANGE_PASSWORD_CONFIRM; |
| | return; |
| | } |
| | |
| | if (op->contr->state == ST_CHANGE_PASSWORD_CONFIRM) { |
| | if (strcmp(crypt_string(op->contr->write_buf + 1, op->contr->new_password), op->contr->new_password)) { |
| | new_draw_info(NDI_UNIQUE, 0, op, "The new passwords don't match!"); |
| | } else { |
| | new_draw_info(NDI_UNIQUE, 0, op, "Password changed."); |
| | strncpy(op->contr->password, op->contr->new_password, 13); |
| | } |
| | op->contr->state = ST_PLAYING; |
| | return; |
| | } |
| | |
strcpy(op->contr->password,crypt_string(op->contr->write_buf+1,NULL)); | | strcpy(op->contr->password,crypt_string(op->contr->write_buf+1,NULL)); |
op->contr->state=ST_ROLL_STAT; | | op->contr->state=ST_ROLL_STAT; |
check_login(op); | | check_login(op); |
| | |
} | | } |
return 1; | | return 1; |
} | | } |
| | |
| | /** |
| | * Player is asking to change password. |
| | **/ |
| | int command_passwd(object *pl, char *params) |
| | { |
| | send_query(&pl->contr->socket,CS_QUERY_HIDEINPUT, |
| | "Password change.\nPlease enter your current password, or empty string to cancel."); |
| | |
| | pl->contr->state = ST_CHANGE_PASSWORD_OLD; |
| | return 1; |
| | } |