Updated code based on review
This commit is contained in:
@@ -61,7 +61,7 @@ feature -- Access: Consumers OAuth20
|
||||
feature -- Change: User Openid
|
||||
|
||||
|
||||
new_user_openid (a_identity: READABLE_STRING_GENERAL; a_user: CMS_USER; )
|
||||
new_user_openid (a_identity: READABLE_STRING_GENERAL; a_user: CMS_USER)
|
||||
-- Add a new user with openid using the identity `a_identity'.
|
||||
require
|
||||
has_id: a_user.has_id
|
||||
|
||||
@@ -35,7 +35,7 @@ feature -- Access
|
||||
endpoint: READABLE_STRING_8
|
||||
-- Url to authorize the user.
|
||||
|
||||
name: READABLE_STRING_32
|
||||
name: READABLE_STRING_8
|
||||
-- consumer name.
|
||||
|
||||
id: INTEGER_64
|
||||
|
||||
@@ -56,7 +56,7 @@ feature -- Basic Operations
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_welcome)
|
||||
l_message.replace_substring_all ("$link", a_content)
|
||||
send_message (contact_email, a_to, parameters.contact_subject_oauth, l_message)
|
||||
send_message (contact_email, a_to, parameters.contact_subject_register, l_message)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ feature {NONE} -- Initialization
|
||||
s: detachable READABLE_STRING_32
|
||||
l_contact_email, l_subject_register, l_subject_activate, l_subject_password, l_subject_oauth: detachable READABLE_STRING_8
|
||||
do
|
||||
setup := a_cms_api.setup
|
||||
cms_api := a_cms_api
|
||||
-- Use global smtp setting if any, otherwise "localhost"
|
||||
smtp_server := utf.escaped_utf_32_string_to_utf_8_string_8 (a_cms_api.setup.text_item_or_default ("smtp", "localhost"))
|
||||
l_site_name := utf.escaped_utf_32_string_to_utf_8_string_8 (a_cms_api.setup.site_name)
|
||||
@@ -71,23 +71,6 @@ feature {NONE} -- Initialization
|
||||
else
|
||||
contact_subject_register := "Thank you for registering with us."
|
||||
end
|
||||
|
||||
if l_subject_activate /= Void then
|
||||
contact_subject_activate := l_subject_activate
|
||||
else
|
||||
contact_subject_activate := "New account activation token."
|
||||
end
|
||||
if l_subject_password /= Void then
|
||||
contact_subject_password := l_subject_password
|
||||
else
|
||||
contact_subject_password := "Password Recovery."
|
||||
end
|
||||
if l_subject_oauth /= Void then
|
||||
contact_subject_oauth := l_subject_oauth
|
||||
else
|
||||
contact_subject_oauth := "Welcome."
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -100,9 +83,6 @@ feature -- Access
|
||||
-- Contact email.
|
||||
|
||||
contact_subject_register: IMMUTABLE_STRING_8
|
||||
contact_subject_activate: IMMUTABLE_STRING_8
|
||||
contact_subject_password: IMMUTABLE_STRING_8
|
||||
contact_subject_oauth: IMMUTABLE_STRING_8
|
||||
|
||||
account_activation: STRING
|
||||
-- Account activation template email message.
|
||||
@@ -133,7 +113,7 @@ feature {NONE} -- Implementation: Template
|
||||
template_path (a_name: READABLE_STRING_GENERAL): PATH
|
||||
-- Location of template named `a_name'.
|
||||
do
|
||||
Result := setup.environment.config_path.extended ("modules").extended ("login").extended (a_name)
|
||||
Result := cms_api.module_location_by_name ({CMS_AUTHENTICATION_MODULE}.name).extended (a_name)
|
||||
end
|
||||
|
||||
template_string (a_name: READABLE_STRING_GENERAL; a_default: STRING): STRING
|
||||
@@ -151,7 +131,7 @@ feature {NONE} -- Implementation: Template
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
setup: CMS_SETUP
|
||||
cms_api: CMS_API
|
||||
|
||||
read_template_file (a_path: PATH): detachable STRING
|
||||
-- Read the content of the file at path `a_path'.
|
||||
|
||||
@@ -90,8 +90,6 @@ feature {CMS_API} -- Module Initialization
|
||||
feature {CMS_API} -- Module management
|
||||
|
||||
install (api: CMS_API)
|
||||
local
|
||||
l_consumers: LIST [STRING]
|
||||
do
|
||||
-- Schema
|
||||
if attached {CMS_STORAGE_SQL_I} api.storage as l_sql_storage then
|
||||
@@ -126,8 +124,8 @@ feature -- Filters
|
||||
filters (a_api: CMS_API): detachable LIST [WSF_FILTER]
|
||||
-- Possibly list of Filter's module.
|
||||
do
|
||||
create {ARRAYED_LIST [WSF_FILTER]} Result.make (1)
|
||||
if attached user_openid_api as l_user_openid_api then
|
||||
create {ARRAYED_LIST [WSF_FILTER]} Result.make (1)
|
||||
Result.extend (create {CMS_OPENID_FILTER}.make (a_api, l_user_openid_api))
|
||||
end
|
||||
end
|
||||
@@ -263,7 +261,7 @@ feature -- Hooks
|
||||
create o.make (req.absolute_script_url ("/account/login-with-openid"))
|
||||
o.ask_email (True)
|
||||
o.ask_all_info (False)
|
||||
if attached o.auth_url (p_openid.as_readable_string_8) as l_url then
|
||||
if attached o.auth_url (p_openid) as l_url then
|
||||
r.set_redirection (l_url)
|
||||
else
|
||||
s.append (" Failure")
|
||||
|
||||
Reference in New Issue
Block a user