- Implement AccountActivationsController for activation logic - Create UserMailer for sending activation emails - Update SessionsController to handle unactivated users - Modify UsersController to restrict access to activated users - Add activation fields to User model and database migration - Create views for account activation emails - Add tests for account activation functionality
30 lines
1.1 KiB
Ruby
30 lines
1.1 KiB
Ruby
# This file should ensure the existence of records required to run the application in every environment (production,
|
|
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
|
|
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
|
#
|
|
# Example:
|
|
#
|
|
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
|
|
# MovieGenre.find_or_create_by!(name: genre_name)
|
|
# end
|
|
|
|
User.create!(name: "Example User",
|
|
email: "example@example.com",
|
|
password: "foobar",
|
|
password_confirmation: "foobar",
|
|
admin: true,
|
|
activated: true,
|
|
activated_at: Time.zone.now)
|
|
|
|
99.times do |n|
|
|
name = Faker::Name.name
|
|
email = "example-#{n+1}@railstutorial.org"
|
|
password = "password"
|
|
User.create!(name: name,
|
|
email: email,
|
|
password: password,
|
|
password_confirmation: password,
|
|
activated: true,
|
|
activated_at: Time.zone.now)
|
|
end
|