add new api

This commit is contained in:
Sunandar
2017-02-03 17:56:27 +06:30
parent b4c9e8cc8e
commit 538c898e06
12 changed files with 117 additions and 75 deletions

View File

@@ -29,10 +29,10 @@ class UsersController < ApplicationController
@user = User.new(user_params)
email=params[:registered_email]
@user.is_active=true
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
key=cipher.random_key
secrect_key= Base64.encode64(key)
@user.secrect_key=secrect_key
# cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
# key=cipher.random_key
# secrect_key= Base64.encode64(key)
# @user.secrect_key=secrect_key
@email=email
respond_to do |format|
if @user.save
@@ -100,6 +100,6 @@ class UsersController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def user_params
params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active,:secrect_key)
params.require(:user).permit(:name, :nrc, :email, :phone, :address,:is_active)
end
end