Commit 4cd7a563 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add User#email uniq validation. Fixed confirmation for admin/users form

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a389d777
...@@ -47,7 +47,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -47,7 +47,7 @@ class Admin::UsersController < Admin::ApplicationController
@user.admin = (admin && admin.to_i > 0) @user.admin = (admin && admin.to_i > 0)
@user.created_by_id = current_user.id @user.created_by_id = current_user.id
@user.generate_password @user.generate_password
@user.confirm! @user.skip_confirmation!
respond_to do |format| respond_to do |format|
if @user.save if @user.save
......
...@@ -103,7 +103,7 @@ class User < ActiveRecord::Base ...@@ -103,7 +103,7 @@ class User < ActiveRecord::Base
# Validations # Validations
# #
validates :name, presence: true 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 :bio, length: { maximum: 255 }, allow_blank: true
validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider}
validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0}
......
...@@ -43,6 +43,16 @@ ...@@ -43,6 +43,16 @@
%span.light Member since: %span.light Member since:
%strong %strong
= @user.created_at.stamp("Nov 12, 2031") = @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 %li
%span.light Last sign-in at: %span.light Last sign-in at:
......
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