ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.126 by root, Sat Nov 17 11:13:54 2012 UTC vs.
Revision 1.127 by root, Sat Nov 17 12:00:31 2012 UTC

124 124
125 $ob->goto ($map, $x, $y); 125 $ob->goto ($map, $x, $y);
126} 126}
127 127
128sub encode_password($) { 128sub encode_password($) {
129 "!" . unpack "H*", $_[0] 129 unpack "H*", Deliantra::Util::hash_pw $_[0]
130} 130}
131 131
132sub compare_password($$) { 132sub compare_password($$) {
133 my ($pass, $token) = @_; 133 my ($pass, $token) = @_;
134 134
161 my $ns = $pl->ns; 161 my $ns = $pl->ns;
162 my $ob = $pl->ob; 162 my $ob = $pl->ob;
163 163
164 $Coro::current->{desc} = "addme(" . $ob->name . ") login"; 164 $Coro::current->{desc} = "addme(" . $ob->name . ") login";
165 165
166 delete $pl->{deny_save}; # set by new
167
168 if ($pl->{chargen} eq "init") { 166 if ($pl->{chargen} eq "init") {
167 $ob->goto ($pl->maplevel, $ob->x, $ob->y);
168
169 # create the playerdir, if necessary, as chargen_race_done did it before 169 # create the playerdir, if necessary, as chargen_race_done did it before
170 # presumably because of unique maps 170 # presumably because of unique maps
171 aio_mkdir playerdir $pl, 0770; 171 aio_mkdir playerdir $pl, 0770;
172 delete $pl->{deny_save}; # set by new
172 $pl->save; 173 $pl->save;
173
174 $ob->goto ($pl->maplevel, $ob->x, $ob->y);
175 174
176 $pl->{chargen} = "stats"; 175 $pl->{chargen} = "stats";
177 } 176 }
178 177
179 if ($pl->{chargen} eq "stats") { 178 if ($pl->{chargen} eq "stats") {
257 $pl->ns->send_msg ("c/motd" => $motd, cf::NDI_CLEAR); 256 $pl->ns->send_msg ("c/motd" => $motd, cf::NDI_CLEAR);
258 } 257 }
259} 258}
260 259
261sub chargen { 260sub chargen {
262 my ($ns, $user, $hasah) = @_; 261 my ($ns, $user, $hash) = @_;
263 262
264 # lock again, too lazy to make this nicer 263 # lock again, too lazy to make this nicer
265 local $cf::LOGIN_LOCK{$user} = 1; 264 local $cf::LOGIN_LOCK{$user} = 1;
266 265
267 # just to make sure nothing is left over 266 # just to make sure nothing is left over
268 # normally, nothing is there. 267 # normally, nothing is there.
269 nuke_playerdir $user; 268 nuke_playerdir $user;
270 269
271 my $pl = cf::player::new $user; 270 my $pl = cf::player::new $user;
272 $pl->password (encode_password $pass); 271 $pl->password (unpack "H*", $hash);
273 $pl->connect ($ns); 272 $pl->connect ($ns);
274 273
275 $pl->{chargen} = "init"; 274 $pl->{chargen} = "init";
276 275
277 login $pl; 276 login $pl;
471 ); 470 );
472 471
473 cf::player::find $user 472 cf::player::find $user
474 and return $fail->("User '$user' already exists - choose another login name."); 473 and return $fail->("User '$user' already exists - choose another login name.");
475 474
476 chargen $ns, $user, Deliantra::Util::hash_pw $pass; 475 chargen $ns, $user, $pass;
477 }); 476 });
478}; 477};
479 478
480cf::register_async_exticmd login => sub { 479cf::register_async_exticmd login => sub {
481 my ($ns, $reply, $user, $hash) = @_; 480 my ($ns, $reply, $user, $hash) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines