Added CMS_USER.utf_8_name: STRING_8 for convenience.
Added a permission check for registering (TODO: by default allow visitor to register). Cosmetic.
This commit is contained in:
@@ -81,6 +81,16 @@ feature -- Access
|
||||
-- trashed
|
||||
|
||||
|
||||
feature -- Access: helper
|
||||
|
||||
utf_8_name: STRING_8
|
||||
-- UTF-8 version of `name'.
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
Result := utf.utf_32_string_to_utf_8_string_8 (name)
|
||||
end
|
||||
|
||||
feature -- Roles
|
||||
|
||||
roles: detachable LIST [CMS_USER_ROLE]
|
||||
|
||||
@@ -164,6 +164,7 @@ feature -- Handler
|
||||
l_token: STRING
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
if r.has_permission ("account register") then
|
||||
r.set_value ("Register", "optional_content_type")
|
||||
if req.is_post_request_method then
|
||||
if
|
||||
@@ -175,12 +176,12 @@ feature -- Handler
|
||||
|
||||
if attached l_user_api.user_by_name (l_name.value) then
|
||||
-- Username already exist.
|
||||
r.values.force ("The user name exist!", "error_name")
|
||||
r.values.force ("User name already exists!", "error_name")
|
||||
l_exist := True
|
||||
end
|
||||
if attached l_user_api.user_by_email (l_email.value) then
|
||||
-- Emails already exist.
|
||||
r.values.force ("The email exist!", "error_email")
|
||||
r.values.force ("An account is already associated with that email address!", "error_email")
|
||||
l_exist := True
|
||||
end
|
||||
|
||||
@@ -212,6 +213,9 @@ feature -- Handler
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
end
|
||||
|
||||
r.execute
|
||||
end
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MODULE_API}."
|
||||
description: "Common ancestor for all module apis."
|
||||
date: "$Date: 2015-02-13 14:54:27 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96620 $"
|
||||
|
||||
deferred class
|
||||
CMS_MODULE_API
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_api: CMS_API)
|
||||
do
|
||||
@@ -28,4 +28,7 @@ feature {CMS_API_ACCESS, CMS_MODULE, CMS_API} -- Restricted access
|
||||
Result := cms_api.storage
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user