Add User#email uniq validation. Fixed confirmation for admin/users form
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
a389d77769
commit
4cd7a56333
3 changed files with 12 additions and 2 deletions
|
@ -47,7 +47,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|||
@user.admin = (admin && admin.to_i > 0)
|
||||
@user.created_by_id = current_user.id
|
||||
@user.generate_password
|
||||
@user.confirm!
|
||||
@user.skip_confirmation!
|
||||
|
||||
respond_to do |format|
|
||||
if @user.save
|
||||
|
|
|
@ -103,7 +103,7 @@ class User < ActiveRecord::Base
|
|||
# Validations
|
||||
#
|
||||
validates :name, presence: true
|
||||
validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }
|
||||
validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }, uniqueness: true
|
||||
validates :bio, length: { maximum: 255 }, allow_blank: true
|
||||
validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider}
|
||||
validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0}
|
||||
|
|
|
@ -43,6 +43,16 @@
|
|||
%span.light Member since:
|
||||
%strong
|
||||
= @user.created_at.stamp("Nov 12, 2031")
|
||||
- if @user.confirmed_at
|
||||
%li
|
||||
%span.light Confirmed at:
|
||||
%strong
|
||||
= @user.confirmed_at.stamp("Nov 12, 2031")
|
||||
- else
|
||||
%li
|
||||
%span.light Confirmed:
|
||||
%strong.cred
|
||||
No
|
||||
|
||||
%li
|
||||
%span.light Last sign-in at:
|
||||
|
|
Loading…
Reference in a new issue