Fix #1406. Validate password only on create

This commit is contained in:
msdundar 2017-03-26 02:55:19 +03:00
parent a659cb615a
commit acbc7df96a
3 changed files with 4 additions and 3 deletions

View file

@ -53,7 +53,8 @@ class User < ActiveRecord::Base
scope :admin, -> { where(is_admin: true) }
validates :email, :password, :password_confirmation, presence: true
validates :email, presence: true
validates :password, :password_confirmation, presence: true, on: :create
validates :username,
uniqueness: {

View file

@ -7,7 +7,7 @@
Sign In
.panel-body
= semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= f.input :login
= f.input :login, label: "Username / Email"
= f.input :password
- if devise_mapping.rememberable?
%p.text-right.small

View file

@ -11,7 +11,7 @@
.control-label
= "Avatar"
= image_tag(@user.gravatar_url(size: '48'), title: "Yo #{@user.name}!", alt: '')
= link_to 'Change your avatar here', 'https://gravatar.com'
= link_to 'Change your avatar here', 'https://gravatar.com', target: :_blank
= f.input :affiliation, as: :string,
hint: 'This could be a company, a user group, or nothing at all.'
= f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' } },