Compare commits
19 Commits
jfiat_mast
...
jfiat_2016
| Author | SHA1 | Date | |
|---|---|---|---|
| 9060025e1c | |||
| d18c7c9ad5 | |||
| e1d6e79f09 | |||
| 53181f901d | |||
|
|
4b04e5f471 | ||
|
|
e1a657a880 | ||
|
|
40fd1df648 | ||
|
|
ddb3f9474a | ||
|
|
7896036165 | ||
|
|
7e9c29f277 | ||
|
|
e1ae9f9eec | ||
|
|
52b9ed277c | ||
|
|
5e55a6f1f1 | ||
|
|
f439a791a9 | ||
|
|
85dfc45f8b | ||
|
|
e573d9da41 | ||
|
|
53cb73ca5a | ||
|
|
7f26b9feb3 | ||
|
|
948b4b3456 |
1
ROC
Submodule
1
ROC
Submodule
Submodule ROC added at ec53a2682b
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
|
||||
<target name="cms">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
|
||||
6
cms.ecf
6
cms.ecf
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
|
||||
<description>ROC CMS library</description>
|
||||
<target name="cms">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="false" void_safety="none" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
<option debug="true" warning="true" full_class_checking="false" is_attached_by_default="true" is_obsolete_routine_type="true" void_safety="all" syntax="transitional">
|
||||
<debug name="dbglog" enabled="true"/>
|
||||
</option>
|
||||
<setting name="executable_name" value="demo"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false">
|
||||
@@ -24,31 +23,29 @@
|
||||
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_blog_module" location="..\..\modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_contact_module" location="..\..\modules\contact\contact-safe.ecf" readonly="false"/>
|
||||
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_email_service" location="..\..\library\email\email-safe.ecf" readonly="false"/>
|
||||
<library name="cms_feed_aggregator_module" location="..\..\modules\feed_aggregator\feed_aggregator-safe.ecf" readonly="false"/>
|
||||
<library name="cms_files_module" location="..\..\modules\files\files-safe.ecf" readonly="false"/>
|
||||
<library name="cms_file_uploader" location="..\..\modules\file_upload\file_uploader.ecf" readonly="false"/>
|
||||
<library name="cms_google_search_module" location="..\..\modules\google_search\google_search-safe.ecf" readonly="false" use_application_options="true"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
|
||||
<library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
|
||||
<library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/>
|
||||
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/>
|
||||
<library name="cms_seo_module" location="..\..\modules\seo\seo-safe.ecf" readonly="false"/>
|
||||
<library name="cms_session_auth_module" location="..\..\modules\session_auth\cms_session_auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_taxnomy_module" location="..\..\modules\taxonomy\taxonomy-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false"/>
|
||||
<!--
|
||||
By default, commented, since it depends on specific environment settings.
|
||||
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false">
|
||||
<option>
|
||||
<assertions/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf"/>
|
||||
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" />
|
||||
-->
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
</target>
|
||||
<target name="demo_any" extends="common">
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="any_launcher" location="..\..\launcher\any-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -6,14 +6,10 @@ set ROC_CMS_DIR=%~dp0
|
||||
%ROC_CMD% install --module ..\..\modules\auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\basic_auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\blog --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\contact --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\feed_aggregator --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\google_search --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\node --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\oauth20 --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\openid --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\recent_changes --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\seo --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\session_auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\feed_aggregator --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\google_search --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\taxonomy --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\files --dir %ROC_CMS_DIR%
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cms_demo_module" uuid="4BB59A54-2544-4C10-BFA6-01D12E541A30" library_target="cms_demo_module">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="cms_demo_module" uuid="4BB59A54-2544-4C10-BFA6-01D12E541A30" library_target="cms_demo_module">
|
||||
<target name="cms_demo_module">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
@@ -21,3 +21,4 @@
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
|
||||
@@ -70,9 +70,8 @@ CREATE TABLE tb_demo(
|
||||
api.logger.put_error ("Could not initialize database for demo module", generating_type)
|
||||
end
|
||||
end
|
||||
Precursor {CMS_MODULE}(api)
|
||||
end
|
||||
-- For this demo, be flexible, and do not required sql.
|
||||
Precursor {CMS_MODULE}(api)
|
||||
end
|
||||
|
||||
feature -- Access: router
|
||||
@@ -152,7 +151,7 @@ feature -- Mapping helper: uri template
|
||||
|
||||
feature -- Mapping helper: uri template agent
|
||||
|
||||
map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [WSF_REQUEST, WSF_RESPONSE]; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
-- Map `proc' as handler for `a_tpl' for request methods `rqst_methods'.
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
|
||||
@@ -4,36 +4,14 @@ root-dir=site/www
|
||||
#modules-dir=site/modules
|
||||
|
||||
[site]
|
||||
# General token that could be use for cookies, and related.
|
||||
id=_EIFFEL_CMS_
|
||||
|
||||
# Name of the site, for the title, and eventual message.
|
||||
name=Eiffel CMS
|
||||
|
||||
# Properties used for SEO.
|
||||
property[headline]=Eiffel CMS -- the demo
|
||||
property[description]=Demo for Eiffel ROC CMS.
|
||||
property[keywords]=eiffel,cms,demo
|
||||
|
||||
# Email used for notification
|
||||
email=noreply@example.com
|
||||
|
||||
# Name of website theme.
|
||||
email=your@email.com
|
||||
theme=bootstrap
|
||||
|
||||
[notification]
|
||||
# By default, notification.email = site.email
|
||||
# you can change here the email that will receive internal messages.
|
||||
email=webmaster@example.com
|
||||
|
||||
[mailer]
|
||||
#The mailer is used mostly used by the CMS to send email messages.
|
||||
# you can change the "From:" by setting mailer.from value"
|
||||
subject_prefix=[Eiffel CMS]
|
||||
#from=...
|
||||
smtp=localhost:25
|
||||
#sendmail=site\bin\roc_sendmail.bat
|
||||
output=site\db\mailer.log
|
||||
#smtp=localhost:25
|
||||
#sendmail=/usr/bin/sendmail
|
||||
output=@stderr
|
||||
|
||||
[modules]
|
||||
# Module status
|
||||
@@ -47,14 +25,6 @@ output=site\db\mailer.log
|
||||
[blocks]
|
||||
@include=blocks.ini
|
||||
|
||||
[auth]
|
||||
# token, default is $site.id or built-in.
|
||||
#token=_ROC_AUTH_TOKEN_
|
||||
#session.token=
|
||||
#session.max_age=86400
|
||||
#openid.token=
|
||||
#oauth.token=
|
||||
|
||||
[admin]
|
||||
# CMS Installation, are accessible by "all", "none" or uppon "permission". (default is none)
|
||||
installation_access=all
|
||||
|
||||
BIN
examples/demo/site/database.sqlite3
Normal file
BIN
examples/demo/site/database.sqlite3
Normal file
Binary file not shown.
@@ -0,0 +1,79 @@
|
||||
<!-- Updated: 12/04/2015 12:30:04.000 AM --><div class="feed">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/-jtyp4iengE">Re: [eiffel-users] Precompile on Linux</a>
|
||||
<div class="description">Hi, I just check if the .ecf files are in /usr/share/eiffelstudio-MM.mm/precomp/spec/unix and they are. When I look in the "Locations of configuration files" dialog in EiffelStudio, I see this: # Search paths for precompiled libraries are specified in the configuration file: # /usr/share/ei</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/-jtyp4iengE">RE: [eiffel-users] Precompile on Linux</a>
|
||||
<div class="description">This is a bug in the Unix layout then. Do you mind submitting a problem report? Thanks, Manu *From:* eiffel...@googlegroups.com [mailto:eiffel...@googlegroups.com] *On Behalf Of *Louis *Sent:* Tuesday, December 08, 2015 23:02 *To:* eiffel...@googlegroups.com *Subject:* Re: [eiffel-users]</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">Re: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">Not really. What I need to know is when I run tests on the performance and suitability for use of EiffelBase2, do I have to repeat them with all of ES versions 15.01, 15.08 and 15.11? On 8 December 2015 at 13:52, Jocelyn Fiat <jf...@eiffelsolution.com> wrote: > As the author of EiffelBase2 does</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">RE: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">In this particular case, it is sufficient to take any version of EiffelStudio and the EiffelBase2 version that comes with it to evaluate EiffelBase2 as the library has not really changed much in the past few years. In the general case, you should stick to one version of EiffelStudio and</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">Re: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">But this doesn't answer my question. Which version of EiffelBase2 ships with which version of EiffelStudio? On 8 December 2015 at 13:05, Jocelyn Fiat <jf...@eiffel.com> wrote: > Hi all, > > Usually the version uploaded to iron server comes from the associated > branch > for instance > > - 15.01</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">Re: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">Hi all, Usually the version uploaded to iron server comes from the associated branch for instance - 15.01 has almost same content as https://svn.eiffel.com/eiffelstudio/branches/Eiffel_15.01/ - ... I said "almost" because, the ecf are modified to use iron references rather than $ISE_LIBRARY/...</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">Re: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">As the author of EiffelBase2 does not define any specific versions, I would say - EiffelStudio 14.05 ships EiffelBase2 version 14.05, and associated source code can be found at https://svn.eiffel.com/eiffelstudio/branches/Eiffel_14.05/Src/unstable/library/base2/ (last changed revision: 94979)</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/-jtyp4iengE">RE: [eiffel-users] Precompile on Linux</a>
|
||||
<div class="description">We currently only ship precompiled libraries for EiffelBase, WEL on Windows and EiffelVision2. The configuration files for those precompiled library are in a read-only folder of the EiffelStudio installation. The first time EiffelStudio tries to access $ISE_PRECOMP (which if not set resolves to</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/ddSxnBrvhUg">Re: [eiffel-users] Re: Version of EiffelBase2 shipped with different EiffelStudio versions</a>
|
||||
<div class="description">Come on - someone must know - the person who loaded it to iron, e.g. On 7 December 2015 at 12:03, Colin Adams <colinpa...@gmail.com> wrote: > I know what EiffelBase2 is. I was asking about the version in the iron > repository for each version of EiffelStudio. > > On 7 December 2015 at 11:59,</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/Vwsw67vq6ss">Re: Explaining high-level programming</a>
|
||||
<div class="description">A very interesting article Ian. I learned more by reading it. However, the title leads me to ask: Who (precisely) is the target audience to whom the plea is being made? From my point of view, I cannot see this audience, so I am asking for your view to help me identify the audience. Thanks,</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/Vwsw67vq6ss">Explaining high-level programming</a>
|
||||
<div class="description">On 4 Dec 2015, at 00:24, Bertrand Meyer <Bertran...@inf.ethz.ch> wrote: 3. The community should help spread Eiffel. The last point is particularly important. The user community needs to grow; if it moves up to the next level then we at Eiffel Software will be able to perform many more</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 08</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/-jtyp4iengE">Precompile on Linux</a>
|
||||
<div class="description">Recently I installed EiffelStudio 15.08 on my Xubuntu laptop, with an assist from Louis M who showed me how to install it using apt-get. In the past, after extracting everything in the .tar.bz archive, I would run the supplied precompile script to produce the precompiled libraries I needed. The</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 07</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/4BS09rbY6UY">RE: [eiffel-users] Maximum capacity of a TUPLE</a>
|
||||
<div class="description">If you are looking at TUPLE with more than 20 entries, I think I would consider using LIST or ARRAY for storing data. The issue is not so much on the TUPLE capacity (which has the same limit as a SPECIAL object) but on the number of class types any type declaration. This is a limit for all</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 07</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/YgyWglEEN3A">Re: [eiffel-users] Does {MEMORY}.collection_off reset the progress of the garbage collector?</a>
|
||||
<div class="description">Thanks, that was what I was looking for.</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Dec 07</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/4BS09rbY6UY">Maximum capacity of a TUPLE</a>
|
||||
<div class="description">The header comment to {TUPLE}.plus says the result can be Void if the result exceeds the capacity of a TUPLE. What is this maximum capacity? (without knowing it is is impossible to prove the result of such a concatenation will be attached).</div>
|
||||
</li>
|
||||
<liv class="nav"><a href="/feed_aggregation/forum">See more ...</a></li>
|
||||
</ul>
|
||||
@@ -0,0 +1,29 @@
|
||||
<!-- Updated: 01/10/2016 12:50:45.000 PM --><div class="feed">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="date"> Jan 11</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/mCVwJQ21QBA">SCOOP & Contracts</a>
|
||||
<div class="description">Recently, I was reading a research paper from a Canadian university talking about applying something like SCOOP to Java. Because Java does not have Design-by-Contract, they wanted to build in a new keyword (like "require") called "await". From the writers point of view, the require contract was</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Jan 11</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/7HR-z0DVklU">General Question: Object Persistence Mechanism</a>
|
||||
<div class="description">NEED: An innate, compiler-known, object persistence mechanism, whereby objects are tracked for version (at design-time), version-updating (at run-time comparative between memory object and persisted object), and attribute change auto-persist. What would be nice is something akin to the Design-by</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Jan 11</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/BouQ6JU-fQ4">RE: [eiffel-users] Solving OOSC 2/E E7.3</a>
|
||||
<div class="description">In addition to Colin's reply, "is" is no longer used, as it is unnecessary. The functions sqrt and atan are in classes SINGLE_MATH or DOUBLE_MATH which are interfaces to the C library functions defined in math.h. Peter Horan -----Original Message----- From: eiffel...@googlegroups.com</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Jan 11</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/BouQ6JU-fQ4">Re: [eiffel-users] Solving OOSC 2/E E7.3</a>
|
||||
<div class="description">The indexing clause has been replaced by the note clause (just a change of keyword). You might try changing the configuration to use transitional syntax instead of standard syntax. On 11 January 2016 at 09:46, <sagyo1...@gmail.com> wrote: > Hi, everyone. > > I'm reading the japanese version of</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date"> Jan 11</div>
|
||||
<a href="https://groups.google.com/d/topic/eiffel-users/BouQ6JU-fQ4">Solving OOSC 2/E E7.3</a>
|
||||
<div class="description">Hi, everyone. I'm reading the japanese version of Object-Oriented Software Construction 2/E. I tried to build the code of "7.5.4 class" in EiffelStudio 15.11 and it raises some build errors. My question is: 1) Is the "indexing description:" description disposed? 2) Is the "function: syntax</div>
|
||||
</li>
|
||||
<liv class="nav"><a href="/feed_aggregation/forum">See more ...</a></li>
|
||||
</ul>
|
||||
@@ -0,0 +1,138 @@
|
||||
<!-- Updated: 01/10/2016 12:50:45.000 PM --><div class="feed">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="date">2015, Nov 17</div>
|
||||
<a href="https://room.eiffel.com/blog/colinadams/some_lazy_data_structures_implemented_in_eiffel_part_i_iterating_the_calkinwilf_tree">Some lazy data structures implemented in Eiffel - Part I - Iterating the Calkin-Wilf tree</a>
|
||||
<div class="description"><p>This is the first part of a series in which I intend to make some explorations of lazy, infinite data structures in Eiffel. If you want to compile the code in these articles, you will need EiffelStudio 15.11 or later.
|
||||
</p><p>In this first article, I am going to iterate an infinite data structure - the strictly-positive rational numbers, represented by an infinite tree - <a href="https://en.wikipedia.org/wiki/Calkin%E2%80%93Wilf_tree" class="external text" title="https://en.wikipedia.org/wiki/Calkin%E2%80%93Wilf_tree">The Calkin-Wilf tree</a>. The easiest way to follow the code is to view it directly on <a href="https://github.com/colin-adams/lazy_eiffel" class="external text" title="https://github.com/colin-adams/lazy_eiffel">GitHub</a>. An alternative is to checkout the repository and compile it in EiffelStudio. To do the latter (instructions are for Linux from a bash terminal, but should be similar for other O/S I think):
|
||||
</p>
|
||||
<ol><li> git clone git@github.com:colin-adams/lazy_eiffel.git
|
||||
</li><li> git checkout V1
|
||||
</li><li> cd lazy_eiffel/examples/calkin_wilf/src
|
||||
</li><li> estudio calkin_wilf.ecf &
|
||||
</li><li> Press OK
|
||||
</li></ol>
|
||||
<p>The first class worth looking at briefly is <span class="geshifilter"><code class="eiffel geshifilter-eiffel">LAZY_BINARY_TREE</code></span>. This represents a single node in an infinite binary tree, together with a link to it's parent, and two <span class="geshifilter"><code class="eiffel geshifilter-eiffel"><a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+function&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">FUNCTION</span></a></code></span>s to find the left and right children. Incidentally, you may be surprised at the syntax used for declaring these <span class="geshifilter"><code class="eiffel geshifilter-eiffel"><a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+function&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">FUNCTION</span></a></code></span>s unless you have already read <a href="https://groups.google.com/forum/#!topic/eiffel-users/poTM7aUIa4I" class="external text" title="https://groups.google.com/forum/#!topic/eiffel-users/poTM7aUIa4I">this thread</a>. This is why 15.11 or later is needed to compile the code. I think it's worth showing one of those agents here:
|
||||
</p><p><div class="geshifilter"><div class="eiffel geshifilter-eiffel" style="font-family:monospace;"> left_child_function<span style="color: #600000;">:</span> <a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+function&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">FUNCTION</span></a> <span style="color: #FF0000;">[</span>LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>G<span style="color: #FF0000;">]</span>, LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>G<span style="color: #FF0000;">]</span><span style="color: #FF0000;">]</span></div></div>
|
||||
</p><p>This syntax is starting to look lightweight. Looking quite comparable to Haskell, for example (<span class="geshifilter"><code class="text geshifilter-text">leftChildFunction :: LazyBinaryTree a -> LazyBinaryTree a</code></span>), and none of that horrible camelCase.
|
||||
</p><p>Then let's look at the <span class="geshifilter"><code class="eiffel geshifilter-eiffel">CALKIN_WILF</code></span> tree itself. The core of the class is a root node, two functions to navigate from any node in the tree to the left and right children (or to lazily build the tree structure, depending on how you want to look at it), and a creation procedure to initialize root to 1/1.
|
||||
</p><p><div class="geshifilter"><div class="eiffel geshifilter-eiffel" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">feature</span> <span style="color: #FF0000;">{</span><a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+none&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">NONE</span></a><span style="color: #FF0000;">}</span> <span style="color: #008000; font-style: italic;">-- Initialization</span><br />
|
||||
<br />
|
||||
make<br />
|
||||
<span style="color: #008000; font-style: italic;">-- Create `root'.</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">do</span><br />
|
||||
left_child_agent<6E><span style="color: #600000;">:=</span> <span style="color: #0600FF; font-weight: bold;">agent</span> left_child<br />
|
||||
right_child_agent<6E><span style="color: #600000;">:=</span> <span style="color: #0600FF; font-weight: bold;">agent</span> right_child<br />
|
||||
<span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #603000;">root</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><span style="color: #FF0000;">(</span><span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #FF0000;">{</span>RATIONAL_NUMBER<span style="color: #FF0000;">}</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">1</span><span style="color: #FF0000;">)</span><span style="color: #FF0000;">)</span>, <span style="color: #800080;">Void</span>, left_child_agent, right_child_agent<span style="color: #FF0000;">)</span><br />
|
||||
start<br />
|
||||
<span style="color: #0600FF; font-weight: bold;">end</span><br />
|
||||
<br />
|
||||
<span style="color: #0600FF; font-weight: bold;">feature</span> <span style="color: #008000; font-style: italic;">-- Access</span><br />
|
||||
<br />
|
||||
<span style="color: #603000;">root</span><span style="color: #600000;">:</span> LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><br />
|
||||
<span style="color: #008000; font-style: italic;">-- 1/1</span><br />
|
||||
<br />
|
||||
left_child_agent<span style="color: #600000;">:</span> <a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+function&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">FUNCTION</span></a> <span style="color: #FF0000;">[</span>LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span>, LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">]</span><br />
|
||||
<span style="color: #008000; font-style: italic;">-- Function from a node to its left child</span><br />
|
||||
<br />
|
||||
right_child_agent<span style="color: #600000;">:</span> <a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+function&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">FUNCTION</span></a> <span style="color: #FF0000;">[</span>LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span>, LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">]</span><br />
|
||||
<span style="color: #008000; font-style: italic;">-- Function from a node to its left child</span><br />
|
||||
<br />
|
||||
left_child <span style="color: #FF0000;">(</span>a_node<span style="color: #600000;">:</span> LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">)</span><span style="color: #600000;">:</span> LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><br />
|
||||
<span style="color: #008000; font-style: italic;">-- Left child of `a_node'</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">do</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #800080;">Result</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #FF0000;">{</span>RATIONAL_NUMBER<span style="color: #FF0000;">}</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><br />
|
||||
a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">numerator</span>, a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">numerator</span> <span style="color: #600000;">+</span> a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">denominator</span><span style="color: #FF0000;">)</span>,<br />
|
||||
a_node, left_child_agent, right_child_agent<span style="color: #FF0000;">)</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">end</span><br />
|
||||
<br />
|
||||
right_child <span style="color: #FF0000;">(</span>a_node<span style="color: #600000;">:</span> LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">)</span><span style="color: #600000;">:</span> LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><br />
|
||||
<span style="color: #008000; font-style: italic;">-- Right child of `a_node'</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">do</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #800080;">Result</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><span style="color: #0600FF; font-weight: bold;">create</span> <span style="color: #FF0000;">{</span>RATIONAL_NUMBER<span style="color: #FF0000;">}</span>.<span style="color: #000060;">make</span> <span style="color: #FF0000;">(</span><br />
|
||||
a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">numerator</span> <span style="color: #600000;">+</span> a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">denominator</span>, a_node.<span style="color: #000060;">item</span>.<span style="color: #000060;">denominator</span><span style="color: #FF0000;">)</span>,<br />
|
||||
a_node, left_child_agent, right_child_agent<span style="color: #FF0000;">)</span><br />
|
||||
<span style="color: #0600FF; font-weight: bold;">end</span></div></div>
|
||||
</p><p>However, I muddled this nice little picture by inheriting from <span class="geshifilter"><code class="eiffel geshifilter-eiffel"><a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+linear&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">LINEAR</span></a> <span style="color: #FF0000;">[</span>LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">]</span></code></span>. So the class <span class="geshifilter"><code class="eiffel geshifilter-eiffel">CALKIN_WILF</code></span> <em>has</em> a lazy tree of rationals, and <em>is</em> a linear iteration of them. In the root class <span class="geshifilter"><code class="eiffel geshifilter-eiffel">CALKIN_WILF_DEMO_ROOT</code></span> we simply print the first 100 rational numbers (I could have made the program take an argument) using a <span class="geshifilter"><code class="eiffel geshifilter-eiffel"><a href="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+linear_iterator&btnI=I%27m+Feeling+Lucky"><span style="color: #800000">LINEAR_ITERATOR</span></a> <span style="color: #FF0000;">[</span>LAZY_BINARY_TREE <span style="color: #FF0000;">[</span>RATIONAL_NUMBER<span style="color: #FF0000;">]</span><span style="color: #FF0000;">]</span></code></span>. However, the iteration is <em>not</em> in numerical order. In a future post we'll see other ways of iterating the rationals.
|
||||
</p><p>The really interesting thing (to me) about the Calkin-Wilf tree is the way I did a breadth-first traversal of this infinite tree. It turns out that the index in the linear structure, when translated into binary, can be considered as a set of instructions to move through the tree. You ignore all leading zeros. At the first one, move to the root. Then every time you see a zero, you take the left child, and every time you see a one, you take the right child. Lovely!
|
||||
</p></div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date">2015, Sep 15</div>
|
||||
<a href="http://feedproxy.google.com/~r/BertrandMeyer/~3/vAyEwWESHTY/">Design by Contract: ACM Webinar this Thursday</a>
|
||||
<div class="description"><p>A third ACM webinar this year (after two on agile methods): I will be providing a general introduction to Design by Contract. The date is this coming Thursday, September 17, and the time is noon New York (18 Paris/Zurich, 17 London, 9 Los Angeles, see here for hours elsewhere). Please tune in! The event is […]</p>
|
||||
<p>The post <a rel="nofollow" href="https://bertrandmeyer.com/2015/09/15/design-by-contract-acm-webinar-this-thursday/">Design by Contract: ACM Webinar this Thursday</a> appeared first on <a rel="nofollow" href="https://bertrandmeyer.com">Bertrand Meyer's technology+ blog</a>.</p></div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date">2015, Jan 21</div>
|
||||
<a href="http://feedproxy.google.com/~r/BertrandMeyer/~3/zNoU82qSoBU/">Framing the frame problem (new paper)</a>
|
||||
<div class="description"><p>Among the open problems of verification, particularly the verification of object-oriented programs, one of the most vexing is framing: how to specify and verify what programs element do not change. Continuing previous work, this article presents a “double frame inference” method, automatic on both sides the specification and verification sides. There is no need to […]</p>
|
||||
<p>The post <a rel="nofollow" href="https://bertrandmeyer.com/2015/01/21/framing-the-frame-problem-new-paper/">Framing the frame problem (new paper)</a> appeared first on <a rel="nofollow" href="https://bertrandmeyer.com">Bertrand Meyer's technology+ blog</a>.</p></div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date">2015, Jan 21</div>
|
||||
<a href="http://feedproxy.google.com/~r/BertrandMeyer/~3/gYfn3TjKVzA/">Detecting deadlock automatically? (New paper)</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="date">2015, Jan 11</div>
|
||||
<a href="https://room.eiffel.com/blog/conaclos/a_colored_year_on_the_web_for_eiffel">A colored year on the web for Eiffel</a>
|
||||
<div class="description"><p>Happy new year!
|
||||
</p><p>ACE, Prism, and Rouge now support the syntax highlighting of the Eiffel language.
|
||||
</p>
|
||||
<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><strong>Contents</strong></div>
|
||||
<div id="tocbody">
|
||||
<ul>
|
||||
<li class="toclevel-1"><a href="#Prism"><span class="tocnumber">1</span> <span class="toctext">Prism</span></a></li>
|
||||
<li class="toclevel-1"><a href="#ACE_editor"><span class="tocnumber">2</span> <span class="toctext">ACE editor</span></a></li>
|
||||
<li class="toclevel-1"><a href="#Rouge"><span class="tocnumber">3</span> <span class="toctext">Rouge</span></a></li>
|
||||
<li class="toclevel-1"><a href="#Other_syntax_highlighters"><span class="tocnumber">4</span> <span class="toctext">Other syntax highlighters</span></a></li>
|
||||
</ul></div>
|
||||
</td></tr></table><a name="Prism"></a><h2> <span class="mw-headline"> Prism </span></h2>
|
||||
<p><a href="http://prismjs.com/" class="external text" title="http://prismjs.com/">Prism</a> is by-design a lightweight syntax highlighter for the web.
|
||||
It is very simple to use, and the <a href="http://prismjs.com/download.html" class="external text" title="http://prismjs.com/download.html">download page</a> enables to get only what you need. It proposes interesting add-ons (Line numbers, File Highlight, ...).
|
||||
</p><p>The library is usable with a bench of tools, including <a href="https://wordpress.org/" class="external text" title="https://wordpress.org/">Wordpress</a> and <a href="http://jekyllrb.com/" class="external text" title="http://jekyllrb.com/">Jekyll</a>.
|
||||
</p><p>You can test the highlighting <a href="http://prismjs.com/test.html" class="external text" title="http://prismjs.com/test.html">here</a>. The Eiffel support should be full, including the verbatim options.
|
||||
</p><p>If you note any issues, you can report it on my <a href="https://github.com/Conaclos/prism" class="external text" title="https://github.com/Conaclos/prism">github fork</a>.
|
||||
</p><p>I have commited a <a href="https://github.com/PrismJS/prism/pull/471" class="external text" title="https://github.com/PrismJS/prism/pull/471">Pull Request</a> to enable class name highlighting.
|
||||
Please feel free to express your support in the discussion thread of the <a href="https://github.com/PrismJS/prism/pull/471" class="external text" title="https://github.com/PrismJS/prism/pull/471">Pull Request</a>.
|
||||
The PR is waiitng for author agreement since January...
|
||||
</p>
|
||||
<a name="ACE_editor"></a><h2> <span class="mw-headline"> ACE editor </span></h2>
|
||||
<p><a href="http://ace.c9.io/" class="external text" title="http://ace.c9.io/">ACE Editor</a> is certainly the most use web-based code editor.
|
||||
A bench of web applications use ACE including:
|
||||
</p>
|
||||
<ul><li> the <a href="https://help.github.com/articles/editing-files-in-your-repository/" class="external text" title="https://help.github.com/articles/editing-files-in-your-repository/">Github web editor</a>
|
||||
</li><li> the <a href="https://c9.io/" class="external text" title="https://c9.io/">Cloud9 web IDE</a>
|
||||
</li><li> <a href="http://codecombat.com/" class="external text" title="http://codecombat.com/">Code Combat</a>, a game to learn programming basis
|
||||
</li><li> and <a href="https://ace.c9.io/#nav=production" class="external text" title="https://ace.c9.io/#nav=production">more</a>
|
||||
</li></ul>
|
||||
<p>The support of Eiffel is not full. In particular, the verbatim options and multiple-line strings are not supported.
|
||||
</p><p>If you note any issues, you can report it on my <a href="https://github.com/Conaclos/ace" class="external text" title="https://github.com/Conaclos/ace">github fork</a>.
|
||||
</p>
|
||||
<a name="Rouge"></a><h2> <span class="mw-headline"> Rouge </span></h2>
|
||||
<p>Rouge is a recent syntax highlighter increasing in popularity.
|
||||
It is compatible with the stylesheets of Pygments.
|
||||
</p><p>It is used by:
|
||||
</p>
|
||||
<ul><li> <a href="https://about.gitlab.com/" class="external text" title="https://about.gitlab.com/">Gitlab</a>
|
||||
</li><li> <a href="http://kramdown.gettalong.org/" class="external text" title="http://kramdown.gettalong.org/">krandown</a>, a markdown parser (anoption must be enabled)
|
||||
</li><li> <a href="https://github.com/vmg/redcarpet" class="external text" title="https://github.com/vmg/redcarpet">RedCarpet</a>, another markdown parser
|
||||
</li><li> the static site builder <a href="https://middlemanapp.com/" class="external text" title="https://middlemanapp.com/">Middleman</a>
|
||||
</li></ul>
|
||||
<p>The support of Eiffel is not full. In particular, the verbatim options are not supported.
|
||||
</p><p>If you note any issues, you can report it on my <a href="https://github.com/Conaclos/rouge" class="external text" title="https://github.com/Conaclos/rouge">github fork</a>.
|
||||
</p>
|
||||
<a name="Other_syntax_highlighters"></a><h2> <span class="mw-headline"> Other syntax highlighters </span></h2>
|
||||
<p>Some tools need updates in order to fully support the highlighting of Eiffel.
|
||||
For instance:
|
||||
</p>
|
||||
<ul><li> <a href="https://codemirror.net/" class="external text" title="https://codemirror.net/">Code Mirror</a>, a web-based code editor
|
||||
</li><li> <a href="http://pygments.org/" class="external text" title="http://pygments.org/">Pygments</a>
|
||||
</li><li> <a href="https://github.com/textmate/eiffel.tmbundle" class="external text" title="https://github.com/textmate/eiffel.tmbundle">TexMate</a>, (used also by <a href="https://github.com/github/linguist" class="external text" title="https://github.com/github/linguist">Github Linguist</a>
|
||||
</li><li> <a href="http://qbnz.com/highlighter/" class="external text" title="http://qbnz.com/highlighter/">GeSHi</a>
|
||||
</li></ul>
|
||||
<p>Enjoy ;)
|
||||
</p></div>
|
||||
</li>
|
||||
<liv class="nav"><a href="/feed_aggregation/news">See more ...</a></li>
|
||||
</ul>
|
||||
0
examples/demo/site/files/uploaded_files/Readme.md
Normal file
0
examples/demo/site/files/uploaded_files/Readme.md
Normal file
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"subject": "Thank you for contacting us",
|
||||
"recaptcha": {
|
||||
"site_key":"6Lex9RMTAAAAAKleC4x6TaRlFcpLbEWgH_U7MSiD",
|
||||
"secret_key":"6Lex9RMTAAAAAAkBczvX5DUiyg_xoM_EthVVgRRx"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
ul.cms-temp-users {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li {
|
||||
border-top: dotted 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li {
|
||||
border-top: dotted 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li.cms_temp_user_detail_information::before {
|
||||
content: "[personal information] ";
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li.cms_temp_user_detail_email::before {
|
||||
content: "[email] ";
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
ul.cms-temp-users {
|
||||
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_temp_user {
|
||||
|
||||
ul.cms_temp_user_details {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
li.cms_temp_user_detail_information::before{
|
||||
content: "[personal information] "
|
||||
}
|
||||
li.cms_temp_user_detail_email::before{
|
||||
content: "[email] "
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Activation</title>
|
||||
<meta name="description" content="Activation">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>"$user ($email)", thank you for applying to <a href="$host">$sitename</a>.</p>
|
||||
<p>We will review your application and send you a resolution.<p>
|
||||
<p>Thank you for registering at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on this link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Activation Confirmation</title>
|
||||
<meta name="description" content="Activation Confirmation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
<body>
|
||||
<p>Your account "$user ($email)" is confirmed at <a href="$host">$sitename</a>.</p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,12 +4,14 @@
|
||||
<meta charset="utf-8">
|
||||
<title>New Password</title>
|
||||
<meta name="description" content="New Password">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have requested a new password at <a href="$host">$sitename</a>.</p>
|
||||
<p>To complete your request, please click on the following link to generate a new password:
|
||||
<ul><a href="$link">$link</a></ul>
|
||||
</p>
|
||||
<p>You have required a new password at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your request, please click on this link to genereate a new password:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<title>New Activation</title>
|
||||
<meta name="description" content="New Activation token">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
<body>
|
||||
<p>You have requested a new activation token at <a href="$host">$sitename</a>.</p>
|
||||
|
||||
<p>To complete your registration, please click on the following link to re-activate your account:
|
||||
<ul><a href="$link">$link</a></ul>
|
||||
</p>
|
||||
<body>
|
||||
<p>You have request a new activation token at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on this link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Application Rejected</title>
|
||||
<meta name="description" content="Application Rejected">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
<body>
|
||||
<p>Your account application is rejected, it was not respecting the requirements from <a href="$host">$sitename</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,16 +4,10 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Welcome</title>
|
||||
<meta name="description" content="Welcome">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
<body>
|
||||
<p>Welcome to <a href="$host">$sitename</a>.</p>
|
||||
<p>Your account information:
|
||||
<ul>
|
||||
<li>Email address: "$email" .</li>
|
||||
<li>User name: "$user" .</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>Welcome to<a href="$host">ROC CMS</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Account Evaluation</title>
|
||||
<meta name="description" content="Account Evaluation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2> Account Evaluation </h2>
|
||||
<p>The user $user ($email) wants to register to the site <a href="$host">$sitename</a></p>
|
||||
|
||||
<blockquote><p>User application:</p>
|
||||
<p>$application</p>
|
||||
</blockquote>
|
||||
|
||||
<p>To complete the registration, please click on the following link to activate the user account:<p>
|
||||
|
||||
<p><a href="$activation_url">$activation_url</a></p>
|
||||
|
||||
<p>To reject the registration, please click on the following link <p>
|
||||
|
||||
<p><a href="$rejection_url">$rejection_url</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
{include file="block_account_info.tpl" /}
|
||||
@@ -1,34 +1,62 @@
|
||||
<div class="primary-tabs">
|
||||
{if isset="$user"}
|
||||
<h3>Account Information</h3>
|
||||
<ul class="user-information">
|
||||
<div>
|
||||
<label>Username:</label> {$user.name/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Email:</label> {$user.email/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Creation Date:</label> {$user.creation_date/} (UTC)
|
||||
</div>
|
||||
<div>
|
||||
<label>Last login:</label> {$user.last_login_date/} (UTC)
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<form method="get" action="{$site_url/}account/roc-logout">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</ul>
|
||||
<div>
|
||||
<label>Username:</label> {$user.name/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Email:</label> {$user.email/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Creation Date:</label> {$user.creation_date/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Last login:</label> {$user.last_login_date/}
|
||||
</div>
|
||||
<div>
|
||||
<form method="get" action="{$site_url/}{$auth_login_strategy/}">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
{include file="block_change_password.tpl" /}
|
||||
<hr>
|
||||
<h4>Roles</h4>
|
||||
<div>
|
||||
{foreach item="ic" from="$roles"}
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>{$ic.name/}</strong>
|
||||
<ul>
|
||||
<li> <i>permissions</i>
|
||||
<ul>
|
||||
{foreach item="ip" from="$ic.permissions"}
|
||||
<li>{$ip/}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<h4>Profile</h4>
|
||||
<ul class="user-profile">
|
||||
<div>
|
||||
{foreach item="the_value" key="the_name" from="$user.profile"}
|
||||
<li>
|
||||
<label>{$the_name/}:</label><div>{$the_value/}</div>
|
||||
</li>
|
||||
<div>
|
||||
<label>{$the_name/}:</label> {$the_value/}
|
||||
</div>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
{unless isset="$user"}
|
||||
<div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/change-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Change Password</legend>
|
||||
<legend>Change Password Form</legend>
|
||||
<div>
|
||||
<input type="password" id="password" name="password" value="" required/>
|
||||
<label for="password">Password</label>
|
||||
|
||||
29
examples/demo/site/modules/auth/templates/block_login.tpl
Normal file
29
examples/demo/site/modules/auth/templates/block_login.tpl
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="primary-tabs">
|
||||
{unless isset="$user"}
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<div>
|
||||
<form action method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" required>
|
||||
<label>Username</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="password" name="password" required>
|
||||
<label>Password</label>
|
||||
</div>
|
||||
|
||||
<button type="button" onclick="ROC_AUTH.login();">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<p>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<p>Thanks for your application, we will review it to activate your account.</p>
|
||||
<p>We have send you a new activation code, check your email to activate your account.</p>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<p>Thanks for your application, we will review it to activate your account.</p>
|
||||
<p>Thanks for register, check your email to activate your account.</p>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/roc-register" method="post">
|
||||
<fieldset>
|
||||
<legend>Registration</legend>
|
||||
<legend>Register Form</legend>
|
||||
<div>
|
||||
<input type="text" id="name" name="name" value="{$name/}" required autofocus />
|
||||
<label for="name">Name</label>
|
||||
@@ -20,19 +20,8 @@
|
||||
<span><i>{$error_email/}</i></span> <br>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>
|
||||
{$personal_information/}
|
||||
</textarea>
|
||||
<label for="personal_information">Tell us why you want to register an account</label>
|
||||
{if isset="$error_application"}
|
||||
<span><i>{$error_application/}</i></span> <br>
|
||||
{/if}
|
||||
</div>
|
||||
{unless isempty="$recaptcha_site_key"}
|
||||
<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div>
|
||||
<br/>
|
||||
{/unless}
|
||||
|
||||
|
||||
<button type="submit">Register</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,291 +1,307 @@
|
||||
var ROC_AUTH = ROC_AUTH || { };
|
||||
|
||||
var loginURL = "/roc-basic-login";
|
||||
var logoutURL = "/roc-basic-logoff";
|
||||
var loginURL = "/basic_auth_login";
|
||||
var logoutURL = "/basic_auth_logoff";
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
var firstLogIn = true;
|
||||
|
||||
ROC_AUTH.login = function() {
|
||||
var form = document.forms['cms_basic_auth'];
|
||||
var username = form.username.value;
|
||||
var password = form.password.value;
|
||||
//var host = form.host.value;
|
||||
var form = document.forms['cms_basic_auth'];
|
||||
var username = form.username.value;
|
||||
var password = form.password.value;
|
||||
//var host = form.host.value;
|
||||
var origin = window.location.origin + window.location.pathname;
|
||||
var _login = function(){
|
||||
if (document.getElementById('myModalFormId') !== null ) {
|
||||
ROC_AUTH.remove ('myModalFormId');
|
||||
}
|
||||
var _login = function(){
|
||||
|
||||
if (username === "" || password === "") {
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".login-box").append(newdiv);
|
||||
}
|
||||
}else{
|
||||
//Instantiate HTTP Request
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", loginURL, true, username, password);
|
||||
request.send(null);
|
||||
|
||||
if (document.getElementById('myModalFormId') !== null ) {
|
||||
ROC_AUTH.remove ('myModalFormId');
|
||||
}
|
||||
|
||||
//Process Response
|
||||
request.onreadystatechange = function(){
|
||||
if (request.readyState == 4) {
|
||||
if (request.status==200) {
|
||||
delete form;
|
||||
window.location=window.location.origin;
|
||||
} else {
|
||||
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
|
||||
// .. ?
|
||||
}
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".login-box").append(newdiv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (userAgent.indexOf("firefox") != -1) { //TODO: check version number
|
||||
if (firstLogIn) {
|
||||
_login();
|
||||
} else {
|
||||
ROC_AUTH.logoff(_login);
|
||||
}
|
||||
} else {
|
||||
_login();
|
||||
}
|
||||
if (username === "" || password === "") {
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".primary-tabs").append(newdiv);
|
||||
}
|
||||
}else{
|
||||
|
||||
//Instantiate HTTP Request
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", loginURL, true, username, password);
|
||||
request.send(null);
|
||||
|
||||
//Process Response
|
||||
request.onreadystatechange = function(){
|
||||
if (request.readyState == 4) {
|
||||
if (request.status==200) {
|
||||
delete form;
|
||||
window.location=window.location.origin;
|
||||
}
|
||||
else{
|
||||
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
|
||||
}
|
||||
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".primary-tabs").append(newdiv);
|
||||
}
|
||||
|
||||
if (firstLogIn) {
|
||||
firstLogIn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (userAgent.indexOf("firefox") != -1){ //TODO: check version number
|
||||
if (firstLogIn) _login();
|
||||
else logoff(_login);
|
||||
}
|
||||
else{
|
||||
_login();
|
||||
}
|
||||
|
||||
if (firstLogIn) firstLogIn = false;
|
||||
};
|
||||
|
||||
|
||||
ROC_AUTH.login_with_redirect = function() {
|
||||
var form = document.forms[2];
|
||||
var username = form.username.value;
|
||||
var password = form.password.value;
|
||||
var host = form.host.value;
|
||||
var _login = function(){
|
||||
var redirectURL = form.redirect && form.redirect.value || "";
|
||||
$("#imgProgressRedirect").show();
|
||||
var form = document.forms[2];
|
||||
var username = form.username.value;
|
||||
var password = form.password.value;
|
||||
var host = form.host.value;
|
||||
var _login = function(){
|
||||
|
||||
if (document.getElementById('myModalFormId') !== null ) {
|
||||
ROC_AUTH.remove ('myModalFormId');
|
||||
}
|
||||
if (username === "" || password === "") {
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".login-box").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
} else {
|
||||
//Instantiate HTTP Request
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", host + loginURL, true, username, password);
|
||||
request.send(null);
|
||||
var redirectURL = form.redirect && form.redirect.value || "";
|
||||
|
||||
//Process Response
|
||||
request.onreadystatechange = function() {
|
||||
if (request.readyState == 4) {
|
||||
if (request.status==200) {
|
||||
if (redirectURL === "") {
|
||||
window.location=host + "/";
|
||||
} else {
|
||||
window.location=host + redirectURL;
|
||||
}
|
||||
} else{
|
||||
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
|
||||
}
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".login-box").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (userAgent.indexOf("firefox") != -1){ //TODO: check version number
|
||||
if (firstLogIn) {
|
||||
_login();
|
||||
} else {
|
||||
ROC_AUTH.logoff(_login);
|
||||
}
|
||||
} else{
|
||||
_login();
|
||||
}
|
||||
if (firstLogIn) {
|
||||
firstLogIn = false;
|
||||
}
|
||||
$("#imgProgressRedirect").show();
|
||||
|
||||
if (document.getElementById('myModalFormId') !== null ) {
|
||||
ROC_AUTH.remove ('myModalFormId');
|
||||
}
|
||||
|
||||
|
||||
if (username === "" || password === "") {
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".primary-tabs").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
}else{
|
||||
|
||||
//Instantiate HTTP Request
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", host.concat(loginURL), true, username, password);
|
||||
request.send(null);
|
||||
|
||||
//Process Response
|
||||
request.onreadystatechange = function(){
|
||||
if (request.readyState == 4) {
|
||||
if (request.status==200) {
|
||||
if (redirectURL === "") {
|
||||
window.location=host.concat("/");
|
||||
} else {
|
||||
window.location=host.concat(redirectURL);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
|
||||
}
|
||||
|
||||
if (document.getElementById('myModalFormId') === null ) {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$(".primary-tabs").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (userAgent.indexOf("firefox") != -1){ //TODO: check version number
|
||||
if (firstLogIn) _login();
|
||||
else logoff(_login);
|
||||
}
|
||||
else{
|
||||
_login();
|
||||
}
|
||||
|
||||
if (firstLogIn) firstLogIn = false;
|
||||
};
|
||||
|
||||
|
||||
ROC_AUTH.getQueryParameterByName = function (name) {
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
|
||||
return results === null ? " " : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results === null ? " " : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
ROC_AUTH.logoff = function(callback){
|
||||
var form = document.forms[0];
|
||||
var host = form.host.value;
|
||||
|
||||
if (userAgent.indexOf("msie") != -1) {
|
||||
document.execCommand("ClearAuthenticationCache");
|
||||
} else if (userAgent.indexOf("firefox") != -1){ //TODO: check version number
|
||||
var request1 = new XMLHttpRequest();
|
||||
var request2 = new XMLHttpRequest();
|
||||
|
||||
//Logout. Tell the server not to return the "WWW-Authenticate" header
|
||||
request1.open("GET", host + logoutURL + "?prompt=false", true);
|
||||
request1.send("");
|
||||
request1.onreadystatechange = function(){
|
||||
if (request1.readyState == 4) {
|
||||
//Sign in with dummy credentials to clear the auth cache
|
||||
request2.open("GET", host + logoutURL, true, "logout", "logout");
|
||||
request2.send("");
|
||||
request2.onreadystatechange = function(){
|
||||
if (request2.readyState == 4) {
|
||||
if (callback!=null) {
|
||||
callback.call();
|
||||
} else {
|
||||
window.location=host + logoutURL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", host + logoutURL, true, "logout", "logout");
|
||||
request.send("");
|
||||
request.onreadystatechange = function(){
|
||||
if (request.status==401 || request.status==403 ) {
|
||||
window.location=host + logoutURL;
|
||||
}
|
||||
}
|
||||
}
|
||||
var form = document.forms[0];
|
||||
var host = form.host.value;
|
||||
|
||||
if (userAgent.indexOf("msie") != -1) {
|
||||
document.execCommand("ClearAuthenticationCache");
|
||||
}
|
||||
else if (userAgent.indexOf("firefox") != -1){ //TODO: check version number
|
||||
|
||||
var request1 = new XMLHttpRequest();
|
||||
var request2 = new XMLHttpRequest();
|
||||
|
||||
//Logout. Tell the server not to return the "WWW-Authenticate" header
|
||||
request1.open("GET", host.concat(logoutURL) + "?prompt=false", true);
|
||||
request1.send("");
|
||||
request1.onreadystatechange = function(){
|
||||
if (request1.readyState == 4) {
|
||||
|
||||
//Sign in with dummy credentials to clear the auth cache
|
||||
request2.open("GET", host.concat(logoutURL), true, "logout", "logout");
|
||||
request2.send("");
|
||||
|
||||
request2.onreadystatechange = function(){
|
||||
if (request2.readyState == 4) {
|
||||
if (callback!=null) { callback.call(); } else { window.location=host.concat(logoutURL);}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
request.open("GET", host.concat(logoutURL), true, "logout", "logout");
|
||||
request.send("");
|
||||
request.onreadystatechange = function(){
|
||||
if (request.status==401 || request.status==403 ) { window.location=host.concat(logoutURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ROC_AUTH.remove = function (id) {
|
||||
var element = document.getElementById(id);
|
||||
element.outerHTML = "";
|
||||
delete element;
|
||||
return;
|
||||
ROC_AUTH.remove = function (id)
|
||||
{
|
||||
var element = document.getElementById(id);
|
||||
element.outerHTML = "";
|
||||
delete element;
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
if (typeof String.prototype.contains != 'function') {
|
||||
String.prototype.contains = function (str){
|
||||
return this.indexOf(str) != -1;
|
||||
};
|
||||
}
|
||||
ROC_AUTH.progressive_loging();
|
||||
|
||||
if (typeof String.prototype.contains != 'function') {
|
||||
String.prototype.contains = function (str){
|
||||
return this.indexOf(str) != -1;
|
||||
};
|
||||
}
|
||||
ROC_AUTH.progressive_loging();
|
||||
|
||||
});
|
||||
|
||||
|
||||
ROC_AUTH.progressive_loging = function () {
|
||||
ROC_AUTH.login_href();
|
||||
|
||||
ROC_AUTH.login_href();
|
||||
};
|
||||
|
||||
|
||||
$(document).keypress(function(e) {
|
||||
if ((e.which === 13) && (e.target.localName === 'input' && e.target.id === 'password')) {
|
||||
ROC_AUTH.login();
|
||||
}
|
||||
if ((e.which === 13) && (e.target.localName === 'input' && e.target.id === 'password')) {
|
||||
ROC_AUTH.login();
|
||||
}
|
||||
});
|
||||
|
||||
ROC_AUTH.OnOneClick = function(event) {
|
||||
event.preventDefault();
|
||||
if ( document.forms[0] === undefined ) {
|
||||
ROC_AUTH.create_form();
|
||||
}
|
||||
return false;
|
||||
event.preventDefault();
|
||||
if ( document.forms[0] === undefined ) {
|
||||
ROC_AUTH.create_form();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
ROC_AUTH.login_href = function() {
|
||||
var els = document.getElementsByTagName("a");
|
||||
for (var i = 0, l = els.length; i < l; i++) {
|
||||
var el = els[i];
|
||||
if (el.href.contains(loginURL + "?destination")) {
|
||||
// loginURL = el.href;
|
||||
var OneClick = el;
|
||||
OneClick.addEventListener('click', ROC_AUTH.OnOneClick, false);
|
||||
}
|
||||
}
|
||||
var els = document.getElementsByTagName("a");
|
||||
for (var i = 0, l = els.length; i < l; i++) {
|
||||
var el = els[i];
|
||||
if (el.href.contains("/basic_auth_login?destination")) {
|
||||
loginURL = el.href;
|
||||
var OneClick = el;
|
||||
OneClick.addEventListener('click', ROC_AUTH.OnOneClick, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ROC_AUTH.create_form = function() {
|
||||
|
||||
// Fetching HTML Elements in Variables by ID.
|
||||
var createform = document.createElement('form'); // Create New Element Form
|
||||
createform.setAttribute("action", ""); // Setting Action Attribute on Form
|
||||
createform.setAttribute("method", "post"); // Setting Method Attribute on Form
|
||||
$("body").append(createform);
|
||||
// Fetching HTML Elements in Variables by ID.
|
||||
var createform = document.createElement('form'); // Create New Element Form
|
||||
createform.setAttribute("action", ""); // Setting Action Attribute on Form
|
||||
createform.setAttribute("method", "post"); // Setting Method Attribute on Form
|
||||
$("body").append(createform);
|
||||
|
||||
var heading = document.createElement('h2'); // Heading of Form
|
||||
heading.innerHTML = "Login Form ";
|
||||
createform.appendChild(heading);
|
||||
var heading = document.createElement('h2'); // Heading of Form
|
||||
heading.innerHTML = "Login Form ";
|
||||
createform.appendChild(heading);
|
||||
|
||||
var line = document.createElement('hr'); // Giving Horizontal Row After Heading
|
||||
createform.appendChild(line);
|
||||
var line = document.createElement('hr'); // Giving Horizontal Row After Heading
|
||||
createform.appendChild(line);
|
||||
|
||||
var linebreak = document.createElement('br');
|
||||
createform.appendChild(linebreak);
|
||||
var linebreak = document.createElement('br');
|
||||
createform.appendChild(linebreak);
|
||||
|
||||
var namelabel = document.createElement('label'); // Create Label for Name Field
|
||||
namelabel.innerHTML = "Username : "; // Set Field Labels
|
||||
createform.appendChild(namelabel);
|
||||
var namelabel = document.createElement('label'); // Create Label for Name Field
|
||||
namelabel.innerHTML = "Username : "; // Set Field Labels
|
||||
createform.appendChild(namelabel);
|
||||
|
||||
var inputelement = document.createElement('input'); // Create Input Field for UserName
|
||||
inputelement.setAttribute("type", "text");
|
||||
inputelement.setAttribute("name", "username");
|
||||
inputelement.setAttribute("required","required");
|
||||
createform.appendChild(inputelement);
|
||||
var inputelement = document.createElement('input'); // Create Input Field for UserName
|
||||
inputelement.setAttribute("type", "text");
|
||||
inputelement.setAttribute("name", "username");
|
||||
inputelement.setAttribute("required","required");
|
||||
createform.appendChild(inputelement);
|
||||
|
||||
var linebreak = document.createElement('br');
|
||||
createform.appendChild(linebreak);
|
||||
var linebreak = document.createElement('br');
|
||||
createform.appendChild(linebreak);
|
||||
|
||||
var passwordlabel = document.createElement('label'); // Create Label for Password Field
|
||||
passwordlabel.innerHTML = "Password : ";
|
||||
createform.appendChild(passwordlabel);
|
||||
var passwordlabel = document.createElement('label'); // Create Label for Password Field
|
||||
passwordlabel.innerHTML = "Password : ";
|
||||
createform.appendChild(passwordlabel);
|
||||
|
||||
var passwordelement = document.createElement('input'); // Create Input Field for Password.
|
||||
passwordelement.setAttribute("type", "password");
|
||||
passwordelement.setAttribute("name", "password");
|
||||
passwordelement.setAttribute("id", "password");
|
||||
passwordelement.setAttribute("required","required");
|
||||
createform.appendChild(passwordelement);
|
||||
var passwordelement = document.createElement('input'); // Create Input Field for Password.
|
||||
passwordelement.setAttribute("type", "password");
|
||||
passwordelement.setAttribute("name", "password");
|
||||
passwordelement.setAttribute("id", "password");
|
||||
passwordelement.setAttribute("required","required");
|
||||
createform.appendChild(passwordelement);
|
||||
|
||||
|
||||
var passwordbreak = document.createElement('br');
|
||||
createform.appendChild(passwordbreak);
|
||||
var passwordbreak = document.createElement('br');
|
||||
createform.appendChild(passwordbreak);
|
||||
|
||||
|
||||
var submitelement = document.createElement('button'); // Append Submit Button
|
||||
submitelement.setAttribute("type", "button");
|
||||
submitelement.setAttribute("onclick", "ROC_AUTH.login();");
|
||||
submitelement.innerHTML = "Sign In ";
|
||||
createform.appendChild(submitelement);
|
||||
var submitelement = document.createElement('button'); // Append Submit Button
|
||||
submitelement.setAttribute("type", "button");
|
||||
submitelement.setAttribute("onclick", "ROC_AUTH.login();");
|
||||
submitelement.innerHTML = "Sign In ";
|
||||
createform.appendChild(submitelement);
|
||||
|
||||
};
|
||||
|
||||
@@ -294,16 +310,16 @@ var password = document.getElementById("password");
|
||||
var confirm_password = document.getElementById("confirm_password");
|
||||
|
||||
ROC_AUTH.validatePassword =function(){
|
||||
if ((password != null) && (confirm_password != null)) {
|
||||
if(password.value != confirm_password.value) {
|
||||
confirm_password.setCustomValidity("Passwords Don't Match");
|
||||
} else {
|
||||
confirm_password.setCustomValidity('');
|
||||
}
|
||||
}
|
||||
if ((password != null) && (confirm_password != null)) {
|
||||
if(password.value != confirm_password.value) {
|
||||
confirm_password.setCustomValidity("Passwords Don't Match");
|
||||
} else {
|
||||
confirm_password.setCustomValidity('');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((password != null) && (confirm_password != null)) {
|
||||
password.onchange = ROC_AUTH.validatePassword();
|
||||
confirm_password.onkeyup = ROC_AUTH.validatePassword;
|
||||
password.onchange = ROC_AUTH.validatePassword();
|
||||
confirm_password.onkeyup = ROC_AUTH.validatePassword;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
{unless isset="$user"}
|
||||
<div class="login-box">
|
||||
<div class="description">The "Basic Auth" relies on the HTTP basic acces authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div class="primary-tabs">
|
||||
{unless isset="$user"}
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<form name="cms_basic_auth" action="{$site_url/}roc-basic-login" method="POST">
|
||||
<input type="hidden" name="host" id="host" value="{$site_url/}">
|
||||
<div>
|
||||
<input type="text" name="username" id="username" required>
|
||||
<label>Username</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="password" name="password" id="password" required>
|
||||
<label>Password</label>
|
||||
</div>
|
||||
<button type="button" onclick="ROC_AUTH.login();">Login</button>
|
||||
</form>
|
||||
<div>
|
||||
<form name="cms_basic_auth" action method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" id="username" required>
|
||||
<label>Username</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="password" name="password" id="password" required>
|
||||
<label>Password</label>
|
||||
</div>
|
||||
|
||||
<button type="button" onclick="ROC_AUTH.login();">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
<div>
|
||||
<p>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
{/unless}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
CREATE TABLE blog_post_nodes(
|
||||
`nid` INTEGER NOT NULL CHECK("nid">=0),
|
||||
`revision` INTEGER NOT NULL,
|
||||
`tags` VARCHAR(255),
|
||||
CONSTRAINT PK_nid_revision PRIMARY KEY (nid,revision)
|
||||
);
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"--email": "webmaster@example.com",
|
||||
"subjet": "Thank you for contacting us",
|
||||
"recaptcha": {
|
||||
"site_key":"",
|
||||
"secret_key":""
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
.contact-box {
|
||||
background-color: #F2F7F9;
|
||||
width: 465px;
|
||||
padding: 20px;
|
||||
border: 6px solid #8FB5C1;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
position: relative;
|
||||
/* Remove box shadow firefox, chrome and opera put around required fields.
|
||||
* It looks rubbish.
|
||||
*/
|
||||
/* Normalize placeholder styles */
|
||||
/* chrome, safari */
|
||||
/* mozilla */
|
||||
/* ie (faux placeholder) */
|
||||
}
|
||||
.contact-box h1 {
|
||||
font-size: 42px;
|
||||
}
|
||||
.contact-box h2 {
|
||||
margin-bottom: 15px;
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
}
|
||||
.contact-box label {
|
||||
font-size: 15px;
|
||||
margin-bottom: 2px;
|
||||
display: block;
|
||||
}
|
||||
.contact-box input, .contact-box select, .contact-box textarea {
|
||||
width: 100%;
|
||||
font-size: 15px;
|
||||
border: 1px solid #CEE1E8;
|
||||
margin-bottom: 20px;
|
||||
padding: 4px;
|
||||
}
|
||||
.contact-box input:focus, .contact-box select:focus, .contact-box textarea:focus {
|
||||
border: 1px solid #AFCDD8;
|
||||
background-color: #EBF2F4;
|
||||
}
|
||||
.contact-box textarea {
|
||||
height: 150px;
|
||||
resize: none;
|
||||
}
|
||||
.contact-box span.required {
|
||||
font-weight: bold;
|
||||
color: #F00;
|
||||
}
|
||||
.contact-box input[type=submit] {
|
||||
width: 100px;
|
||||
background-color: #333;
|
||||
color: #FFF;
|
||||
border: none;
|
||||
display: block;
|
||||
float: right;
|
||||
margin-bottom: 0px;
|
||||
margin-right: 6px;
|
||||
background-color: #8FB5C1;
|
||||
-moz-border-radius: 8px;
|
||||
}
|
||||
.contact-box input[type=submit]:hover {
|
||||
background-color: #A6CFDD;
|
||||
}
|
||||
.contact-box input[type=submit]:active {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.contact-box .message {
|
||||
width: 95%;
|
||||
margin: 25px 0px;
|
||||
padding: 10px;
|
||||
display: block;
|
||||
border: solid 1px #ccc;
|
||||
border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
-moz-border-radius: 8px;
|
||||
}
|
||||
.contact-box .message.hidden {
|
||||
display: none;
|
||||
}
|
||||
.contact-box .message.error {
|
||||
border-color: #E58E8E;
|
||||
background-color: #FFE6E6;
|
||||
}
|
||||
.contact-box .message.error li {
|
||||
padding: 2px;
|
||||
list-style: none;
|
||||
}
|
||||
.contact-box .message.error li:before {
|
||||
content: ' - ';
|
||||
}
|
||||
.contact-box .message.error #info {
|
||||
font-weight: bold;
|
||||
}
|
||||
.contact-box .message.error #info:before {
|
||||
content: '';
|
||||
}
|
||||
.contact-box .message.success {
|
||||
border-color: #83D186;
|
||||
padding-top: 25px;
|
||||
background-color: #D3EDD3;
|
||||
}
|
||||
.contact-box .req-field-desc {
|
||||
font-style: italic;
|
||||
}
|
||||
.contact-box input:required, .contact-box textarea:required {
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-o-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.contact-box ::-webkit-input-placeholder {
|
||||
color: #CCC;
|
||||
font-style: italic;
|
||||
}
|
||||
.contact-box input:-moz-placeholder, .contact-box textarea:-moz-placeholder {
|
||||
color: #CCC;
|
||||
font-style: italic;
|
||||
}
|
||||
.contact-box input.placeholder-text, .contact-box textarea.placeholder-text {
|
||||
color: #CCC;
|
||||
font-style: italic;
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
.contact-box {
|
||||
background-color:#F2F7F9;
|
||||
width:465px;
|
||||
padding:20px;
|
||||
border: 6px solid #8FB5C1;
|
||||
-moz-border-radius:15px;
|
||||
-webkit-border-radius:15px;
|
||||
border-radius:15px;
|
||||
position:relative;
|
||||
|
||||
h1 {
|
||||
font-size:42px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom:15px;
|
||||
font-style:italic;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size:15px;
|
||||
margin-bottom:2px;
|
||||
display:block;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
width:100%;
|
||||
font-size:15px;
|
||||
border: 1px solid #CEE1E8;
|
||||
margin-bottom:20px;
|
||||
padding:4px;
|
||||
&:focus {
|
||||
border: 1px solid #AFCDD8;
|
||||
background-color: #EBF2F4;
|
||||
}
|
||||
}
|
||||
|
||||
textarea {
|
||||
height:150px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
span.required {
|
||||
font-weight:bold;
|
||||
color:#F00;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
width: 100px;
|
||||
background-color:#333;
|
||||
color:#FFF;
|
||||
border:none;
|
||||
display:block;
|
||||
float:right;
|
||||
margin-bottom:0px;
|
||||
margin-right:6px;
|
||||
background-color:#8FB5C1;
|
||||
-moz-border-radius:8px;
|
||||
&:hover {
|
||||
background-color: #A6CFDD;
|
||||
}
|
||||
&:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
}
|
||||
|
||||
.message {
|
||||
width:95%;
|
||||
margin:25px 0px;
|
||||
padding:10px;
|
||||
display:block;
|
||||
border:solid 1px #ccc;
|
||||
border-radius:8px;
|
||||
-webkit-border-radius:8px;
|
||||
-moz-border-radius:8px;
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.error {
|
||||
border-color: #E58E8E;
|
||||
background-color:#FFE6E6;
|
||||
|
||||
li {
|
||||
padding:2px;
|
||||
list-style:none;
|
||||
&:before { content: ' - '; }
|
||||
}
|
||||
#info {
|
||||
font-weight:bold;
|
||||
&:before { content: ''; }
|
||||
}
|
||||
}
|
||||
|
||||
&.success {
|
||||
border-color: #83D186;
|
||||
padding-top: 25px;
|
||||
background-color:#D3EDD3;
|
||||
}
|
||||
}
|
||||
|
||||
.req-field-desc {
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* Remove box shadow firefox, chrome and opera put around required fields.
|
||||
* It looks rubbish.
|
||||
*/
|
||||
input:required, textarea:required {
|
||||
-moz-box-shadow:none;
|
||||
-webkit-box-shadow:none;
|
||||
-o-box-shadow:none;
|
||||
box-shadow:none;
|
||||
}
|
||||
|
||||
/* Normalize placeholder styles */
|
||||
|
||||
/* chrome, safari */
|
||||
::-webkit-input-placeholder {
|
||||
color:#CCC;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* mozilla */
|
||||
input:-moz-placeholder, textarea:-moz-placeholder {
|
||||
color:#CCC;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* ie (faux placeholder) */
|
||||
input.placeholder-text, textarea.placeholder-text {
|
||||
color:#CCC;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<div class="contact-box clearfix">
|
||||
<h1>Contact us!</h1>
|
||||
<form method="post" action="{$site_url/}contact" id="contact-form">
|
||||
<label for="name">Name: <span class="required">*</span></label>
|
||||
<input type="text" id="name" name="name" value="{$name/}" required="required" autofocus="autofocus" />
|
||||
|
||||
<label for="email">Email Address: <span class="required">*</span></label>
|
||||
<input type="email" id="email" name="email" value="{$email/}" required="required" />
|
||||
|
||||
<label for="message">Message: <span class="required">*</span></label>
|
||||
<textarea id="message" name="message" required="required" data-minlength="20" minlength="20" >{$message/}</textarea>
|
||||
{unless isempty="$recaptcha_site_key"}
|
||||
<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div>
|
||||
<br/>
|
||||
{/unless}
|
||||
<input type="submit" value="Send" class="submit-button" />
|
||||
<p class="req-field-desc"><span class="required">*</span> indicates a required field</p>
|
||||
</form>
|
||||
{unless isempty="$error_response"}
|
||||
<ul class="message error">
|
||||
{foreach item="item" from="$error_response"}<li class="info">{$item/}</li>{/foreach}
|
||||
</ul>
|
||||
<div class="notice"> Try again later </div>
|
||||
{/unless}
|
||||
</div>
|
||||
@@ -1,15 +0,0 @@
|
||||
<div class="contact-box">
|
||||
{if condition="$has_error"}
|
||||
<div class="message error">
|
||||
<strong>Internal Server Error <small>Error 500</small></strong>
|
||||
<p>The page you requested could not be served because the server is down,
|
||||
either contact the webmaster or try again.
|
||||
Use your browser's <strong>Back</strong> button to navigate to the page you came from.</p>
|
||||
<p><strong>Or you could just press this link:</strong> <a href="{$site_url/}" itemprop="home" rel="home">Take Me Home</a></p>
|
||||
</div>
|
||||
{/if}
|
||||
{unless condition="$has_error"}
|
||||
<p class="message success">Thank you for contacting the Eiffel Programming Language community.<br/>
|
||||
We will get back to you promptly on your contact request.</p>
|
||||
{/unless}
|
||||
</div>
|
||||
@@ -1,10 +0,0 @@
|
||||
<p>
|
||||
Thank you for contacting {$sitename/}.<br/>
|
||||
We will get back to you promptly about your contact message.
|
||||
</p>
|
||||
<h2>Your contact information:</h2>
|
||||
<div>
|
||||
<strong>Name<strong>: {$name/} <br/>
|
||||
<strong>Email<strong>: {$email/} <br/>
|
||||
<strong>Message<strong>: {$message/} <br/>
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
<h2>Contact information:</h2>
|
||||
<div>
|
||||
<strong>Name<strong>: {$name/}<br/>
|
||||
<strong>Email<strong>: {$email/} <br/>
|
||||
<strong>Message<strong>: {$message/} <br/>
|
||||
</div>
|
||||
@@ -1,61 +0,0 @@
|
||||
.uploaded-files {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.uploaded-files th {
|
||||
padding-left: 5px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.uploaded-files td {
|
||||
padding-left: 5px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.uploaded-files a.button {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
}
|
||||
.uploaded-files a.button:hover {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.upload-files a.upload-button {
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
.upload-files a.upload-button:hover {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.dropzone .dz-message {
|
||||
cursor: pointer;
|
||||
}
|
||||
.dropzone .dz-preview, .dropzone .dz-file-preview, .dropzone .dz-processing, .dropzone .dz-success,
|
||||
.dropzone .dz-image-preview, .dropzone .dz-complete {
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
}
|
||||
.dropzone .dz-preview {
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
background: #e6e6e6;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,73 +0,0 @@
|
||||
.uploaded-files {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
|
||||
th {
|
||||
padding-left: 5px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-left: 5px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
a.button{
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
&:hover {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upload-files {
|
||||
a.upload-button{
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
|
||||
.dz-message {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.dz-preview, .dz-file-preview, .dz-processing, .dz-success,
|
||||
.dz-image-preview, .dz-complete {
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dz-preview {
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
background: #e6e6e6;
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,22 @@ ul.cms-nodes {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_type_page a::before {
|
||||
content: "[page] ";
|
||||
}
|
||||
|
||||
li.cms_type_blog a::before {
|
||||
content: "[blog] ";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
CREATE TABLE auth_session (
|
||||
`uid` INTEGER PRIMARY KEY NOT NULL CHECK(`uid`>=0),
|
||||
`access_token` VARCHAR(64) NOT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
CONSTRAINT `uid` UNIQUE(`uid`),
|
||||
CONSTRAINT `access_token` UNIQUE(`access_token`)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
CREATE TABLE session_auth (
|
||||
`uid` INTEGER PRIMARY KEY NOT NULL CHECK(`uid`>=0),
|
||||
`access_token` TEXT NOT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
CONSTRAINT `uid`
|
||||
UNIQUE(`uid`),
|
||||
CONSTRAINT `access_token`
|
||||
UNIQUE(`access_token`)
|
||||
);
|
||||
|
||||
@@ -1,23 +1,37 @@
|
||||
{unless isset="$user"}
|
||||
<div class="login-box">
|
||||
<div class="description">The "Session" is the standard authentication system. (based on cookie)</div>
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<form name="cms_session_auth" action="{$site_url/}account/auth/roc-session-login" method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" id="username" required value="{$username/}">
|
||||
<label>Username</label>
|
||||
<div class="primary-tabs">
|
||||
{unless isset="$user"}
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<div>
|
||||
<form name="cms_session_auth" action="{$site_url/}account/login-with-session" method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" id="username" required value="{$username/}">
|
||||
<label>Username</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="password" name="password" id="password" required >
|
||||
<label>Password</label>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<input type="password" name="password" id="password" required >
|
||||
<label>Password</label>
|
||||
<p>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</p>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
{/unless}
|
||||
{if isset=$error}
|
||||
<div>
|
||||
<div>
|
||||
<p>
|
||||
<strong>{$error/}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</div>
|
||||
{if isset="$error"}<div class="error">{$error/}</div>{/if}
|
||||
</div>
|
||||
{/unless}
|
||||
|
||||
@@ -46,18 +46,3 @@ CREATE TABLE `users_password_recovery` (
|
||||
CONSTRAINT `token` UNIQUE (`token`)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE `auth_temp_users` (
|
||||
`uid` INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
`password` VARCHAR(100) NOT NULL,
|
||||
`salt` VARCHAR(100) NOT NULL,
|
||||
`email` VARCHAR(250) NOT NULL,
|
||||
`application` TEXT NOT NULL,
|
||||
CONSTRAINT `name`
|
||||
UNIQUE(`name`)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,51 +35,67 @@ feature -- CMS storage
|
||||
do
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3")
|
||||
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_MYSQL_BUILDER}.make, "mysql")
|
||||
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
|
||||
end
|
||||
|
||||
feature -- CMS modules
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
-- Setup additional modules.
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
-- Admin
|
||||
a_setup.register_module (create {CMS_ADMIN_MODULE}.make)
|
||||
create {CMS_ADMIN_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Auth
|
||||
a_setup.register_module (create {CMS_AUTHENTICATION_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_BASIC_AUTH_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_OAUTH_20_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_OPENID_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_SESSION_AUTH_MODULE}.make)
|
||||
create {CMS_AUTHENTICATION_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_BASIC_AUTH_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_OAUTH_20_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_OPENID_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Nodes
|
||||
a_setup.register_module (create {CMS_NODE_MODULE}.make (a_setup))
|
||||
a_setup.register_module (create {CMS_BLOG_MODULE}.make)
|
||||
create {CMS_NODE_MODULE} m.make (a_setup)
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Files
|
||||
a_setup.register_module (create {CMS_FILES_MODULE}.make)
|
||||
|
||||
-- Contact
|
||||
a_setup.register_module (create {CMS_CONTACT_MODULE}.make)
|
||||
|
||||
-- Misc
|
||||
a_setup.register_module (create {CMS_SEO_MODULE}.make)
|
||||
create {CMS_BLOG_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Taxonomy
|
||||
a_setup.register_module (create {CMS_TAXONOMY_MODULE}.make)
|
||||
create {CMS_TAXONOMY_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Recent changes
|
||||
a_setup.register_module (create {CMS_RECENT_CHANGES_MODULE}.make)
|
||||
create {CMS_RECENT_CHANGES_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Feed aggregator
|
||||
a_setup.register_module (create {FEED_AGGREGATOR_MODULE}.make)
|
||||
-- Recent changes
|
||||
create {FEED_AGGREGATOR_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Miscellanious
|
||||
a_setup.register_module (create {GOOGLE_CUSTOM_SEARCH_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_DEBUG_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_DEMO_MODULE}.make)
|
||||
create {CMS_DEBUG_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_DEMO_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {GOOGLE_CUSTOM_SEARCH_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_SESSION_AUTH_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- uploader
|
||||
create {CMS_FILE_UPLOADER_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,14 +35,12 @@ feature {NONE} -- Initialization
|
||||
parameters: EMAIL_SERVICE_PARAMETERS
|
||||
-- Associated parameters.
|
||||
|
||||
mailer: NOTIFICATION_MAILER
|
||||
-- SMTP protocol.
|
||||
|
||||
feature -- Access
|
||||
|
||||
admin_email: IMMUTABLE_STRING_8
|
||||
-- Site admin's email.
|
||||
|
||||
mailer: NOTIFICATION_MAILER
|
||||
-- SMTP protocol.
|
||||
|
||||
feature -- Basic Operations
|
||||
|
||||
send_internal_email (a_content: READABLE_STRING_GENERAL)
|
||||
|
||||
@@ -37,80 +37,6 @@ feature -- Access
|
||||
weight: INTEGER
|
||||
-- Optional weight used for order.
|
||||
|
||||
query_string: detachable STRING
|
||||
-- Query string from `location'.
|
||||
local
|
||||
i: INTEGER
|
||||
loc: like location
|
||||
do
|
||||
loc := location
|
||||
i := loc.index_of ('?', 1)
|
||||
if i > 0 then
|
||||
Result := loc.substring (i + 1, loc.count)
|
||||
i := loc.last_index_of ('#', loc.count)
|
||||
if i > 0 then
|
||||
Result.keep_head (i - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fragment_string: detachable STRING
|
||||
-- Query string from `location'.
|
||||
local
|
||||
i: INTEGER
|
||||
loc: like location
|
||||
do
|
||||
loc := location
|
||||
i := loc.last_index_of ('#', loc.count)
|
||||
if i > 0 then
|
||||
Result := loc.substring (i + 1, loc.count)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
add_query_parameter (a_encoded_name: READABLE_STRING_8; a_encoded_value: detachable READABLE_STRING_8)
|
||||
-- Add query parameter "$a_encoded_name=$a_encoded_value" to `location'.
|
||||
-- note: the argument must already be url encoded!
|
||||
local
|
||||
q: STRING_8
|
||||
f: detachable READABLE_STRING_8
|
||||
i,j: INTEGER
|
||||
loc: STRING_8
|
||||
do
|
||||
create loc.make_from_string (location)
|
||||
|
||||
j := loc.last_index_of ('#', loc.count)
|
||||
if j > 0 then
|
||||
f := loc.substring (j, loc.count)
|
||||
loc.keep_head (j - 1)
|
||||
end
|
||||
i := loc.index_of ('?', 1)
|
||||
if i > 0 then
|
||||
q := loc.substring (i + 1, loc.count)
|
||||
loc.keep_head (i)
|
||||
else
|
||||
create q.make_empty
|
||||
end
|
||||
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
|
||||
q.append (a_encoded_name)
|
||||
if a_encoded_value /= Void then
|
||||
q.append_character ('=')
|
||||
q.append (a_encoded_value)
|
||||
end
|
||||
|
||||
loc.append_character ('?')
|
||||
loc.append (q)
|
||||
if f /= Void then
|
||||
loc.append (f)
|
||||
end
|
||||
location := loc
|
||||
end
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
is_less alias "<" (other: like Current): BOOLEAN
|
||||
@@ -208,6 +134,6 @@ feature -- Status report
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
note
|
||||
description: "User for temporary account."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_TEMP_USER
|
||||
|
||||
inherit
|
||||
CMS_USER
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_id
|
||||
|
||||
feature -- Access
|
||||
|
||||
personal_information: detachable STRING_32
|
||||
-- User personal information.
|
||||
|
||||
salt: detachable STRING_32
|
||||
-- User's password salt.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_personal_information (a_personal_information: like personal_information)
|
||||
-- Assign `personal_information' with `a_personal_information'.
|
||||
do
|
||||
personal_information := a_personal_information
|
||||
ensure
|
||||
personal_information_assigned: personal_information = a_personal_information
|
||||
end
|
||||
|
||||
set_salt (a_salt: like salt)
|
||||
-- Assign `salt' with `a_salt'.
|
||||
do
|
||||
salt := a_salt
|
||||
ensure
|
||||
salt_assigned: salt = a_salt
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -62,9 +62,12 @@ feature -- Access
|
||||
hashed_password: detachable READABLE_STRING_8
|
||||
-- Hashed user password.
|
||||
|
||||
email: detachable READABLE_STRING_8
|
||||
email: detachable READABLE_STRING_32
|
||||
-- User email.
|
||||
|
||||
profile: detachable CMS_USER_PROFILE
|
||||
-- User profile.
|
||||
|
||||
creation_date: DATE_TIME
|
||||
-- Creation date.
|
||||
|
||||
@@ -77,6 +80,7 @@ feature -- Access
|
||||
-- active
|
||||
-- trashed
|
||||
|
||||
|
||||
feature -- Access: helper
|
||||
|
||||
utf_8_name: STRING_8
|
||||
@@ -186,6 +190,26 @@ feature -- Change element
|
||||
email_set: email = a_email
|
||||
end
|
||||
|
||||
set_profile (prof: like profile)
|
||||
-- Set `profile' with `prof'.
|
||||
do
|
||||
profile := prof
|
||||
ensure
|
||||
profile_set: profile = prof
|
||||
end
|
||||
|
||||
set_profile_item (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
||||
local
|
||||
prof: like profile
|
||||
do
|
||||
prof := profile
|
||||
if prof = Void then
|
||||
create prof.make
|
||||
profile := prof
|
||||
end
|
||||
prof.force (v, k)
|
||||
end
|
||||
|
||||
set_last_login_date (dt: like last_login_date)
|
||||
do
|
||||
last_login_date := dt
|
||||
@@ -261,6 +285,7 @@ feature -- Status change
|
||||
status_set: status = a_status
|
||||
end
|
||||
|
||||
|
||||
feature -- User status
|
||||
|
||||
not_active: INTEGER = 0
|
||||
@@ -277,6 +302,6 @@ invariant
|
||||
id_or_name_set: id > 0 or else not name.is_whitespace
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
56
library/model/src/user/cms_user_profile.e
Normal file
56
library/model/src/user/cms_user_profile.e
Normal file
@@ -0,0 +1,56 @@
|
||||
note
|
||||
description: "[
|
||||
User profile used to extend information associated with a {CMS_USER}.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_USER_PROFILE
|
||||
|
||||
inherit
|
||||
TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create Current profile.
|
||||
do
|
||||
create items.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
|
||||
-- Profile item associated with key `k'.
|
||||
do
|
||||
Result := items.item (k)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
force (v: READABLE_STRING_8; k: READABLE_STRING_GENERAL)
|
||||
-- Associated value `v' with key `k'.
|
||||
do
|
||||
items.force (v, k)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: STRING_TABLE [READABLE_STRING_8]
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -80,7 +80,7 @@ feature -- Cursor
|
||||
|
||||
feature -- Action
|
||||
|
||||
action: FUNCTION [DB_TUPLE, G]
|
||||
action: FUNCTION [ANY, detachable TUPLE, G]
|
||||
-- Agent to create a new item of type G.
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
30
library/persistence/mysql/scripts/core.sql
Normal file
30
library/persistence/mysql/scripts/core.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `logs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`category` VARCHAR(255) NOT NULL,
|
||||
`level` int(11) NOT NULL,
|
||||
`uid` int(11) DEFAULT NULL,
|
||||
`message` text NOT NULL,
|
||||
`info` text,
|
||||
`link` text,
|
||||
`date` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE `custom_values` (
|
||||
`type` VARCHAR(255) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`value` VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE `path_aliases` (
|
||||
`pid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`source` varchar(255) NOT NULL,
|
||||
`alias` varchar(255) NOT NULL,
|
||||
`lang` varchar(12) DEFAULT NULL,
|
||||
PRIMARY KEY (`pid`)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
24
library/persistence/mysql/scripts/node.sql
Normal file
24
library/persistence/mysql/scripts/node.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE nodes (
|
||||
nid INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL CHECK( nid >=0),
|
||||
revision INTEGER,
|
||||
type TEXT NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
summary TEXT,
|
||||
content MEDIUMTEXT NOT NULL,
|
||||
format VARCHAR(255),
|
||||
author INTEGER,
|
||||
publish DATETIME,
|
||||
created DATETIME NOT NULL,
|
||||
changed DATETIME NOT NULL,
|
||||
status INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE page_nodes(
|
||||
nid INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL CHECK( nid >=0),
|
||||
revision INTEGER,
|
||||
parent INTEGER
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
66
library/persistence/mysql/scripts/user.sql
Normal file
66
library/persistence/mysql/scripts/user.sql
Normal file
@@ -0,0 +1,66 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`password` varchar(100) NOT NULL,
|
||||
`salt` varchar(100) NOT NULL,
|
||||
`email` varchar(250) NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
`signed` datetime DEFAULT NULL,
|
||||
CHECK (`uid` >= 0),
|
||||
PRIMARY KEY (`uid`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
);
|
||||
|
||||
CREATE TABLE `roles` (
|
||||
`rid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
CHECK (`rid` >= 0),
|
||||
PRIMARY KEY (`rid`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE `users_roles` (
|
||||
`uid` int(11) NOT NULL,
|
||||
`rid` int(11) NOT NULL,
|
||||
CHECK (`uid` >= 0),
|
||||
CHECK (`rid` >= 0)
|
||||
);
|
||||
|
||||
CREATE TABLE `role_permissions` (
|
||||
`rid` int(11) NOT NULL,
|
||||
`permission` varchar(255) NOT NULL,
|
||||
`module` varchar(255) DEFAULT NULL,
|
||||
CHECK (`rid` >= 0)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE `users_activations` (
|
||||
`aid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`token` varchar(255) NOT NULL,
|
||||
`uid` int(11) NOT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
CHECK (`aid` >= 0),
|
||||
CHECK (`uid` >= 0),
|
||||
PRIMARY KEY (`aid`),
|
||||
UNIQUE KEY `token` (`token`)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE `users_password_recovery` (
|
||||
`aid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`token` varchar(255) NOT NULL,
|
||||
`uid` int(11) NOT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
CHECK (`aid` >= 0),
|
||||
CHECK (`uid` >= 0),
|
||||
PRIMARY KEY (`aid`),
|
||||
UNIQUE KEY `token` (`token`)
|
||||
);
|
||||
|
||||
|
||||
|
||||
COMMIT;
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="store_mysql" uuid="DC757CBD-D8C4-44D6-A07F-C1148D8D233E" library_target="store_mysql">
|
||||
<description>CMS Eiffel Store MySQL persistence solution</description>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="store_mysql" uuid="DC757CBD-D8C4-44D6-A07F-C1148D8D233E" library_target="store_mysql">
|
||||
<target name="store_mysql">
|
||||
<root all_classes="true"/>
|
||||
<option warning="true" is_obsolete_routine_type="false" void_safety="all">
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
@@ -27,9 +26,9 @@
|
||||
</cluster>
|
||||
<cluster name="persistence_store_mysql" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="persistence_store_odbc" uuid="8FD9D3B3-5FC1-495F-A05D-0205EC966841" library_target="persistence_store_odbc">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="persistence_store_odbc" uuid="8FD9D3B3-5FC1-495F-A05D-0205EC966841" library_target="persistence_store_odbc">
|
||||
<target name="persistence_store_odbc">
|
||||
<description>CMS Eiffel Store ODBC persistence solution</description>
|
||||
<root all_classes="true"/>
|
||||
<option warning="true" is_obsolete_routine_type="false" void_safety="all">
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
@@ -23,9 +22,9 @@
|
||||
<cluster name="common" location="..\implementation\store\" recursive="true"/>
|
||||
<cluster name="persistence_store_odbc" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
Recaptcha Eiffel Lbrary
|
||||
|
||||
Based on https://developers.google.com/recaptcha/
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
${NOTE_KEYWORD}
|
||||
copyright: "2011-${YEAR} Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="recaptcha" uuid="2A966489-284A-48A0-91BC-31E84EA9C3B1" library_target="recaptcha">
|
||||
<target name="recaptcha">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" is_obsolete_routine_type="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="http_client_extension" location="..\http_client_extension\http_client_extension-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<cluster name="recaptcha" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="recaptcha" uuid="2A966489-284A-48A0-91BC-31E84EA9C3B1" library_target="recaptcha">
|
||||
<target name="recaptcha">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" void_safety="none">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||
<library name="http_client_extension" location="..\http_client_extension\http_client_extension.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<cluster name="recaptcha" location=".\src\" recursive="true">
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,147 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Simple API to call {RECAPTCHA} Google API.
|
||||
Example call:
|
||||
https://www.google.com/recaptcha/api/siteverify?secret=your_secret&response=response_string&remoteip=user_ip_address
|
||||
]"
|
||||
date: "$Date: 2015-01-28 11:44:15 -0300 (mi. 28 de ene. de 2015) $"
|
||||
revision: "$Revision: 96551 $"
|
||||
EIS: "name=RECAPTCHA", "src=https://developers.google.com/recaptcha/", "protocol=uri"
|
||||
EIS: "name=RECAPTCHA API verify", "src=https://developers.google.com/recaptcha/docs/verify", "protocol=uri"
|
||||
|
||||
class
|
||||
RECAPTCHA_API
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_secret_key, a_response: READABLE_STRING_8)
|
||||
-- Create an object Recaptcha with secret key `a_secret_key' and response token `a_response'.
|
||||
do
|
||||
secret := a_secret_key
|
||||
response := a_response
|
||||
ensure
|
||||
secret_set: secret.same_string (a_secret_key)
|
||||
response_set: response.same_string (a_response)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
base_uri: STRING_8 = "https://www.google.com/recaptcha/api/siteverify"
|
||||
-- Recaptcha base URI
|
||||
|
||||
secret: READABLE_STRING_8
|
||||
-- Required. The shared key between your site and ReCAPTCHA.
|
||||
|
||||
response: READABLE_STRING_8
|
||||
-- Required. The user response token provided by the reCAPTCHA to the user and provided to your site on.
|
||||
|
||||
remoteip: detachable READABLE_STRING_8
|
||||
-- Optional. The user's IP address.
|
||||
|
||||
feature -- Status Reports
|
||||
|
||||
errors: detachable LIST [READABLE_STRING_8]
|
||||
-- optional table of error codes
|
||||
-- missing-input-secret The secret parameter is missing.
|
||||
-- invalid-input-secret The secret parameter is invalid or malformed.
|
||||
-- missing-input-response The response parameter is missing.
|
||||
-- invalid-input-response The response parameter is invalid or malformed.
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
set_remoteip (a_remoteip: READABLE_STRING_8)
|
||||
-- Set `remoteip' with `a_remoteip'.
|
||||
do
|
||||
remoteip := a_remoteip
|
||||
ensure
|
||||
remoteip_set: remoteip = a_remoteip
|
||||
end
|
||||
|
||||
feature -- API
|
||||
|
||||
verify: BOOLEAN
|
||||
-- Verify the user's response
|
||||
local
|
||||
l_parser: JSON_PARSER
|
||||
do
|
||||
if attached get as l_response then
|
||||
if attached l_response.body as l_body then
|
||||
create l_parser.make_with_string (l_body)
|
||||
l_parser.parse_content
|
||||
if
|
||||
l_parser.is_parsed and then attached {JSON_OBJECT} l_parser.parsed_json_object as jv and then
|
||||
attached {JSON_BOOLEAN} jv.item ("success") as l_success
|
||||
then
|
||||
Result := l_success.item
|
||||
if not Result and then attached {JSON_ARRAY} jv.item ("error-codes") as l_error_codes then
|
||||
across
|
||||
l_error_codes as c
|
||||
loop
|
||||
if attached {JSON_STRING} c.item as ji then
|
||||
put_error (ji.unescaped_string_32)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
put_error (l_response.status.out)
|
||||
end
|
||||
else
|
||||
put_error ("unknown")
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- REST API
|
||||
|
||||
get: detachable RESPONSE
|
||||
-- Reading Data
|
||||
local
|
||||
l_request: REQUEST
|
||||
do
|
||||
create l_request.make ("GET", new_uri)
|
||||
Result := l_request.execute
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_uri: STRING_8
|
||||
-- new uri (BaseUri?secret=secret_value&response=response_value[&remoteip=remoteip_value]
|
||||
do
|
||||
create Result.make_from_string (base_uri)
|
||||
Result.append ("?secret=")
|
||||
Result.append (secret)
|
||||
Result.append ("&response=")
|
||||
Result.append (response)
|
||||
if attached remoteip as l_remoteip then
|
||||
Result.append ("&remoteip=" + l_remoteip)
|
||||
end
|
||||
end
|
||||
|
||||
put_error (a_code: READABLE_STRING_GENERAL)
|
||||
local
|
||||
l_errors: like errors
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
l_errors := errors
|
||||
if l_errors = Void then
|
||||
create {ARRAYED_LIST [STRING]} l_errors.make (1)
|
||||
errors := l_errors
|
||||
end
|
||||
l_errors.force (utf.utf_32_string_to_utf_8_string_8 (a_code))
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,61 +0,0 @@
|
||||
note
|
||||
description : "test application root class"
|
||||
date : "$Date: 2015-01-14 15:37:57 -0300 (mi. 14 de ene. de 2015) $"
|
||||
revision : "$Revision: 96458 $"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
ARGUMENTS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Run application.
|
||||
do
|
||||
test_invalid_input
|
||||
test_missing_input
|
||||
test_missing_key_input
|
||||
end
|
||||
|
||||
|
||||
test_invalid_input
|
||||
-- invalid-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("","234")
|
||||
check
|
||||
not_true:not l_captcha.verify
|
||||
end
|
||||
end
|
||||
|
||||
test_missing_input
|
||||
-- missing-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("key","")
|
||||
check
|
||||
not_true:not l_captcha.verify
|
||||
end
|
||||
end
|
||||
|
||||
test_missing_key_input
|
||||
-- missing-input-response
|
||||
-- invalid-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("","")
|
||||
l_captcha.set_remoteip("localhost")
|
||||
check
|
||||
not_true:not l_captcha.verify
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,69 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date: 2015-01-14 15:37:57 -0300 (mi. 14 de ene. de 2015) $"
|
||||
revision: "$Revision: 96458 $"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
RECAPTCHA_API_TEST_SET
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_invalid_input
|
||||
-- invalid-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("","234")
|
||||
check
|
||||
not_true:not l_captcha.verify
|
||||
end
|
||||
assert ("Not true", not l_captcha.verify)
|
||||
assert ("Has error invalid-input-response",has_error (l_captcha,"invalid-input-response"))
|
||||
end
|
||||
|
||||
test_missing_input
|
||||
-- missing-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("key","")
|
||||
check
|
||||
not_true:not l_captcha.verify
|
||||
end
|
||||
assert ("Not true", not l_captcha.verify)
|
||||
assert ("Has error missing-input-response",has_error (l_captcha,"missing-input-response"))
|
||||
end
|
||||
|
||||
test_missing_key_input
|
||||
-- missing-input-response
|
||||
-- invalid-input-response
|
||||
local
|
||||
l_captcha: RECAPTCHA_API
|
||||
do
|
||||
create l_captcha.make ("","")
|
||||
l_captcha.set_remoteip("localhost")
|
||||
assert ("Not true", not l_captcha.verify)
|
||||
assert ("Has error missing-input-response",has_error (l_captcha,"missing-input-response"))
|
||||
assert ("Has error invalid-input-response",has_error (l_captcha,"invalid-input-response"))
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
has_error (l_captcha: RECAPTCHA_API; a_error: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
if attached l_captcha.errors as l_errors then
|
||||
l_errors.compare_objects
|
||||
Result := l_errors.has (a_error)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="test" uuid="CE9FCE69-EE0A-4028-AA02-BD9F8ABA7586">
|
||||
<target name="test">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<option warning="true" void_safety="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<precompile name="base_pre" location="$ISE_PRECOMP\base-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="recaptcha" location="..\recaptcha-safe.ecf" readonly="false"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<cluster name="test" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -166,7 +166,7 @@ feature -- Error
|
||||
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
if attached api.user as l_user then
|
||||
if attached current_user (req) as l_user then
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if
|
||||
l_id.is_integer and then
|
||||
|
||||
@@ -166,7 +166,7 @@ feature -- Error
|
||||
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
if attached api.user as l_user then
|
||||
if attached current_user (req) as l_user then
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if
|
||||
l_id.is_integer and then
|
||||
|
||||
@@ -73,7 +73,7 @@ feature -- Execution
|
||||
s.append ("<div class=%"info%"> ")
|
||||
s.append ("<h4>Account Information</h4>")
|
||||
s.append ("<p>Username: ")
|
||||
s.append (html_encoded (a_user.name))
|
||||
s.append (a_user.name)
|
||||
s.append ("</p>")
|
||||
if attached a_user.email as l_email then
|
||||
s.append ("<p>Email: ")
|
||||
@@ -86,13 +86,12 @@ feature -- Execution
|
||||
not l_roles.is_empty
|
||||
then
|
||||
s.append ("<h4>Role(s):</h4>")
|
||||
s.append ("<ul class=%"user-roles%">")
|
||||
across l_roles as ic loop
|
||||
l_role := ic.item
|
||||
s.append ("<li>")
|
||||
s.append ("<i>")
|
||||
s.append (link (l_role.name, "admin/role/" + l_role.id.out, Void))
|
||||
s.append ("</li>")
|
||||
if request.query_parameter ("debug") /= Void then
|
||||
s.append ("</i>")
|
||||
debug
|
||||
s.append ("<h5>Permissions:</h5>")
|
||||
s.append ("<ul class=%"cms-permissions%">%N")
|
||||
across l_role.permissions as perms_ic loop
|
||||
@@ -101,7 +100,6 @@ feature -- Execution
|
||||
s.append ("</ul>%N")
|
||||
end
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
end
|
||||
|
||||
s.append ("</div>")
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="auth_module" uuid="AAB9EE7D-A671-4727-8658-D417A48B2B57" library_target="auth_module">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="auth_module" uuid="AAB9EE7D-A671-4727-8658-D417A48B2B57" library_target="auth_module">
|
||||
<target name="auth_module">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" is_obsolete_routine_type="true" void_safety="all" syntax="standard">
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="apis" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\consumer\apis\apis.ecf" readonly="false"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="config" location="..\..\library\configuration\config-safe.ecf"/>
|
||||
<library name="cypress_consumer" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\consumer-safe.ecf" readonly="false"/>
|
||||
<library name="email_service" location="..\..\library\email\email-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="recaptcha" location="..\..\library\recaptcha\recaptcha-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
|
||||
<library name="email_service" location="..\..\library\email\email-safe.ecf"/>
|
||||
|
||||
<library name="apis" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\consumer\apis\apis.ecf" readonly="false"/>
|
||||
<library name="cypress_consumer" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\consumer-safe.ecf" readonly="false"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
|
||||
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Common interface for Auth module API.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_AUTH_API_I
|
||||
|
||||
inherit
|
||||
CMS_MODULE_API
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
end
|
||||
@@ -1,44 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Processes a HTTP request, and depending on header, authenticate a current user or not.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_AUTH_FILTER_I
|
||||
|
||||
inherit
|
||||
WSF_FILTER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_api: CMS_API)
|
||||
-- Initialize Current handler with `a_api'.
|
||||
do
|
||||
api := a_api
|
||||
end
|
||||
|
||||
feature -- API Service
|
||||
|
||||
api: CMS_API
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
deferred
|
||||
end
|
||||
|
||||
auth_strategy: STRING
|
||||
deferred
|
||||
end
|
||||
|
||||
set_current_user (u: CMS_USER)
|
||||
do
|
||||
api.set_user (u)
|
||||
-- Record auth strategy:
|
||||
api.set_execution_variable ("auth_strategy", auth_strategy)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,108 +0,0 @@
|
||||
note
|
||||
description: "Common ancestor for Authentication modules."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_AUTH_MODULE_I
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
setup_hooks
|
||||
end
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
package := "authentication"
|
||||
add_dependency ({CMS_AUTHENTICATION_MODULE})
|
||||
end
|
||||
|
||||
feature -- Access: auth strategy
|
||||
|
||||
login_title: READABLE_STRING_GENERAL
|
||||
-- Module specific login title.
|
||||
deferred
|
||||
end
|
||||
|
||||
login_location: STRING
|
||||
-- Login cms location for Current module.
|
||||
deferred
|
||||
end
|
||||
|
||||
logout_location: STRING
|
||||
-- Logout cms location for Current module.
|
||||
deferred
|
||||
end
|
||||
|
||||
is_authenticating (a_response: CMS_RESPONSE): BOOLEAN
|
||||
-- Is Current module strategy currently authenticating active user?
|
||||
deferred
|
||||
ensure
|
||||
Result implies a_response.is_authenticated
|
||||
end
|
||||
|
||||
feature -- Hooks configuration
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- Module hooks configuration.
|
||||
do
|
||||
auto_subscribe_to_hooks (a_hooks)
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
-- <Precursor>
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
l_destination: READABLE_STRING_8
|
||||
do
|
||||
if attached {WSF_STRING} a_response.request.query_parameter ("destination") as p_destination then
|
||||
l_destination := p_destination.value
|
||||
else
|
||||
l_destination := a_response.location
|
||||
end
|
||||
if is_authenticating (a_response) then
|
||||
|
||||
else
|
||||
if a_response.location.starts_with ("account/auth/") then
|
||||
create lnk.make (login_title, login_location)
|
||||
if not l_destination.starts_with ("account/auth/") then
|
||||
lnk.add_query_parameter ("destination", l_destination)
|
||||
end
|
||||
lnk.set_expandable (True)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id'
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
create p.make_from_string ("templates")
|
||||
p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
p := a_response.api.module_theme_resource_location (Current, p)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
else
|
||||
create Result.make (a_block_id, Void, p.parent, p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,211 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_AUTHENTICATION_EMAIL_SERVICE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_AUTHENTICATION_EMAIL_SERVICE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_params: like parameters)
|
||||
-- Create instance of email service with `a_params' data.
|
||||
do
|
||||
parameters := a_params
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize service.
|
||||
do
|
||||
create error_handler.make
|
||||
reset_error
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
parameters: CMS_AUTHENTICATION_EMAIL_SERVICE_PARAMETERS
|
||||
-- Associated parameters.
|
||||
|
||||
cms_api: CMS_API
|
||||
do
|
||||
Result := parameters.cms_api
|
||||
end
|
||||
|
||||
contact_email_address: IMMUTABLE_STRING_8
|
||||
-- contact email.
|
||||
do
|
||||
Result := parameters.contact_email_address
|
||||
end
|
||||
|
||||
notif_email_address: IMMUTABLE_STRING_8
|
||||
-- Site admin's email.
|
||||
do
|
||||
Result := parameters.notif_email_address
|
||||
end
|
||||
|
||||
sender_email_address: IMMUTABLE_STRING_8
|
||||
-- Site sender's email.
|
||||
do
|
||||
Result := parameters.sender_email_address
|
||||
end
|
||||
|
||||
feature -- Error
|
||||
|
||||
error_handler: ERROR_HANDLER
|
||||
|
||||
has_error: BOOLEAN
|
||||
do
|
||||
Result := error_handler.has_error
|
||||
end
|
||||
|
||||
reset_error
|
||||
do
|
||||
error_handler.reset
|
||||
end
|
||||
|
||||
feature -- Basic Operations / Internal
|
||||
|
||||
send_internal_email (a_content: READABLE_STRING_GENERAL)
|
||||
do
|
||||
send_message (sender_email_address, notif_email_address, "Notification Contact", a_content)
|
||||
end
|
||||
|
||||
send_email_internal_server_error (a_content: READABLE_STRING_GENERAL)
|
||||
do
|
||||
send_message (sender_email_address, notif_email_address, "Internal Server Error", a_content)
|
||||
end
|
||||
|
||||
feature -- Basic Operations / Contact
|
||||
|
||||
send_account_evaluation (a_user: CMS_USER; a_application, a_url_activate, a_url_reject, a_host: READABLE_STRING_8)
|
||||
-- Send new user register to webmaster to confirm or reject itt.
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_evaluation)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
if attached a_user.email as l_email then
|
||||
l_message.replace_substring_all ("$email", l_email)
|
||||
else
|
||||
l_message.replace_substring_all ("$email", "unknown email")
|
||||
end
|
||||
l_message.replace_substring_all ("$application", a_application)
|
||||
l_message.replace_substring_all ("$activation_url", a_url_activate)
|
||||
l_message.replace_substring_all ("$rejection_url", a_url_reject)
|
||||
send_message (contact_email_address, contact_email_address, parameters.contact_subject_account_evaluation, l_message)
|
||||
end
|
||||
|
||||
send_contact_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_host: READABLE_STRING_8)
|
||||
-- Send successful contact message for user `a_user' to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_activation)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_register, l_message)
|
||||
end
|
||||
|
||||
send_contact_activation_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_link, a_host: READABLE_STRING_8)
|
||||
-- Send successful message activation to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_re_activation)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$link", a_link)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_activate, l_message)
|
||||
end
|
||||
|
||||
send_contact_activation_confirmation_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_host: READABLE_STRING_8)
|
||||
-- Send successful message activation to a_to.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_activation_confirmation)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_activated, l_message)
|
||||
end
|
||||
|
||||
send_contact_activation_reject_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_host: READABLE_STRING_8)
|
||||
-- Send successful contact activation reject message to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_rejected)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_rejected, l_message)
|
||||
end
|
||||
|
||||
send_contact_password_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_link, a_host: READABLE_STRING_8)
|
||||
-- Send successful new account password message to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_password)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$link", a_link)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_password, l_message)
|
||||
end
|
||||
|
||||
send_contact_welcome_email (a_to: READABLE_STRING_8; a_user: CMS_USER; a_host: READABLE_STRING_8)
|
||||
-- Send successful welcome message to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_welcome)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_oauth, l_message)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
send_message (a_from_address, a_to_address: READABLE_STRING_8; a_subjet: READABLE_STRING_GENERAL; a_content: READABLE_STRING_GENERAL)
|
||||
local
|
||||
l_email: CMS_EMAIL
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
reset_error
|
||||
l_email := cms_api.new_email (a_to_address, utf.escaped_utf_32_string_to_utf_8_string_8 (a_subjet), utf.escaped_utf_32_string_to_utf_8_string_8 (a_content))
|
||||
l_email.set_from_address (a_from_address)
|
||||
l_email.add_header_line ("MIME-Version:1.0")
|
||||
l_email.add_header_line ("Content-Type: text/html; charset=utf-8")
|
||||
cms_api.process_email (l_email)
|
||||
if cms_api.has_error then
|
||||
error_handler.add_custom_error (-1, generator + "send_message failed", cms_api.string_representation_of_errors)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -6,6 +6,9 @@ note
|
||||
class
|
||||
CMS_AUTHENTICATION_EMAIL_SERVICE_PARAMETERS
|
||||
|
||||
inherit
|
||||
EMAIL_SERVICE_PARAMETERS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -14,21 +17,25 @@ feature {NONE} -- Initialization
|
||||
make (a_cms_api: CMS_API)
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
l_site_name: READABLE_STRING_8
|
||||
s: detachable READABLE_STRING_32
|
||||
l_utf8_site_name: IMMUTABLE_STRING_8
|
||||
l_contact_email, l_subject_register, l_subject_activate, l_subject_password, l_subject_oauth: detachable READABLE_STRING_8
|
||||
do
|
||||
cms_api := a_cms_api
|
||||
create l_utf8_site_name.make_from_string (a_cms_api.setup.utf_8_site_name)
|
||||
utf_8_site_name := l_utf8_site_name
|
||||
notif_email_address := a_cms_api.setup.site_notification_email
|
||||
sender_email_address := a_cms_api.setup.site_email
|
||||
-- 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)
|
||||
admin_email := a_cms_api.setup.site_email
|
||||
|
||||
if not notif_email_address.has ('<') then
|
||||
notif_email_address := l_utf8_site_name + " <" + notif_email_address + ">"
|
||||
if not admin_email.has ('<') then
|
||||
admin_email := l_site_name + " <" + admin_email +">"
|
||||
end
|
||||
|
||||
if attached a_cms_api.module_configuration_by_name ({CMS_AUTHENTICATION_MODULE}.name, Void) as cfg then
|
||||
if attached {CONFIG_READER} a_cms_api.module_configuration_by_name ({CMS_AUTHENTICATION_MODULE}.name, Void) as cfg then
|
||||
if attached cfg.text_item ("smtp") as l_smtp then
|
||||
-- Overwrite global smtp setting if any.
|
||||
smtp_server := utf.utf_32_string_to_utf_8_string_8 (l_smtp)
|
||||
end
|
||||
s := cfg.text_item ("email")
|
||||
if s /= Void then
|
||||
l_contact_email := utf.utf_32_string_to_utf_8_string_8 (s)
|
||||
@@ -49,15 +56,16 @@ feature {NONE} -- Initialization
|
||||
if s /= Void then
|
||||
l_subject_oauth := utf.utf_32_string_to_utf_8_string_8 (s)
|
||||
end
|
||||
end
|
||||
if l_contact_email = Void then
|
||||
l_contact_email := notif_email_address
|
||||
end
|
||||
if not l_contact_email.has ('<') then
|
||||
l_contact_email := l_utf8_site_name + " <" + l_contact_email + ">"
|
||||
end
|
||||
contact_email_address := l_contact_email
|
||||
|
||||
end
|
||||
if l_contact_email /= Void then
|
||||
if not l_contact_email.has ('<') then
|
||||
l_contact_email := l_site_name + " <" + l_contact_email + ">"
|
||||
end
|
||||
contact_email := l_contact_email
|
||||
else
|
||||
contact_email := admin_email
|
||||
end
|
||||
if l_subject_register /= Void then
|
||||
contact_subject_register := l_subject_register
|
||||
else
|
||||
@@ -80,40 +88,23 @@ feature {NONE} -- Initialization
|
||||
contact_subject_oauth := "Welcome."
|
||||
end
|
||||
|
||||
contact_subject_account_evaluation := "New register, account evalution."
|
||||
contact_subject_rejected := "Your account was rejected."
|
||||
contact_subject_activated := "Your account was activated."
|
||||
end
|
||||
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
cms_api: CMS_API
|
||||
|
||||
notif_email_address: IMMUTABLE_STRING_8
|
||||
smtp_server: IMMUTABLE_STRING_8
|
||||
|
||||
sender_email_address: IMMUTABLE_STRING_8
|
||||
admin_email: IMMUTABLE_STRING_8
|
||||
|
||||
contact_email_address: IMMUTABLE_STRING_8
|
||||
contact_email: IMMUTABLE_STRING_8
|
||||
-- Contact email.
|
||||
|
||||
utf_8_site_name: IMMUTABLE_STRING_8
|
||||
-- UTF-8 encoded Site name.
|
||||
|
||||
contact_subject_account_evaluation: IMMUTABLE_STRING_8
|
||||
contact_subject_register: IMMUTABLE_STRING_8
|
||||
contact_subject_activate: IMMUTABLE_STRING_8
|
||||
contact_subject_password: IMMUTABLE_STRING_8
|
||||
contact_subject_oauth: IMMUTABLE_STRING_8
|
||||
contact_subject_rejected: IMMUTABLE_STRING_8
|
||||
contact_subject_activated: IMMUTABLE_STRING_8
|
||||
|
||||
account_evaluation: STRING
|
||||
-- Account evaluation template email message.
|
||||
do
|
||||
Result := template_string ("admin_account_evaluation.html", default_template_account_evaluation)
|
||||
end
|
||||
|
||||
account_activation: STRING
|
||||
-- Account activation template email message.
|
||||
@@ -121,22 +112,10 @@ feature -- Access
|
||||
Result := template_string ("account_activation.html", default_template_account_activation)
|
||||
end
|
||||
|
||||
account_activation_confirmation: STRING
|
||||
-- Account activation confirmation template email message.
|
||||
do
|
||||
Result := template_string ("account_activation_confirmation.html", default_template_account_activation_confirmation)
|
||||
end
|
||||
|
||||
account_re_activation: STRING
|
||||
-- Account re_activation template email message.
|
||||
do
|
||||
Result := template_string ("account_re_activation.html", default_template_account_re_activation)
|
||||
end
|
||||
|
||||
account_rejected: STRING
|
||||
-- Account rejected template email message.
|
||||
do
|
||||
Result := template_string ("account_rejected.html", default_template_account_rejected)
|
||||
Result := template_string ("accunt_re_activation.html", default_template_account_re_activation)
|
||||
end
|
||||
|
||||
account_password: STRING
|
||||
@@ -167,7 +146,7 @@ feature {NONE} -- Implementation: Template
|
||||
local
|
||||
p: PATH
|
||||
do
|
||||
p := template_path (a_name)
|
||||
p := template_path ("account_activation.html")
|
||||
if attached read_template_file (p) as l_content then
|
||||
Result := l_content
|
||||
else
|
||||
@@ -198,36 +177,6 @@ feature {NONE} -- Implementation
|
||||
|
||||
feature {NONE} -- Message email
|
||||
|
||||
default_template_account_evaluation: STRING = "[
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Account Evaluation</title>
|
||||
<meta name="description" content="Account Evaluation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2> Account Evaluation </h2>
|
||||
<p>The user $user ($email) wants to register to the site <a href="$host">$sitename</a></p>
|
||||
|
||||
<blockquote><p>This is his/her application.</p>
|
||||
<p>$application</p>
|
||||
</blockquote>
|
||||
|
||||
<p>To complete the registration, please click on the following link to activate the user account:<p>
|
||||
|
||||
<p><a href="$activation_url">$activation_url</a></p>
|
||||
|
||||
<p>To reject the registration, please click on the following link <p>
|
||||
|
||||
<p><a href="$rejection_url">$rejection_url</a></p>
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
|
||||
|
||||
default_template_account_activation: STRING = "[
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
@@ -235,53 +184,21 @@ feature {NONE} -- Message email
|
||||
<meta charset="utf-8">
|
||||
<title>Activation</title>
|
||||
<meta name="description" content="Activation">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Thank you for applying to <a href="$host">$sitename</a> $user</p>
|
||||
<p>Thank you for registering at <a href="...">ROC CMS</a></p>
|
||||
|
||||
<p>We will review your application and send you an email<p>
|
||||
<p>To complete your registration, please click on the following link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
|
||||
|
||||
default_template_account_activation_confirmation: STRING = "[
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Activation</title>
|
||||
<meta name="description" content="Activation Confirmation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Your account has been confirmed <a href="$host">$sitename</a> $email</p>
|
||||
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
|
||||
default_template_account_rejected: STRING = "[
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Application Rejected</title>
|
||||
<meta name="description" content="Application Rejected">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Your account application is rejected, it does not conform our rules <a href="$host">$sitename</a></p>
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
|
||||
default_template_account_re_activation: STRING = "[
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
@@ -289,11 +206,11 @@ feature {NONE} -- Message email
|
||||
<meta charset="utf-8">
|
||||
<title>New Activation</title>
|
||||
<meta name="description" content="New Activation token">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have requested a new activation token at <a href="$host">$sitename</a></p>
|
||||
<p>You have requested a new activation token at <a href="...">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on the following link to activate your account:<p>
|
||||
|
||||
@@ -312,11 +229,11 @@ feature {NONE} -- Message email
|
||||
<meta charset="utf-8">
|
||||
<title>New Password</title>
|
||||
<meta name="description" content="New Password">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have requested a new password at <a href="$host">$sitename</a></p>
|
||||
<p>You have required a new password at <a href="...">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your request, please click on this link to generate a new password:<p>
|
||||
|
||||
@@ -333,11 +250,11 @@ feature {NONE} -- Message email
|
||||
<meta charset="utf-8">
|
||||
<title>Welcome</title>
|
||||
<meta name="description" content="Welcome">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Welcome to <a href="$host">$sitename</a>.</p>
|
||||
<p>Welcome to<a href="...">ROC CMS</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
88
modules/auth/cms_authenticaton_email_service.e
Normal file
88
modules/auth/cms_authenticaton_email_service.e
Normal file
@@ -0,0 +1,88 @@
|
||||
note
|
||||
description: "Summary description for {CMS_AUTHENTICATON_EMAIL_SERVICE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_AUTHENTICATON_EMAIL_SERVICE
|
||||
|
||||
inherit
|
||||
EMAIL_SERVICE
|
||||
redefine
|
||||
initialize,
|
||||
parameters
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
contact_email := parameters.contact_email
|
||||
end
|
||||
|
||||
parameters: CMS_AUTHENTICATION_EMAIL_SERVICE_PARAMETERS
|
||||
-- Associated parameters.
|
||||
|
||||
feature -- Access
|
||||
|
||||
contact_email: IMMUTABLE_STRING_8
|
||||
-- contact email.
|
||||
|
||||
feature -- Basic Operations
|
||||
|
||||
send_contact_email (a_to, a_content: READABLE_STRING_8)
|
||||
-- Send successful contact message `a_token' to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_activation)
|
||||
l_message.replace_substring_all ("$link", a_content)
|
||||
send_message (contact_email, a_to, parameters.contact_subject_register, l_message)
|
||||
end
|
||||
|
||||
|
||||
send_contact_activation_email (a_to, a_content: READABLE_STRING_8)
|
||||
-- Send successful contact message `a_token' to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_re_activation)
|
||||
l_message.replace_substring_all ("$link", a_content)
|
||||
send_message (contact_email, a_to, parameters.contact_subject_activate, l_message)
|
||||
end
|
||||
|
||||
|
||||
send_contact_password_email (a_to, a_content: READABLE_STRING_8)
|
||||
-- Send successful contact message `a_token' to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_password)
|
||||
l_message.replace_substring_all ("$link", a_content)
|
||||
send_message (contact_email, a_to, parameters.contact_subject_password, l_message)
|
||||
end
|
||||
|
||||
send_contact_welcome_email (a_to, a_content: READABLE_STRING_8)
|
||||
-- Send successful contact message `a_token' to `a_to'.
|
||||
require
|
||||
attached_to: a_to /= Void
|
||||
local
|
||||
l_message: STRING
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"subject": "Thank you for contacting us",
|
||||
"recaptcha": {
|
||||
"site_key":"6Lex9RMTAAAAAKleC4x6TaRlFcpLbEWgH_U7MSiD",
|
||||
"secret_key":"6Lex9RMTAAAAAAkBczvX5DUiyg_xoM_EthVVgRRx"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
ul.cms-temp-users {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li {
|
||||
border-top: dotted 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li {
|
||||
border-top: dotted 1px #ccc;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li.cms_temp_user_detail_information::before {
|
||||
content: "[personal information] ";
|
||||
}
|
||||
ul.cms-temp-users li.cms_temp_user ul.cms_temp_user_details li.cms_temp_user_detail_email::before {
|
||||
content: "[email] ";
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
ul.cms-temp-users {
|
||||
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_temp_user {
|
||||
|
||||
ul.cms_temp_user_details {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
li.cms_temp_user_detail_information::before{
|
||||
content: "[personal information] "
|
||||
}
|
||||
li.cms_temp_user_detail_email::before{
|
||||
content: "[email] "
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Activation</title>
|
||||
<meta name="description" content="Activation">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>"$user ($email)", thank you for applying to <a href="$host">$sitename</a>.</p>
|
||||
<p>We will review your application and send you a resolution.<p>
|
||||
<p>Thank you for registering at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on this link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Activation Confirmation</title>
|
||||
<meta name="description" content="Activation Confirmation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
<body>
|
||||
<p>Your account "$user ($email)" is confirmed at <a href="$host">$sitename</a>.</p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,12 +4,14 @@
|
||||
<meta charset="utf-8">
|
||||
<title>New Password</title>
|
||||
<meta name="description" content="New Password">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have requested a new password at <a href="$host">$sitename</a>.</p>
|
||||
<p>To complete your request, please click on the following link to generate a new password:
|
||||
<ul><a href="$link">$link</a></ul>
|
||||
</p>
|
||||
<p>You have required a new password at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your request, please click on this link to genereate a new password:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<title>New Activation</title>
|
||||
<meta name="description" content="New Activation token">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
<body>
|
||||
<p>You have requested a new activation token at <a href="$host">$sitename</a>.</p>
|
||||
|
||||
<p>To complete your registration, please click on the following link to re-activate your account:
|
||||
<ul><a href="$link">$link</a></ul>
|
||||
</p>
|
||||
<body>
|
||||
<p>You have request a new activation token at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on this link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Application Rejected</title>
|
||||
<meta name="description" content="Application Rejected">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
<body>
|
||||
<p>Your account application is rejected, it was not respecting the requirements from <a href="$host">$sitename</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,16 +4,10 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Welcome</title>
|
||||
<meta name="description" content="Welcome">
|
||||
<meta name="author" content="$sitename">
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
<body>
|
||||
<p>Welcome to <a href="$host">$sitename</a>.</p>
|
||||
<p>Your account information:
|
||||
<ul>
|
||||
<li>Email address: "$email" .</li>
|
||||
<li>User name: "$user" .</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>Welcome to<a href="$host">ROC CMS</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Account Evaluation</title>
|
||||
<meta name="description" content="Account Evaluation">
|
||||
<meta name="author" content="$sitename">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2> Account Evaluation </h2>
|
||||
<p>The user $user ($email) wants to register to the site <a href="$host">$sitename</a></p>
|
||||
|
||||
<blockquote><p>User application:</p>
|
||||
<p>$application</p>
|
||||
</blockquote>
|
||||
|
||||
<p>To complete the registration, please click on the following link to activate the user account:<p>
|
||||
|
||||
<p><a href="$activation_url">$activation_url</a></p>
|
||||
|
||||
<p>To reject the registration, please click on the following link <p>
|
||||
|
||||
<p><a href="$rejection_url">$rejection_url</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
{include file="block_account_info.tpl" /}
|
||||
@@ -1,34 +1,62 @@
|
||||
<div class="primary-tabs">
|
||||
{if isset="$user"}
|
||||
<h3>Account Information</h3>
|
||||
<ul class="user-information">
|
||||
<div>
|
||||
<label>Username:</label> {$user.name/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Email:</label> {$user.email/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Creation Date:</label> {$user.creation_date/} (UTC)
|
||||
</div>
|
||||
<div>
|
||||
<label>Last login:</label> {$user.last_login_date/} (UTC)
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<form method="get" action="{$site_url/}account/roc-logout">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</ul>
|
||||
<div>
|
||||
<label>Username:</label> {$user.name/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Email:</label> {$user.email/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Creation Date:</label> {$user.creation_date/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Last login:</label> {$user.last_login_date/}
|
||||
</div>
|
||||
<div>
|
||||
<form method="get" action="{$site_url/}{$auth_login_strategy/}">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
{include file="block_change_password.tpl" /}
|
||||
<hr>
|
||||
<h4>Roles</h4>
|
||||
<div>
|
||||
{foreach item="ic" from="$roles"}
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>{$ic.name/}</strong>
|
||||
<ul>
|
||||
<li> <i>permissions</i>
|
||||
<ul>
|
||||
{foreach item="ip" from="$ic.permissions"}
|
||||
<li>{$ip/}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<h4>Profile</h4>
|
||||
<ul class="user-profile">
|
||||
<div>
|
||||
{foreach item="the_value" key="the_name" from="$user.profile"}
|
||||
<li>
|
||||
<label>{$the_name/}:</label><div>{$the_value/}</div>
|
||||
</li>
|
||||
<div>
|
||||
<label>{$the_name/}:</label> {$the_value/}
|
||||
</div>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
{unless isset="$user"}
|
||||
<div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/change-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Change Password</legend>
|
||||
<legend>Change Password Form</legend>
|
||||
<div>
|
||||
<input type="password" id="password" name="password" value="" required/>
|
||||
<label for="password">Password</label>
|
||||
|
||||
29
modules/auth/site/templates/block_login.tpl
Normal file
29
modules/auth/site/templates/block_login.tpl
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="primary-tabs">
|
||||
{unless isset="$user"}
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<div>
|
||||
<form action method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" required>
|
||||
<label>Username</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="password" name="password" required>
|
||||
<label>Password</label>
|
||||
</div>
|
||||
|
||||
<button type="button" onclick="ROC_AUTH.login();">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<p>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<p>Thanks for your application, we will review it to activate your account.</p>
|
||||
<p>We have send you a new activation code, check your email to activate your account.</p>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<p>Thanks for your application, we will review it to activate your account.</p>
|
||||
<p>Thanks for register, check your email to activate your account.</p>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/roc-register" method="post">
|
||||
<fieldset>
|
||||
<legend>Registration</legend>
|
||||
<legend>Register Form</legend>
|
||||
<div>
|
||||
<input type="text" id="name" name="name" value="{$name/}" required autofocus />
|
||||
<label for="name">Name</label>
|
||||
@@ -20,19 +20,8 @@
|
||||
<span><i>{$error_email/}</i></span> <br>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>
|
||||
{$personal_information/}
|
||||
</textarea>
|
||||
<label for="personal_information">Tell us why you want to register an account</label>
|
||||
{if isset="$error_application"}
|
||||
<span><i>{$error_application/}</i></span> <br>
|
||||
{/if}
|
||||
</div>
|
||||
{unless isempty="$recaptcha_site_key"}
|
||||
<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div>
|
||||
<br/>
|
||||
{/unless}
|
||||
|
||||
|
||||
<button type="submit">Register</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -10,17 +10,24 @@ class
|
||||
CMS_BASIC_AUTH_MODULE
|
||||
|
||||
inherit
|
||||
CMS_AUTH_MODULE_I
|
||||
rename
|
||||
module_api as basic_auth_api
|
||||
CMS_MODULE
|
||||
redefine
|
||||
make,
|
||||
filters,
|
||||
setup_hooks
|
||||
end
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_VALUE_TABLE_ALTER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -28,42 +35,26 @@ feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
Precursor
|
||||
version := "1.0"
|
||||
description := "Service to manage basic authentication"
|
||||
package := "authentication"
|
||||
add_dependency ({CMS_AUTHENTICATION_MODULE})
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING = "basic_auth"
|
||||
|
||||
feature -- Access: auth strategy
|
||||
feature -- Access: router
|
||||
|
||||
login_title: STRING = "Basic Auth"
|
||||
-- Module specific login title.
|
||||
|
||||
login_location: STRING = "account/auth/roc-basic-login"
|
||||
|
||||
do_login_location: STRING = "roc-basic-login" -- IMPORTANT: it has to be at the root !
|
||||
|
||||
logout_location: STRING = "roc-basic-logoff" -- IMPORTANT: it has to be at the root !
|
||||
|
||||
is_authenticating (a_response: CMS_RESPONSE): BOOLEAN
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
if
|
||||
a_response.is_authenticated and then
|
||||
a_response.request.http_authorization /= Void
|
||||
then
|
||||
Result := True
|
||||
end
|
||||
configure_api_login (a_api, a_router)
|
||||
configure_api_logoff (a_api, a_router)
|
||||
a_router.handle ("/account/roc-basic-auth", create {WSF_URI_AGENT_HANDLER}.make (agent handle_login_basic_auth (a_api, ?, ?)), a_router.methods_head_get)
|
||||
end
|
||||
|
||||
feature {CMS_API} -- Access: API
|
||||
|
||||
oauth20_api: detachable CMS_AUTH_API_I
|
||||
-- <Precursor>
|
||||
|
||||
feature -- Access: filter
|
||||
|
||||
filters (a_api: CMS_API): detachable LIST [WSF_FILTER]
|
||||
@@ -74,16 +65,6 @@ feature -- Access: filter
|
||||
Result.extend (create {CMS_BASIC_AUTH_FILTER}.make (a_api))
|
||||
end
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
configure_api_login (a_api, a_router)
|
||||
configure_api_logoff (a_api, a_router)
|
||||
a_router.handle ("/" + login_location, create {WSF_URI_AGENT_HANDLER}.make (agent handle_login_basic_auth (a_api, ?, ?)), a_router.methods_head_get)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: routes
|
||||
|
||||
configure_api_login (api: CMS_API; a_router: WSF_ROUTER)
|
||||
@@ -94,7 +75,7 @@ feature {NONE} -- Implementation: routes
|
||||
create l_bal_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle ("/" + do_login_location, l_bal_handler, l_methods)
|
||||
a_router.handle ("/basic_auth_login", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_logoff (api: CMS_API; a_router: WSF_ROUTER)
|
||||
@@ -105,38 +86,16 @@ feature {NONE} -- Implementation: routes
|
||||
create l_bal_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle ("/" + logout_location, l_bal_handler, l_methods)
|
||||
a_router.handle ("/basic_auth_logoff", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
|
||||
handle_login_basic_auth (api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
r: CMS_RESPONSE
|
||||
vals: CMS_VALUE_TABLE
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
if api.user_is_authenticated then
|
||||
r.add_error_message ("You are already signed in!")
|
||||
r.set_main_content (r.link ("Logout", "account/roc-logout", Void))
|
||||
else
|
||||
if attached template_block ("login", r) as l_tpl_block then
|
||||
r.add_javascript_url (r.url ("module/" + name + "/files/js/roc_basic_auth.js", Void))
|
||||
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
api.hooks.invoke_value_table_alter (vals, r)
|
||||
across
|
||||
vals as ic
|
||||
loop
|
||||
l_tpl_block.set_value (ic.item, ic.key)
|
||||
end
|
||||
r.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
r.add_warning_message ("Error with block [login]")
|
||||
end
|
||||
end
|
||||
r.set_value ("Basic Auth", "optional_content_type")
|
||||
end
|
||||
r.set_value ("Basic Auth", "optional_content_type")
|
||||
r.execute
|
||||
end
|
||||
|
||||
@@ -145,25 +104,103 @@ feature -- Hooks configuration
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- Module hooks configuration.
|
||||
do
|
||||
Precursor (a_hooks)
|
||||
auto_subscribe_to_hooks (a_hooks)
|
||||
a_hooks.subscribe_to_block_hook (Current)
|
||||
a_hooks.subscribe_to_value_table_alter_hook (Current)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
value_table_alter (a_value: CMS_VALUE_TABLE; a_response: CMS_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := <<"?login">>
|
||||
if a_response.is_authenticated then
|
||||
a_value.force ("basic_auth_logoff", "auth_login_strategy")
|
||||
end
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
-- Hook execution on collection of menu contained by `a_menu_system'
|
||||
-- for related response `a_response'.
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
lnk2: detachable CMS_LINK
|
||||
do
|
||||
if attached a_response.user as u then
|
||||
across
|
||||
a_menu_system.primary_menu.items as ic
|
||||
until
|
||||
lnk2 /= Void
|
||||
loop
|
||||
if ic.item.location.same_string ("account/roc-logout") then
|
||||
lnk2 := ic.item
|
||||
end
|
||||
end
|
||||
|
||||
if lnk2 /= Void then
|
||||
a_menu_system.primary_menu.remove (lnk2)
|
||||
end
|
||||
|
||||
create lnk.make ("Logout", "basic_auth_logoff")
|
||||
lnk.set_weight (98)
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
else
|
||||
if a_response.location.starts_with ("account/") then
|
||||
create lnk.make ("Basic Auth", "account/roc-basic-auth")
|
||||
lnk.set_expandable (True)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
local
|
||||
l_string: STRING
|
||||
do
|
||||
Result := <<"login">>
|
||||
debug ("roc")
|
||||
create l_string.make_empty
|
||||
across
|
||||
Result as ic
|
||||
loop
|
||||
l_string.append (ic.item)
|
||||
l_string.append_character (' ')
|
||||
end
|
||||
write_debug_log (generator + ".block_list:" + l_string )
|
||||
end
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
if a_block_id.is_case_insensitive_equal_general ("login") then
|
||||
if
|
||||
a_block_id.is_case_insensitive_equal_general ("login") and then
|
||||
a_response.location.starts_with ("account/roc-basic-auth")
|
||||
then
|
||||
a_response.add_javascript_url (a_response.url ("module/" + name + "/files/js/roc_basic_auth.js", Void))
|
||||
get_block_view_login (a_block_id, a_response)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id'
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
create p.make_from_string ("templates")
|
||||
p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
|
||||
p := a_response.api.module_theme_resource_location (Current, p)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
else
|
||||
create Result.make (a_block_id, Void, p.parent, p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Block views
|
||||
|
||||
get_block_view_login (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
@@ -173,7 +210,7 @@ feature {NONE} -- Block views
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||
value_table_alter (vals, a_response)
|
||||
across
|
||||
vals as ic
|
||||
loop
|
||||
|
||||
@@ -9,46 +9,54 @@ class
|
||||
CMS_BASIC_AUTH_FILTER
|
||||
|
||||
inherit
|
||||
CMS_AUTH_FILTER_I
|
||||
|
||||
REFACTORING_HELPER
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
CMS_HANDLER
|
||||
WSF_FILTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
auth_strategy: STRING
|
||||
do
|
||||
Result := {CMS_BASIC_AUTH_MODULE}.logout_location
|
||||
end
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the filter.
|
||||
local
|
||||
l_auth: HTTP_AUTHORIZATION
|
||||
do
|
||||
api.logger.put_debug (generator + ".execute ", Void)
|
||||
create l_auth.make (req.http_authorization)
|
||||
if
|
||||
l_auth.is_basic and then
|
||||
attached l_auth.login as l_auth_login and then
|
||||
attached l_auth.password as l_auth_password
|
||||
then
|
||||
if
|
||||
api.user_api.is_valid_credential (l_auth_login, l_auth_password) and then
|
||||
attached api.user_api.user_by_name (l_auth_login) as l_user
|
||||
then
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Maybe we need to store in the credentials in a shared context SECURITY_CONTEXT")
|
||||
-- req.set_execution_variable ("security_content", create SECURITY_CONTEXT.make (l_user))
|
||||
-- other authentication filters (OpenID, etc) should implement the same approach.
|
||||
end
|
||||
set_current_user (l_user)
|
||||
else
|
||||
api.logger.put_error (generator + ".execute login_valid failed for: " + l_auth_login, Void)
|
||||
debug
|
||||
if attached req.raw_header_data as l_raw_data then
|
||||
api.logger.put_debug (generator + ".execute " + (create {UTF_CONVERTER}).escaped_utf_32_string_to_utf_8_string_8 (l_raw_data), Void)
|
||||
end
|
||||
end
|
||||
execute_next (req, res)
|
||||
-- A valid user
|
||||
if
|
||||
(attached l_auth.type as l_auth_type and then l_auth_type.is_case_insensitive_equal_general ("basic")) and then
|
||||
attached l_auth.login as l_auth_login and then attached l_auth.password as l_auth_password
|
||||
then
|
||||
if api.user_api.is_valid_credential (l_auth_login, l_auth_password) then
|
||||
if attached api.user_api.user_by_name (l_auth_login) as l_user then
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Maybe we need to store in the credentials in a shared context SECURITY_CONTEXT")
|
||||
-- req.set_execution_variable ("security_content", create SECURITY_CONTEXT.make (l_user))
|
||||
-- other authentication filters (OpenID, etc) should implement the same approach.
|
||||
end
|
||||
set_current_user (req, l_user)
|
||||
execute_next (req, res)
|
||||
else
|
||||
debug ("refactor_fixme")
|
||||
to_implement ("Internal server error")
|
||||
end
|
||||
end
|
||||
else
|
||||
api.logger.put_error (generator + ".execute login_valid failed for: " + l_auth_login, Void)
|
||||
execute_next (req, res)
|
||||
end
|
||||
else
|
||||
api.logger.put_debug (generator + ".execute without authentication", Void)
|
||||
execute_next (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user