添加用户注册功能

This commit is contained in:
刘惊坤 2015-11-23 14:13:41 +08:00
parent 42e6f42a7a
commit 97e1ce858e
1 changed files with 10 additions and 1 deletions

View File

@ -1,10 +1,19 @@
#encoding: utf-8
class UsersController < ApplicationController
def register
@user = User.new
render 'register', layout: 'register'
end
def register_confirm
@user = User.new params.require(:user).permit(:username,:em ail,:password,:password_confirmation)
if @user.save
to_login @user
redirect_to root_path
else
render 'register', layout: 'register'
end
end
@ -25,4 +34,4 @@ class UsersController < ApplicationController
def to_login(user)
end
end
end