User profile update form
This commit is contained in:
parent
8a2780bfe4
commit
b3e6a3d1c7
@ -49,4 +49,13 @@ class UserController < ApplicationController
|
|||||||
redirect_to '/login'
|
redirect_to '/login'
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
31
app/views/user/update.erb
Normal file
31
app/views/user/update.erb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<div id="registration">
|
||||||
|
<h1>Update ur profile!</h1>
|
||||||
|
<%= 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 %><div id="password_error"></div>
|
||||||
|
<%= label_tag 'password_c', 'Confirm' %><%= password_field_tag 'password_c', nil %><div id="password_c_error"></div>
|
||||||
|
<div class="complete">
|
||||||
|
<%= submit_tag 'I\'m done!' %>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
$(function(){
|
||||||
|
$('#password').focus();
|
||||||
|
$('form').submit(function(){
|
||||||
|
$('#password_error, #password_c_error').html('');
|
||||||
|
if ($('#password').val().length < 6) {
|
||||||
|
$('#password_error').html('* Password must be 6+ characters length');
|
||||||
|
$('#password').focus();
|
||||||
|
return false;
|
||||||
|
} else if ($('#password').val() != $('#password_c').val()) {
|
||||||
|
$('#password_c_error').html('* Password and confirmation doesn\'t match');
|
||||||
|
$('#password_c').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
@ -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/:email/:code' => 'user#register', :constraints => { :email => /[-a-z0-9\._@]+/i, :code => /[a-f0-9]{64}/ }
|
||||||
match 'reg/complete' => 'user#complete'
|
match 'reg/complete' => 'user#complete'
|
||||||
match 'login' => 'user#login'
|
match 'login' => 'user#login'
|
||||||
|
match 'user/profile' => 'user#update'
|
||||||
|
|
||||||
match '*a', :to => 'errors#routing'
|
match '*a', :to => 'errors#routing'
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
#registration input[type="email"], input[type="password"] {
|
#registration input[type="email"], input[type="password"], input[type="text"] {
|
||||||
width: 230px;
|
width: 230px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
border: #EAEAEA 1px solid;
|
border: #EAEAEA 1px solid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user