… | |
… | |
2 | |
2 | |
3 | # login handling |
3 | # login handling |
4 | |
4 | |
5 | use Fcntl; |
5 | use Fcntl; |
6 | use Coro::AIO; |
6 | use Coro::AIO; |
|
|
7 | use Deliantra::Util (); |
7 | |
8 | |
8 | CONF MAX_DISCONNECT_TIME = 3600; |
9 | CONF MAX_DISCONNECT_TIME = 3600; |
9 | |
10 | |
10 | sub query { |
11 | sub query { |
11 | my ($ns, $flags, $text) = @_; |
12 | my ($ns, $flags, $text) = @_; |
… | |
… | |
169 | $Coro::current->{desc} = "addme($user) chargen"; |
170 | $Coro::current->{desc} = "addme($user) chargen"; |
170 | |
171 | |
171 | # just to make sure nothing is left over |
172 | # just to make sure nothing is left over |
172 | # normally, nothing is there. |
173 | # normally, nothing is there. |
173 | nuke_playerdir $user; |
174 | nuke_playerdir $user; |
174 | |
|
|
175 | my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again."; |
|
|
176 | |
|
|
177 | if ($pass2 ne $pass) { |
|
|
178 | $ns->send_drawinfo ( |
|
|
179 | "The passwords do not match, please try again.", |
|
|
180 | cf::NDI_RED |
|
|
181 | ); |
|
|
182 | Coro::Timer::sleep 0.5; |
|
|
183 | next; |
|
|
184 | } |
|
|
185 | |
175 | |
186 | my $pl = cf::player::new $user; |
176 | my $pl = cf::player::new $user; |
187 | $pl->password (encode_password $pass); |
177 | $pl->password (encode_password $pass); |
188 | $pl->connect ($ns); |
178 | $pl->connect ($ns); |
189 | my $ob = $pl->ob; |
179 | my $ob = $pl->ob; |
… | |
… | |
397 | ); |
387 | ); |
398 | next; |
388 | next; |
399 | } |
389 | } |
400 | } |
390 | } |
401 | |
391 | |
|
|
392 | my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again."; |
|
|
393 | |
|
|
394 | if ($pass2 ne $pass) { |
|
|
395 | $ns->send_drawinfo ( |
|
|
396 | "The passwords do not match, please try again.", |
|
|
397 | cf::NDI_RED |
|
|
398 | ); |
|
|
399 | Coro::Timer::sleep 0.5; |
|
|
400 | next; |
|
|
401 | } |
|
|
402 | |
402 | last; |
403 | last; |
403 | } |
404 | } |
404 | |
405 | |
405 | # lock again, too layz to make this nicer |
406 | # lock again, too layz to make this nicer |
406 | local $cf::LOGIN_LOCK{$user} = 1; |
407 | local $cf::LOGIN_LOCK{$user} = 1; |
|
|
408 | |
407 | chargen $ns, $user, $pass; |
409 | chargen $ns, $user, $pass; |
408 | login_done $ns->pl; |
410 | login_done $ns->pl; |
409 | }); |
411 | }); |
410 | }); |
412 | }); |
411 | |
413 | |