添加用户注册功能
This commit is contained in:
parent
42e6f42a7a
commit
97e1ce858e
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue