From b3e6a3d1c7a98b412eb61f36b05e21eedda72879 Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Sat, 16 Apr 2011 00:09:17 +0400 Subject: [PATCH] User profile update form --- app/controllers/user_controller.rb | 9 +++++++++ app/views/user/update.erb | 31 ++++++++++++++++++++++++++++++ config/routes.rb | 1 + public/stylesheets/register.css | 2 +- 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 app/views/user/update.erb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index b28b18c..b23ae4e 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -49,4 +49,13 @@ class UserController < ApplicationController redirect_to '/login' end end + + def update + @data = User.collection.find({session_key: Digest::SHA256.hexdigest(request.session['session_id'])}).first + unless @data.nil? + + else + render :json => 'wtf?' + end + end end diff --git a/app/views/user/update.erb b/app/views/user/update.erb new file mode 100644 index 0000000..4683966 --- /dev/null +++ b/app/views/user/update.erb @@ -0,0 +1,31 @@ +
+

Update ur profile!

+ <%= form_tag('/reg/complete', :method => 'post') do -%> + <%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', @data.email %> + <%= label_tag 'name', 'Name' %><%= text_field_tag 'name', @data.name %> + <%= label_tag 'password', 'Password' %><%= password_field_tag 'password', nil %>
+ <%= label_tag 'password_c', 'Confirm' %><%= password_field_tag 'password_c', nil %>
+
+ <%= submit_tag 'I\'m done!' %> +
+ <% end -%> + +
+ \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 598c993..3fd96d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,6 +11,7 @@ Beathaven::Application.routes.draw do match 'reg/:email/:code' => 'user#register', :constraints => { :email => /[-a-z0-9\._@]+/i, :code => /[a-f0-9]{64}/ } match 'reg/complete' => 'user#complete' match 'login' => 'user#login' + match 'user/profile' => 'user#update' match '*a', :to => 'errors#routing' end diff --git a/public/stylesheets/register.css b/public/stylesheets/register.css index dbe78a5..fc32198 100644 --- a/public/stylesheets/register.css +++ b/public/stylesheets/register.css @@ -23,7 +23,7 @@ font-size: 20px; line-height: 35px; } - #registration input[type="email"], input[type="password"] { + #registration input[type="email"], input[type="password"], input[type="text"] { width: 230px; font-size: 20px; border: #EAEAEA 1px solid;