Commit 14065b26 by Mykhailo Makohin

finish registration

parent f8b7ff2c
<svg id="SvgjsSvg1000" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="16" height="16"><defs id="SvgjsDefs1001"></defs><path id="SvgjsPath1007" d="M1750 797L1750 789.999L1743 789.999L1743 788L1750 788L1750 781L1752 781L1752 788L1759 788L1759 789.999L1752 789.999L1752 797Z " fill="#ff4628" transform="matrix(1,0,0,1,-1743,-781)"></path></svg>
\ No newline at end of file
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery with: :exception protect_from_forgery with: :exception
skip_before_filter :verify_authenticity_token
end end
class UsersController < ApplicationController class UsersController < ApplicationController
# skip_before_filter :verify_authenticity_token
def index def index
@users = collection @users = collection
...@@ -17,7 +18,7 @@ class UsersController < ApplicationController ...@@ -17,7 +18,7 @@ class UsersController < ApplicationController
@user.skip_password_validation = true @user.skip_password_validation = true
if @user.save if @user.save
redirect_to edit_user_path(@user) redirect_to edit_user_path(@user)
elsif else
redirect_to root_path redirect_to root_path
end end
end end
...@@ -28,12 +29,10 @@ class UsersController < ApplicationController ...@@ -28,12 +29,10 @@ class UsersController < ApplicationController
def update def update
@user = resource @user = resource
@user.skip_password_validation = false
if @user.update(user_params) if @user.update(user_params)
sign_in @user sign_in @user
redirect_to user_path(@user) redirect_to user_path(@user)
else else
puts @user.errors.messages
render :edit render :edit
end end
end end
...@@ -42,7 +41,7 @@ class UsersController < ApplicationController ...@@ -42,7 +41,7 @@ class UsersController < ApplicationController
@user = resource @user = resource
@user.destroy @user.destroy
redirect_to users_path redirect_to root_path
end end
private private
...@@ -57,7 +56,6 @@ class UsersController < ApplicationController ...@@ -57,7 +56,6 @@ class UsersController < ApplicationController
def user_params def user_params
params.require(:user).permit(:email, :name, :location, params.require(:user).permit(:email, :name, :location,
:password, :password_confirmation) :password, :password_confirmation)
end end
end end
\ No newline at end of file
...@@ -31,8 +31,17 @@ class User < ApplicationRecord ...@@ -31,8 +31,17 @@ class User < ApplicationRecord
protected protected
# def password_required?
# return false if skip_password_validation
# super
# end
def password_required? def password_required?
return false if skip_password_validation return false if skip_password_validation
super if respond_to?(:reset_password_token)
return true if reset_password_token.present?
end
return true if new_record?
password.present? || password_confirmation.present?
end end
end end
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
%span.grid_item_content.tooltipstered %span.grid_item_content.tooltipstered
%a.get_involved_link.centered{"data-original-title" => "приєднатись", "data-placement" => "top", "data-toggle" => "tooltip", :href => "#"} %a.get_involved_link.centered{"data-original-title" => "приєднатись", "data-placement" => "top", "data-toggle" => "tooltip", :href => "#"}
%span.get_involved_circle %span.get_involved_circle
%img.icon_plus{:alt => "", :src => "img/plus.svg"}/ %img.icon_plus{:alt => "", :src => "plus.svg"}/
.progress .progress
.progress-bar{"aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => "58", :role => "progressbar", :style => "width: 58%"} .progress-bar{"aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => "58", :role => "progressbar", :style => "width: 58%"}
.progress_value_lg 58 / 100 .progress_value_lg 58 / 100
...@@ -595,8 +595,8 @@ ...@@ -595,8 +595,8 @@
.counter_text Обєднаних людей за кордоном .counter_text Обєднаних людей за кордоном
.map_text .map_text
Етнічна, в першу чергу релігійна та мовно-культурна спільнота або сукупність індивидів, які існують зберігаються за межами свого регіону Етнічна, в першу чергу релігійна та мовно-культурна спільнота або сукупність індивидів, які існують зберігаються за межами свого регіону
#map.map #map.map
%a.btn.btn_default.btn_round.btn_bordered{"data-original-title" => "долучитись", "data-placement" => "top", "data-toggle" => "tooltip", :href => "#"} %a.btn.btn_default.btn_round.btn_bordered{"data-original-title" => "долучитись", "data-placement" => "top", "data-target" => "#modal3", "data-toggle" => "modal",href: "#"}
%i.icon.icon_plus %i.icon.icon_plus
.tooltip_templates .tooltip_templates
#tooltip_content_inner #tooltip_content_inner
...@@ -605,7 +605,7 @@ ...@@ -605,7 +605,7 @@
Технічний партнер Технічний партнер
.tooltipster_title_name Cosmo-Trecel .tooltipster_title_name Cosmo-Trecel
%a.tooltipster_img{"data-target" => "#video", "data-toggle" => "modal", :href => "//www.youtube.com/embed/uX12dn47Dy0?rel=0&autoplay=1&showinfo=0html5=1"} %a.tooltipster_img{"data-target" => "#video", "data-toggle" => "modal", :href => "//www.youtube.com/embed/uX12dn47Dy0?rel=0&autoplay=1&showinfo=0html5=1"}
%img{:alt => "", :src => "img/tip_img1.png"}/ %img{:alt => "", :src => "tip_img1.png"}/
.tooltipster_bot .tooltipster_bot
%a.tooltipster_link{:href => "#"} cosmo-travel.com.ua %a.tooltipster_link{:href => "#"} cosmo-travel.com.ua
%a.round_link{:href => "#"} %a.round_link{:href => "#"}
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
- unless current_user - unless current_user
.login_wrap .login_wrap
%div %div
%button.login_btn{"data-target" => "#modal3", "data-toggle" => "modal"} %button.login_btn{"data-target" => "#modal_log_in", "data-toggle" => "modal"}
= image_tag ("login.png") = image_tag ("login.png")
.search_block .search_block
%input#search_field.search_field{placeholder: "Пошук по імені...", :type => "text"}/ %input#search_field.search_field{placeholder: "Пошук по імені...", :type => "text"}/
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%button.round_link.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"} %button.round_link.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"}
%i.icon.icon_close %i.icon.icon_close
.modal-header_bot .modal-header_bot
%h3#modalLabel.modal-title Вхід %h3#modalLabel.modal-title Реєстрація
.help_text.absolute .help_text.absolute
%span.asterisk> * %span.asterisk> *
Всі поля обов'язкові для заповнення Всі поля обов'язкові для заповнення
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
.row .row
.col-sm-9.modal-body_login .col-sm-9.modal-body_login
%h4.modal_subtitle %h4.modal_subtitle
Авторизація реєстрація
.form-group .form-group
%label{:for => "id_3"} %label{:for => "id_3"}
E-mail E-mail
...@@ -44,3 +44,68 @@ ...@@ -44,3 +44,68 @@
%i.icon.icon_google %i.icon.icon_google
.text-center .text-center
= f.button :submit, "Вхід", class: "btn btn-success btn-lg" = f.button :submit, "Вхід", class: "btn btn-success btn-lg"
#modal_log_in.modal.fade.modal_styled.in{"aria-labelledby" => "modalLabel", :role => "dialog", :tabindex => "-1"}
.modal-dialog{:role => "document"}
.modal-content
#log_in_form
.modal-header
.modal-header_top.clearfix
.modal-header_top_bg
%button.round_link.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"}
%i.icon.icon_close
.modal-header_bot
%h3#modalLabel.modal-title Увійти
.help_text.absolute
Заповніть всі поля
.modal-body
.row
.col-sm-9.modal-body_login
%h4.modal_subtitle
Авторизація
= simple_form_for :user, url: session_path(:user), remote: true do |f|
%input{:name => "utf8", :type => "hidden", :value => "✓"}/
.form-group
%label{:for => "id_3"}
%span.asterisk>
E-mail
.field_wrap
= f.email_field :email, autofocus: true, autocomplete: "email"
%span.error_text
.form-group
%label
%span.asterisk
%label{:for => "user_password"} Password
.field_wrap
= f.password_field :password, autocomplete: "current-password"
%span.error_text
.text-center
= f.submit "Log in"
.col-sm-3.modal-body_registration
%h4.modal_subtitle
Швидка реєстрація
.soc_btn_wrap.clearfix
%a.soc_btn.soc_btn_fb{href: "/users/auth/facebook"}
%i.icon.icon_fb
%a.soc_btn.soc_btn_google{href: "/users/auth/google_oauth2"}
%i.icon.icon_google
/ = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
/ .field
/ = f.label :email
/ %br/
/ = f.email_field :email, autofocus: true, autocomplete: "email"
/ .field
/ = f.label :password
/ %br/
/ = f.password_field :password, autocomplete: "current-password"
/ - if devise_mapping.rememberable?
/ .field
/ = f.check_box :remember_me
/ = f.label :remember_me
/ .actions
/ = f.submit "Log in"
\ No newline at end of file
= simple_form_for @user, url: user_path, html: { method: :put } do |f| .wrapper
= f.error_notification .content
.wrapper .img_line
.content .container
.img_line .centered_form
.container .pseudo_btns
.centered_form %span.btn.btn_faked профіль користувача
.pseudo_btns .help_text
%span.btn.btn_faked реєстрація %span.asterisk *
.help_text Поля обов'язкові для заповнення
%span.asterisk * .form_container
Поля обов'язкові для заповнення = simple_form_for @user, url: user_path, html: { method: :put } do |f|
.form_container = f.error_notification
.horizontal_input_group .form-group
.form-group %label{:for => "id_1"}
%label{:for => "id_1"} %span.asterisk> *
%span.asterisk> * Як вас звати?
Як вас звати? .field_wrap
.field_wrap = f.input :name, label: false, class: 'form-control'
= f.input_field :name, class: 'form-control' .form-group
.form-group %label{:for => "id_3"}
%label{:for => "id_2"} Nickname %span.asterisk> *
.field_wrap E-mail
%input#id_2.form-control{:type => "text", :value => "V@renyk"}/ .field_wrap
.form-group = f.input :email,label: false, class: 'form-control'
%label{:for => "id_3"} .form-group
%span.asterisk> * %label{:for => "id_5"}
E-mail Місто
.field_wrap .field_wrap
= f.input_field :email, class: 'form-control' = f.input :location, label: false,class: 'form-control'
.form-group .form-group
%label{:for => "id_4"} Facebook %label{:for => "id_5"}
.field_wrap %span.asterisk> *
%input#id_4.form-control{:type => "text", :value => "https://www.facebook.com/liubko.deresh"}/ Пароль
.form-group .field_wrap
%label{:for => "id_5"} = f.input :password, label: false, class: 'form-control'
Місто .form-group
.field_wrap %label{:for => "id_5"}
= f.input_field :location, class: 'form-control' %span.asterisk> *
.form-group Підтвердження паролю
%label{:for => "id_5"} .field_wrap
%span.asterisk> * = f.input :password_confirmation, label: false, class: 'form-control'
Пароль .form-group
.field_wrap %label{:for => "id_5"}
= f.password_field :password, class: 'form-control' Фото або лого
.form-group .field_wrap.upload_wrap
%label{:for => "id_5"} .upload_bot.clearfix
%span.asterisk> * = file_field :avatar, class: 'form-control'
Підтвердження паролю .upload_img
.field_wrap = image_tag url_for(user.avatar) if @user.avatar
= f.password_field :password_confirmation, class: 'form-control' .text-center
.form-group = f.submit "Оновити", class: 'btn btn-success btn-lg'
%label{:for => "id_5"}
Фото або лого
.field_wrap.upload_wrap
.upload_bot.clearfix
= file_field :avatar, class: 'form-control'
.upload_img
= image_tag url_for(user.avatar) if @user.avatar
.text-center
= f.submit "Оновити", class: 'btn btn-success btn-lg'
...@@ -33,3 +33,4 @@ ...@@ -33,3 +33,4 @@
= image_tag url_for(@user.avatar) = image_tag url_for(@user.avatar)
.text-center .text-center
= link_to 'Редагувати', edit_user_path, class: 'btn btn-success btn-lg' = link_to 'Редагувати', edit_user_path, class: 'btn btn-success btn-lg'
Rails.application.routes.draw do Rails.application.routes.draw do
root 'home#index' root 'home#index'
devise_for :users, controllers: {omniauth_callbacks: "users/omniauth_callbacks", devise_for :users, controllers: {omniauth_callbacks: "users/omniauth_callbacks",
registrations: "users"} registrations: "users", sessions: "users"}
resources :users resources :users
end end
...@@ -12540,7 +12540,7 @@ img.rsImg { ...@@ -12540,7 +12540,7 @@ img.rsImg {
padding-right: 119px; padding-right: 119px;
} }
.form_container .form-group { .form_container .form-group {
margin-bottom: 32px; margin-bottom: 10px;
} }
.form_container .checkbox { .form_container .checkbox {
margin-left: 171px; margin-left: 171px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment