UI and naming changes
This commit is contained in:
parent
a5e7fef642
commit
dace874f4f
12 changed files with 22 additions and 18 deletions
|
@ -1,2 +1,6 @@
|
|||
@import "materialize";
|
||||
@import "https://fonts.googleapis.com/icon?family=Material+Icons";
|
||||
|
||||
body {
|
||||
margin: 100px;
|
||||
}
|
|
@ -18,15 +18,15 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def recover_password_form
|
||||
@recovery_code = params[:recovery_code]
|
||||
@recovery_password = params[:recovery_password]
|
||||
@user_id = params[:id]
|
||||
end
|
||||
|
||||
def recover_password
|
||||
user = User.find(params[:user_id])
|
||||
if user.authenticate_recovery_password(params[:recovery_code])
|
||||
if user.authenticate_recovery_password(params[:recovery_password])
|
||||
user.password = params[:password]
|
||||
user.password_confirmation = params[:repeated_password]
|
||||
user.password_confirmation = params[:password_confirmation]
|
||||
user.recovery_password_digest = nil
|
||||
if user.save
|
||||
redirect_to '/welcome'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<h1>Sessions#create</h1>
|
||||
<h3>Sessions#create</h3>
|
||||
<p>Find me in app/views/sessions/create.html.erb</p>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<h1>Login</h1>
|
||||
<h3>Login</h3>
|
||||
<%= form_tag '/login' do %>
|
||||
<%= label_tag :email%>
|
||||
<%= text_field_tag :email %>
|
||||
<%= label_tag :password%>
|
||||
<%= password_field_tag :password%>
|
||||
<%= submit_tag "Login"%>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<%= button_to "Password recovery", '/password_recovery_request', method: :get%>
|
|
@ -1,9 +1,8 @@
|
|||
<h1>Welcome</h1>
|
||||
<h3>Welcome</h3>
|
||||
<% if logged_in? %>
|
||||
<h1>You are Logged In, <%= current_user.email %></h1>
|
||||
You are Logged In, <%= current_user.email %>
|
||||
<%= button_to "Logout", '/logout', method: :get%>
|
||||
<%else%>
|
||||
<%= button_to "Login", '/login', method: :get%>
|
||||
<%= button_to "Sign Up", '/users/new', method: :get%>
|
||||
<%= button_to "Password recovery", '/password_recovery_request', method: :get%>
|
||||
<%end%>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<h1>Users#create</h1>
|
||||
<h3>Users#create</h3>
|
||||
<p>Find me in app/views/users/create.html.erb</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h1>Sign Up</h1>
|
||||
<h3>Sign Up</h3>
|
||||
<%= form_for @user do |f|%>
|
||||
<%= f.label :email%><br>
|
||||
<%= f.text_field :email%><br>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
Recover password
|
||||
|
||||
<%= form_with url: "/recover_password", method: :post do |form| %>
|
||||
<%= form.text_field :password %>
|
||||
<%= form.text_field :repeated_password %>
|
||||
<%= form.hidden_field :recovery_code, :value => @recovery_code %>
|
||||
<%= form.password_field :password %>
|
||||
<%= form.password_field :password_confirmation %>
|
||||
<%= form.hidden_field :recovery_password, :value => @recovery_password %>
|
||||
<%= form.hidden_field :user_id, :value => @user_id %>
|
||||
<%= form.submit "Change password" %>
|
||||
<% end %>
|
|
@ -6,7 +6,7 @@ Rails.application.routes.draw do
|
|||
get 'welcome', to: 'sessions#welcome'
|
||||
get 'password_recovery_request', to: 'users#password_recovery_request_form'
|
||||
post 'password_recovery_request', to: 'users#password_recovery_request'
|
||||
get 'recover_password/:id/:recovery_code', to: 'users#recover_password_form'
|
||||
get 'recover_password/:id/:recovery_password', to: 'users#recover_password_form'
|
||||
post 'recover_password', to: 'users#recover_password'
|
||||
resources :books
|
||||
end
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<!-- This file lives in public/404.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The page you were looking for doesn't exist.</h1>
|
||||
<h3>The page you were looking for doesn't exist.</h3>
|
||||
<p>You may have mistyped the address or the page may have moved.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<!-- This file lives in public/422.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The change you wanted was rejected.</h1>
|
||||
<h3>The change you wanted was rejected.</h3>
|
||||
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<!-- This file lives in public/500.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>We're sorry, but something went wrong.</h1>
|
||||
<h3>We're sorry, but something went wrong.</h3>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue