Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
11f99bf1
Commit
11f99bf1
authored
2 years ago
by
luandalmazo
Committed by
ahcv19
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#10
: FIX email confirmation
parent
b29a20bd
No related branches found
No related tags found
2 merge requests
!17
Curatorship and Gamification done
,
!9
Issue/10 fix email confirmation task
Pipeline
#30074
failed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/v1/sessions_controller.rb
+3
-6
3 additions, 6 deletions
app/controllers/v1/sessions_controller.rb
app/models/user.rb
+5
-0
5 additions, 0 deletions
app/models/user.rb
lib/tasks/access.rake
+1
-0
1 addition, 0 deletions
lib/tasks/access.rake
with
9 additions
and
6 deletions
app/controllers/v1/sessions_controller.rb
+
3
−
6
View file @
11f99bf1
...
...
@@ -66,13 +66,10 @@ require 'open-uri'
#in case of the user is not confirmed, find the user and send an email confirmation
else
@user
=
User
.
find_by_email
(
params
[
:email
])
UserMailer
.
email_confirmation
(
@user
).
deliver_now
return
render_create_error_not_confirmed
end
else
puts
(
"Usuário não encontrado"
)
return
render_create_error_bad_credentials
end
...
...
@@ -82,7 +79,7 @@ require 'open-uri'
render
json:
{
success:
false
,
errors:
[
I18n
.
t
(
"devise.failure.unconfirmed"
)],
},
status:
4
0
1
},
status:
41
7
end
...
...
@@ -90,7 +87,7 @@ require 'open-uri'
render
json:
{
success:
false
,
errors:
[
I18n
.
t
(
"devise.sessions.banished"
)]
},
status:
40
1
},
status:
40
6
end
def
render_create_error_blocked
...
...
@@ -98,7 +95,7 @@ require 'open-uri'
success:
false
,
errors:
[
I18n
.
t
(
"devise.sessions.blocked"
)],
avaliable_at:
@resource
.
reactivated_at
},
status:
40
1
},
status:
40
6
end
def
reactivate_user?
...
...
This diff is collapsed.
Click to expand it.
app/models/user.rb
+
5
−
0
View file @
11f99bf1
...
...
@@ -139,6 +139,7 @@ class User < ApplicationRecord
after_create
:default_role
before_save
:verify_teacher_id
after_save
:verify_dspace_info
before_create
:send_email_confirmation
before_destroy
:delete_index
after_update
:create_actions
...
...
@@ -167,6 +168,10 @@ class User < ApplicationRecord
# don't versionate frequently changed fields
has_paper_trail
ignore:
[
:tokens
,
:sign_in_count
,
:current_sign_in_at
,
:last_sign_in_at
]
def
send_email_confirmation
UserMailer
.
email_confirmation
(
self
).
deliver_now
end
def
email_activate
self
.
email_confirmed
=
true
self
.
confirm_token
=
nil
...
...
This diff is collapsed.
Click to expand it.
lib/tasks/access.rake
+
1
−
0
View file @
11f99bf1
...
...
@@ -6,6 +6,7 @@ namespace :access do
User
.
all
.
each
do
|
user
|
if
user
.
created_at
<
base_date
user
.
update_attribute
(
:email_confirmed
,
true
)
user
.
update_attribute
(
:confirmed_at
,
Time
.
now
)
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment