Skip to content

Commit

Permalink
tela de cadastro finalizada + assets inseridos no repo
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsodre committed Oct 26, 2017
1 parent 3d8e439 commit b58d75a
Show file tree
Hide file tree
Showing 14 changed files with 307 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
color: #aaa;
}

input[type=email], input[type=password] {
input[type=email], input[type=password], input[type=text] {
border: 1px solid #bbb;
border-radius: 10px;
width: 100%;
Expand Down
28 changes: 28 additions & 0 deletions app/controllers/users/confirmations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Users::ConfirmationsController < Devise::ConfirmationsController
# GET /resource/confirmation/new
# def new
# super
# end

# POST /resource/confirmation
# def create
# super
# end

# GET /resource/confirmation?confirmation_token=abcdef
# def show
# super
# end

# protected

# The path used after resending confirmation instructions.
# def after_resending_confirmation_instructions_path_for(resource_name)
# super(resource_name)
# end

# The path used after confirmation.
# def after_confirmation_path_for(resource_name, resource)
# super(resource_name, resource)
# end
end
28 changes: 28 additions & 0 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
# You should configure your model like this:
# devise :omniauthable, omniauth_providers: [:twitter]

# You should also create an action method in this controller like this:
# def twitter
# end

# More info at:
# https://github.com/plataformatec/devise#omniauth

# GET|POST /resource/auth/twitter
# def passthru
# super
# end

# GET|POST /users/auth/twitter/callback
# def failure
# super
# end

# protected

# The path used when OmniAuth fails
# def after_omniauth_failure_path_for(scope)
# super(scope)
# end
end
32 changes: 32 additions & 0 deletions app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class Users::PasswordsController < Devise::PasswordsController
# GET /resource/password/new
# def new
# super
# end

# POST /resource/password
# def create
# super
# end

# GET /resource/password/edit?reset_password_token=abcdef
# def edit
# super
# end

# PUT /resource/password
# def update
# super
# end

# protected

# def after_resetting_password_path_for(resource)
# super(resource)
# end

# The path used after sending reset password instructions
# def after_sending_reset_password_instructions_path_for(resource_name)
# super(resource_name)
# end
end
60 changes: 60 additions & 0 deletions app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
class Users::RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

# GET /resource/sign_up
# def new
# super
# end

# POST /resource
def create
super
end

# GET /resource/edit
# def edit
# super
# end

# PUT /resource
def update
super
end

# DELETE /resource
# def destroy
# super
# end

# GET /resource/cancel
# Forces the session data which is usually expired after sign
# in to be expired now. This is useful if the user wants to
# cancel oauth signing in/up in the middle of the process,
# removing all OAuth session data.
def cancel
super
end

protected

# If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:nome])
end

# If you have extra params to permit, append them to the sanitizer.
# def configure_account_update_params
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
# end

# The path used after sign up.
def after_sign_up_path_for(resource)
super(resource)
end

# The path used after sign up for inactive accounts.
def after_inactive_sign_up_path_for(resource)
super(resource)
end
end
25 changes: 25 additions & 0 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class Users::SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]

# GET /resource/sign_in
# def new
# super
# end

# POST /resource/sign_in
# def create
# super
# end

# DELETE /resource/sign_out
# def destroy
# super
# end

# protected

# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_in_params
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
# end
end
28 changes: 28 additions & 0 deletions app/controllers/users/unlocks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Users::UnlocksController < Devise::UnlocksController
# GET /resource/unlock/new
# def new
# super
# end

# POST /resource/unlock
# def create
# super
# end

# GET /resource/unlock?unlock_token=abcdef
# def show
# super
# end

# protected

# The path used after sending unlock password instructions
# def after_sending_unlock_instructions_path_for(resource)
# super(resource)
# end

# The path used after unlocking the resource
# def after_unlock_path_for(resource)
# super(resource)
# end
end
68 changes: 39 additions & 29 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
<h2>Sign ups</h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>

<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>

<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>

<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>

<%= render "devise/shared/links" %>
<section class="login-background">

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {class: "login-form"}) do |f| %>
<%= devise_error_messages! %>
<h2>Cadastro</h2>

<div class="campos">

<div class="field">
<%= f.label :nome %><br />
<%= f.text_field :nome, autofocus: true %>
</div>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>

<div class="field">
<%= f.label :password, "Senha" %>
<% if @minimum_password_length %>
<em>(Mínimo <%= @minimum_password_length %> caracteres) </em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>

<div class="field">
<%= f.label :password_confirmation, "Confirmação de Senha" %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="action-submit">
<%= f.submit "Salvar meu cadastro", class: "btn btn-submit" %>
</div>
</div>

<% end %>

</section>
<%# <%= render "devise/shared/links" %1> %>
6 changes: 3 additions & 3 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>

<div class="field">
<%= f.label :password, "Senha" %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>

<%# <% if devise_mapping.rememberable? %1> %>
<%# <div class="field"> %>
<%# <%= f.check_box :remember_me %1> %>
<%# <%= f.label :remember_me %1> %>
<%# </div> %>
<%# <% end %1> %>

<div class="action-submit">
<%= f.submit "Entrar in", class:"btn btn-submit" %>
</div>
Expand Down
18 changes: 14 additions & 4 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
<nav>
<%= image_tag "serieflix-logo.png", alt: "serieFlix logo", class: "logo"%>
<% if user_signed_in? %>
<%= link_to_unless_current "Séries" %>
<a href="#"> Minhas Séries </a>
<a href=""></a>
<%= link_to "Logout", destroy_user_session_path %>
<ul class="main-nav">
<li>
<%= link_to_unless_current "Séries" %>
</li>
<li>
<a href="#"> Minhas Séries </a>
</li>
<li>
<a href=""></a>
</li>
<li>
<%= link_to "Logout", destroy_user_session_path %>
</li>
</ul>
<% else %>

<ul class="main-nav">
Expand Down
5 changes: 4 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
root 'series#index'

resources :series
devise_for :users
devise_for :users, controllers: {
sessions: 'users/sessions',
registrations: "users/registrations"
}
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
5 changes: 5 additions & 0 deletions db/migrate/20171026184639_add_nome_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNomeToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :nome, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171018024107) do
ActiveRecord::Schema.define(version: 20171026184639) do

create_table "series", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "title"
Expand All @@ -33,6 +33,7 @@
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "nome"
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end
Expand Down
Loading

0 comments on commit b58d75a

Please sign in to comment.