Users model and integration

This commit is contained in:
magnolia-fan
2011-06-21 04:48:53 +04:00
parent 93130968fd
commit 49f1fba33a
9 changed files with 75 additions and 3 deletions
+12
View File
@@ -14,6 +14,18 @@ class UserController < ApplicationController
if Digest::MD5.hexdigest(hash) == params[:sig]
@res[:status] = 'hello'
user = User.find_by_vkid(params[:mid])
if user.nil?
user = User.new
user.vkid = params[:mid]
user.save
end
if user.name.nil? and not params[:name].nil?
user.name = params[:name]
user.save
end
@res[:id] = user.id
@res[:username] = user.name
else
@res[:status] = 'bad signature'
end