Guest User

Untitled

a guest
Apr 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. gem 'bcrypt', '~> 3.1.7'
  2.  
  3. class UsersController < ApplicationController
  4.  
  5. def create
  6. @user = User.new(user_params)
  7.  
  8. if @user.save
  9. session[:user_id] = @user.id
  10. render json: @user, status: :created, location: @user
  11. else
  12. render json: @user.errors, status: :unprocessable_entity
  13. end
  14. end
  15.  
  16. private
  17. def user_params
  18. params.require(:user).permit(:first_name, :last_name, :email, :password)
  19. end
  20. end
  21.  
  22. ngOnInit() {
  23. this.Form = this.fb.group({
  24. first_name: this.fb.control(null, Validators.required),
  25. last_name: this.fb.control(null, Validators.required),
  26. email: this.fb.control(null, Validators.required),
  27. password: this.fb.control(null, Validators.required)
  28. });
  29. }
Add Comment
Please, Sign In to add comment