Added new security question to sign up, Added notification for unconfirmed emails
• Added: - new security question to sign up - notification for unconfirmed emails - modal for describing issue with Gab emails
This commit is contained in:
@@ -74,8 +74,9 @@ class Api::BaseController < ApplicationController
|
||||
render json: { error: 'This method requires an authenticated user' }, status: 422
|
||||
elsif current_user.disabled?
|
||||
render json: { error: 'Your login is currently disabled' }, status: 403
|
||||
elsif !current_user.confirmed?
|
||||
render json: { error: 'Your login is missing a confirmed e-mail address' }, status: 403
|
||||
# : todo : when figure out email/catpcha, put this back
|
||||
# elsif !current_user.confirmed?
|
||||
# render json: { error: 'Your login is missing a confirmed e-mail address' }, status: 403
|
||||
elsif !current_user.approved?
|
||||
render json: { error: 'Your login is currently pending approval' }, status: 403
|
||||
else
|
||||
|
||||
@@ -18,6 +18,27 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
|
||||
render json: @account, serializer: REST::CredentialAccountSerializer
|
||||
end
|
||||
|
||||
def resend_email_confirmation
|
||||
@account = current_account
|
||||
|
||||
if !@account.user.confirmed?
|
||||
redisResult = Redis.current.get("account:#{@account.id}:last_email_confirmation_resend") || 0
|
||||
|
||||
@lastSentDate = redisResult
|
||||
if redisResult != 0
|
||||
@lastSentDate = Time.at(redisResult.to_i).utc
|
||||
end
|
||||
|
||||
if @lastSentDate == 0 || (@lastSentDate != 0 && Time.now.utc - @lastSentDate >= 1.hour)
|
||||
@user = Account.find(@account.id).user || raise(ActiveRecord::RecordNotFound)
|
||||
Redis.current.set("account:#{@account.id}:last_email_confirmation_resend", Time.now.utc.to_i)
|
||||
@user.resend_confirmation_instructions
|
||||
end
|
||||
end
|
||||
|
||||
render json: { success: true, message: 'ok' }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def account_params
|
||||
@@ -35,4 +56,5 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
|
||||
'setting_default_language' => source_params.fetch(:language, @account.user.setting_default_language),
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user