Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
added password repeat field
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Pirogov committed May 2, 2011
1 parent fb8337d commit 9686869
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ authentication server. But I hope by using MCMyAuth you save some time.

2. This program handles just the basics and provides password
secured login for your users. You can not set skins or cloaks
and there is no password recovery system (admin can only delete
user from the file to let him register again)
over the web interface and there is no password recovery system
(admin can only delete user from the file to let him register again
and only admin can add skins (into the public/skin dir) for players)

----
Requirements: sinatra gem
Expand Down
2 changes: 2 additions & 0 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def msg(str)
return msg 'You have to set a nickname!' if name==''
return msg 'User already exists!' if $userpws[name] != nil
return msg 'You have to set a password!' if pwd==''
return msg 'Passwords do not match!' if pwd != params[:pwdrep]

$userpws[name] = md5 pwd
save_users
Expand All @@ -80,6 +81,7 @@ def msg(str)
name = params[:name]
pwd = params[:pwd]
return msg 'Wrong nickname or password!' if $userpws[name].nil? || md5(pwd) != $userpws[name]
return msg 'Passwords do not match!' if params[:newpwd] != params[:pwdrep]

$userpws[name] = md5 params[:newpwd]
save_users
Expand Down
3 changes: 2 additions & 1 deletion start.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rvmsudo ruby main.rb -p80
#!/bin/sh
sudo ruby main.rb -p80
2 changes: 2 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<label for="name">Nickname:</label><input type="text" name="name" maxlength="20" />
<br />
<label for="pwd">Password:</label><input type="password" name="pwd" maxlength="20" />
<label for="pwdrep">Repeat:</label><input type="password" name="pwdrep" maxlength="20" />
<label>&nbsp;</label><input type="submit" value="Register" />
</form>
</div>
Expand All @@ -17,6 +18,7 @@
<br />
<label for="pwd">Old password:</label><input type="password" name="pwd" maxlength="20" />
<label for="newpwd">New password:</label><input type="password" name="newpwd" maxlength="20" />
<label for="pwdrep">Repeat:</label><input type="password" name="pwdrep" maxlength="20" />
<label>&nbsp;</label><input type="submit" value="Change password" />
</form>
</div>
Expand Down

0 comments on commit 9686869

Please sign in to comment.