diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 9332d422..84d5a6cf 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -7,6 +7,10 @@ module Users protected + def after_inactive_sign_up_path_for(resource) + sign_in_path + end + def after_update_path_for(resource) signed_in_root_path(resource) end diff --git a/app/models/user.rb b/app/models/user.rb index 751d8bbe..7fc2aff0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,7 +17,7 @@ class User < ApplicationRecord has_many :following, class_name: 'Follow' - devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable + devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :registerable serialize :settings, UserPreference @@ -33,6 +33,7 @@ class User < ApplicationRecord validates :email, presence: true # done by devise validates :name, uniqueness: true # done by devise validates :email, uniqueness: true # done by devise + validates_format_of :email, with: /\@uts\.edu\.au/, message: ' must end with @uts.edu.au' # This method associates the attribute ":image" with a file attachment has_attached_file :image, styles: { diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index d464b733..0ce411cc 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -87,20 +87,6 @@ <% if current_user %> -
-

SHARE INVITE

- -
-

The Metamaps platform is currently in an invite-only beta with the express purpose of creating a high value knowledge ecosystem, a diverse community of contributors and a culture of collaboration and curiosity.

-

As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.

-

Below is a personal invite link containing your unique access code, which can be used multiple times.

-
-

<%= invite_link() %> - -

- -
-
<%= render :partial => 'shared/forkmap' %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 1ee406e7..2200bfaa 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -3,8 +3,8 @@ # /users/:id/edit # User edit form #%> - -<% content_for :title, @user.name + "'s Settings | Metamaps" %> + +<% content_for :title, @user.name + "'s Settings | Metamaps" %> <% content_for :mobile_title, "Account Settings" %>
<%= form_for @user, url: user_url, :html =>{ :multipart => true, :class => "edit_user centerGreyForm"} do |form| %> @@ -36,9 +36,8 @@ <%= form.label :name, "Name:", class: 'firstFieldText' %> <%= form.text_field :name %>
-
- <%= form.label :email, "Email:", class: 'firstFieldText' %> - <%= form.email_field :email %> +
+ Email: <%= @user.email %>
<%= form.label :emails_allowed, class: 'firstFieldText' do %> diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index 0368db01..0b05db71 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -6,7 +6,10 @@

Sign Up

-
Only email addresses at the uts.edu.au domain name will be able to register.
+
+ Only email addresses at the uts.edu.au domain name will be able to register. + All users must verify their email address. +
<%= f.label :name, "Name:", :class => "firstFieldText" %> <%= f.text_field :name, :autofocus => true %>
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 6740cdc9..cdba5caf 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -116,7 +116,7 @@ Devise.setup do |config| # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed new email is stored in # unconfirmed email column, and copied to email column on successful confirmation. - config.reconfirmable = true + config.reconfirmable = false # Defines which key will be used when confirming an account # config.confirmation_keys = [ :email ] diff --git a/db/migrate/20171016214309_add_confirmable_to_devise.rb b/db/migrate/20171016214309_add_confirmable_to_devise.rb new file mode 100644 index 00000000..4364309f --- /dev/null +++ b/db/migrate/20171016214309_add_confirmable_to_devise.rb @@ -0,0 +1,20 @@ +class AddConfirmableToDevise < ActiveRecord::Migration[5.0] + # Note: You can't use change, as User.update_all will fail in the down migration + def up + add_column :users, :confirmation_token, :string + add_column :users, :confirmed_at, :datetime + add_column :users, :confirmation_sent_at, :datetime + # add_column :users, :unconfirmed_email, :string # Only if using reconfirmable + add_index :users, :confirmation_token, unique: true + # User.reset_column_information # Need for some types of updates, but not for update_all. + # To avoid a short time window between running the migration and updating all existing + # users as confirmed, do the following + User.all.update_all confirmed_at: DateTime.now + # All existing user accounts should be able to log in after this. + end + + def down + remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at + # remove_columns :users, :unconfirmed_email # Only if using reconfirmable + end +end diff --git a/db/schema.rb b/db/schema.rb index 6a6d3097..3e6ffb29 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170903180840) do +ActiveRecord::Schema.define(version: 20171016214309) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -359,6 +359,10 @@ ActiveRecord::Schema.define(version: 20170903180840) do t.datetime "image_updated_at" t.integer "generation" t.boolean "emails_allowed", default: true + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree end diff --git a/frontend/src/components/AccountMenu.js b/frontend/src/components/AccountMenu.js index f23cda61..730c848e 100644 --- a/frontend/src/components/AccountMenu.js +++ b/frontend/src/components/AccountMenu.js @@ -28,14 +28,6 @@ class AccountMenu extends Component {
Admin -
  • -
    - Apps -
  • -
  • -
    - Share Invite -
  • Sign Out diff --git a/frontend/src/routes/App.js b/frontend/src/routes/App.js index 72338ef0..a2ae53ca 100644 --- a/frontend/src/routes/App.js +++ b/frontend/src/routes/App.js @@ -91,7 +91,6 @@ class App extends Component { openInviteLightbox={openInviteLightbox} signInPage={pathname === '/login'} />} - {!mobile && currentUser && } {children}
  • }