mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Add a field for user email address
This commit is contained in:
parent
0ff46f63dc
commit
dbaa9a85cb
7 changed files with 18 additions and 3 deletions
|
|
@ -44,7 +44,7 @@ private
|
|||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:login, :first_name, :last_name, :password_confirmation, :password, :auth_type, :open_id_url)
|
||||
params.require(:user).permit(:login, :first_name, :last_name, :email, :password_confirmation, :password, :auth_type, :open_id_url)
|
||||
end
|
||||
|
||||
# Display notification if preferences are successful updated
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class UsersController < ApplicationController
|
|||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:login, :first_name, :last_name, :password_confirmation, :password, :auth_type, :open_id_url)
|
||||
params.require(:user).permit(:login, :first_name, :last_name, :email, :password_confirmation, :password, :auth_type, :open_id_url)
|
||||
end
|
||||
|
||||
def get_new_user
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ class User < ApplicationRecord
|
|||
validates_length_of :login, within: 3..80
|
||||
validates_uniqueness_of :login, on: :create
|
||||
validate :validate_auth_type
|
||||
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||
|
||||
before_create :crypt_password, :generate_token
|
||||
before_update :crypt_password
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
<div class="form-group">
|
||||
<%= pref_with_text_field 'user', 'last_name' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= pref_with_text_field 'user', 'email' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= pref_with_select_field('prefs', 'locale', I18n.available_locales.map {|l| l.to_s}) %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
<%= label_tag "user_login", t('users.desired_login') %>
|
||||
<%= text_field "user", "login", class: "form-control" %>
|
||||
</div>
|
||||
<div class="label-element-combo">
|
||||
<%= label_tag "user_email", t('users.email_address') %>
|
||||
<%= text_field "user", "email", class: "form-control" %>
|
||||
</div>
|
||||
<div class="label-element-combo">
|
||||
<%= label_tag "user_password", t('users.choose_password') %>
|
||||
<%= password_field "user", "password", class: "form-control" %>
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ en:
|
|||
user:
|
||||
auth_type: Auth type
|
||||
display_name: Display name
|
||||
email: Email address
|
||||
first_name: First name
|
||||
last_name: Last name
|
||||
login: Login
|
||||
|
|
@ -87,7 +88,7 @@ en:
|
|||
confirmation: doesn't match confirmation
|
||||
less_than_or_equal_to: must be less than or equal to %{count}
|
||||
blank: can't be blank
|
||||
invalid: "cannot contain the comma (',') character"
|
||||
invalid: "is not valid"
|
||||
exclusion: is reserved
|
||||
odd: must be odd
|
||||
even: must be even
|
||||
|
|
@ -961,6 +962,7 @@ en:
|
|||
change_password_prompt: Enter your new password in the fields below and click 'Change password' to replace your current password with your new one.
|
||||
password_confirmation_label: Confirm password
|
||||
destroy_error: There was an error deleting the user %{login}
|
||||
email_address: Email address
|
||||
choose_password: Choose password
|
||||
register_with_cas: With your CAS username
|
||||
label_auth_type: Authentication type
|
||||
|
|
|
|||
5
db/migrate/20200720151220_add_email_to_user.rb
Normal file
5
db/migrate/20200720151220_add_email_to_user.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddEmailToUser < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :users, :email, :string
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue