Skip to content

Commit

Permalink
added saving users to passwd
Browse files Browse the repository at this point in the history
  • Loading branch information
slk187 committed May 19, 2013
1 parent 8bae65d commit 6c3c7af
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def show

@usr = Usertogroup.where("group_id = ?", @gtr.group_id).all

@htr = Repohook.where("repository_id = ?", params[:id]).all
@htr = Hook.all
# @htr = Repohook.where("repository_id = ?", params[:id]).all
# @hok = Hooktorepo.where("hook_id = ?", @htr.hook_id).all

respond_to do |format|
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ def new

def create
@user = User.new(params[:user])


if @user.save
@configFile = File.open("config/apache_config/passwd","w")
@allUsers = User.all

@configFile.puts("[users]\n")
@allUsers.each do |f|
@configFile.puts(f.email + " = " + f.password_hash + "\n")
end
@configFile.close()

redirect_to root_url, :notice => "Signed up!"
else
render "new"
Expand Down
2 changes: 2 additions & 0 deletions app/views/repositories/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<b>Hooks:</b><br/>
<% @htr.each do |f| %>
<%= f.hook_name %>
<%= link_to 'Show', f %>
<%= link_to 'Edit', edit_hook_path(f) %>
<br/>
<% end %>
</p>
Expand Down
1 change: 1 addition & 0 deletions config/apache_config/authz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[users]
4 changes: 4 additions & 0 deletions config/apache_config/passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[users]
[email protected] = 202cb962ac59075b964b07152d234b70
[email protected] = 900150983cd24fb0d6963f7d28e17f72
[email protected] = 47bce5c74f589f4867dbd57e9ca9f808

0 comments on commit 6c3c7af

Please sign in to comment.