Introduction
Introduction Statistics Contact Development Disclaimer Help
users_controller.rb - warvox - VoIP based wardialing tool, forked from rapid7/w…
git clone git://jay.scot/warvox
Log
Files
Refs
README
---
users_controller.rb (872B)
---
1 class UsersController < ApplicationController
2 before_action :require_no_user, only: [:new, :create]
3 before_action :require_user, only: [:show, :edit, :update]
4
5 def new
6 @user = User.new
7 end
8
9 def create
10 @user = User.new(user_params)
11 if @user.save
12 flash[:notice] = "Account registered!"
13 redirect_back_or_default user_path(@user)
14 else
15 render action: :new
16 end
17 end
18
19 def show
20 @user = @current_user
21 end
22
23 def edit
24 @user = @current_user
25 end
26
27 def update
28 @user = @current_user # makes our views "cleaner" and more consistent
29 if @user.update_attributes(user_params)
30 flash[:notice] = "Account updated!"
31 redirect_to user_path(@user)
32 else
33 render action: :edit
34 end
35 end
36
37 private
38
39 def user_params
40 params.require(:user).permit(:login, :password, :password_confirmati…
41 end
42 end
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.