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

Commit 9686869

Browse files
author
Anton Pirogov
committed
added password repeat field
1 parent fb8337d commit 9686869

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

README

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ authentication server. But I hope by using MCMyAuth you save some time.
4545

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

5152
----
5253
Requirements: sinatra gem

main.rb

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def msg(str)
6969
return msg 'You have to set a nickname!' if name==''
7070
return msg 'User already exists!' if $userpws[name] != nil
7171
return msg 'You have to set a password!' if pwd==''
72+
return msg 'Passwords do not match!' if pwd != params[:pwdrep]
7273

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

8486
$userpws[name] = md5 params[:newpwd]
8587
save_users

start.sh

100644100755
+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
rvmsudo ruby main.rb -p80
1+
#!/bin/sh
2+
sudo ruby main.rb -p80

views/index.erb

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<label for="name">Nickname:</label><input type="text" name="name" maxlength="20" />
77
<br />
88
<label for="pwd">Password:</label><input type="password" name="pwd" maxlength="20" />
9+
<label for="pwdrep">Repeat:</label><input type="password" name="pwdrep" maxlength="20" />
910
<label>&nbsp;</label><input type="submit" value="Register" />
1011
</form>
1112
</div>
@@ -17,6 +18,7 @@
1718
<br />
1819
<label for="pwd">Old password:</label><input type="password" name="pwd" maxlength="20" />
1920
<label for="newpwd">New password:</label><input type="password" name="newpwd" maxlength="20" />
21+
<label for="pwdrep">Repeat:</label><input type="password" name="pwdrep" maxlength="20" />
2022
<label>&nbsp;</label><input type="submit" value="Change password" />
2123
</form>
2224
</div>

0 commit comments

Comments
 (0)