Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/groovy"/>
<classpathentry kind="src" path="grails-app/conf"/>
<classpathentry kind="src" path="grails-app/controllers"/>
<classpathentry kind="src" path="grails-app/domain"/>
<classpathentry kind="src" path="grails-app/services"/>
<classpathentry kind="src" path="grails-app/taglib"/>
<classpathentry kind="src" path="grails-app/utils"/>
<classpathentry kind="src" path="test/integration"/>
<classpathentry kind="src" path="test/unit"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path=".link_to_grails_plugins/mail-1.0/grails-app/i18n">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/mail-1.0/grails-app/services">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/mail-1.0/grails-app/taglib">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/mail-1.0/grails-app/views">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/mail-1.0/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy" kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/conf">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/controllers">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/i18n">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/taglib">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/views">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/src/java">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy" kind="src" path=".link_to_grails_plugins/quartz-1.0-RC2/grails-app/conf">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/quartz-1.0-RC2/grails-app/services">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/quartz-1.0-RC2/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/quartz-1.0-RC2/src/java">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.0.3/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.0.3/src/java">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/rest-client-builder-1.0.2/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/svn-1.0.1/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target-eclipse/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
32 changes: 32 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EmailConfirmation</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.grails.ide.eclipse.core.nature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<locationURI>GRAILS_ROOT/2.2.4/projects/EmailConfirmation/plugins</locationURI>
</link>
</linkedResources>
</projectDescription>
17 changes: 17 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
eclipse.preferences.version=1
encoding//.link_to_grails_plugins/hibernate-2.2.3/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/hibernate-2.2.3/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n/messages_fr.properties=UTF-8
encoding//.link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/platform-core-1.0.M7-SNAPSHOT/grails-app/i18n/messages.properties=UTF-8
encoding//grails-app/i18n=UTF-8
encoding//grails-app/i18n/messages.properties=UTF-8
encoding//grails-app/i18n/messages_de.properties=UTF-8
encoding//grails-app/i18n/messages_fr.properties=UTF-8
encoding//grails-app/i18n/messages_it.properties=UTF-8
encoding//grails-app/i18n/messages_ja.properties=UTF-8
encoding//grails-app/i18n/messages_nl.properties=UTF-8
encoding//grails-app/i18n/messages_ru.properties=UTF-8
encoding//grails-app/i18n/messages_zh_CN.properties=UTF-8
2 changes: 2 additions & 0 deletions .settings/org.eclipse.jdt.groovy.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
groovy.compiler.level=20
4 changes: 4 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="grails.app" version="1.0"/>
</faceted-project>
3 changes: 3 additions & 0 deletions .settings/org.grails.ide.eclipse.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.grails.ide.eclipse.core.org.grails.ide.eclipse.core.install.name=Grails 2.2.4
org.grails.ide.eclipse.core.use.default.install=false
9 changes: 2 additions & 7 deletions EmailConfirmationGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ import grails.util.Environment


class EmailConfirmationGrailsPlugin {
def version = "2.0-SNAPSHOT"
def version = "2.0.6-WITH-CHANGES"

def grailsVersion = "1.3 > *"
def dependsOn = [
platformCore:'1.0.M1-SNAPSHOT > *',
mail:"1.0 > *",
quartz:"0.4.2 > *"
]

def loadAfter = ['logging']

Expand All @@ -38,7 +33,7 @@ class EmailConfirmationGrailsPlugin {
def authorEmail = "marc@grailsrocks.com"
def title = "Email Confirmation"
def description = '''\\
Send emails to users to perform click-through confirmations of any kinds.
Send emails to users to perform click-through confirmations of any kind.
'''

// URL to the plugin's documentation
Expand Down
12 changes: 7 additions & 5 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#Grails Metadata file
#Tue Mar 27 21:47:24 BST 2012
app.grails.version=2.0.1
app.name=EmailConfirmation
plugins.svn=1.0.1
#Grails Metadata file
#Wed Jan 08 23:42:01 CET 2014
app.grails.version=2.2.4
app.name=EmailConfirmation
plugins.platform-core=1.0.M2k-SNAPSHOT
plugins.rest-client-builder=1.0.2
plugins.svn=1.0.1
14 changes: 7 additions & 7 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ grails.project.test.reports.dir = "target/test-reports"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
excludes 'xerces', 'xml-apis'
excludes "xml-apis", "xerces"
}

log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenCentral()
//mavenLocal()
mavenCentral()
mavenLocal()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
Expand All @@ -32,12 +32,12 @@ grails.project.dependency.resolution = {
plugins {
build(":tomcat:$grailsVersion",
":hibernate:$grailsVersion",
":release:1.0.2-SNAPSHOT") {
":release:2.0.3") {
export = false
}

compile(':quartz:0.4.2')
compile(':platform-core:1.0.M1')
compile(':quartz:1.0-RC2')
compile(':platform-core:1.0.M7-SNAPSHOT')
compile(':mail:1.0')
}
}
41 changes: 41 additions & 0 deletions grails-app/conf/EmailConfirmationEvents.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* These events are sent to the application scope by default
* Plugins can supply a custom namespace and event when requestion a confirmation using event + eventNamespace args
* and if supplied these events will be send using the event as a prefix i.e. "signup.confirmed" if the event was passed as "signup"
*/
events = {
/*
* Triggered when a confirmation occurs.
*
* @param event object has properties:
* confirmationEvent - application defined event name for the confirmation
* email - email address that confirmed
* id - optional application defined id string relating to the kind of confirmation
*
* @return Receiver must return a Map which will be used to redirect() the user to a new page
*/
confirmed(requiresReply:true)

/*
* Sent when a confirmation is attempted by a user, but the token is invalid, already consumed or otherwise broken
*
* @param event object has properties:
* confirmationEvent - application defined event name for the confirmation
* token - the email confirmation token that the user supplied in their link, which was not recognized
*
* @return Receiver must return a Map which will be used to redirect() the user to a new page
*/
invalid()

/*
* Sent when a confirmation has lapsed with no successful attempt made by the user to confirm.
*
* @param event object has properties:
* confirmationEvent - application defined event name for the confirmation
* email - email address that timed out
* id - optional application defined id string relating to the kind of confirmation
*
* @return Nothing
*/
timeout()
}
8 changes: 8 additions & 0 deletions grails-app/conf/EmailConfirmationUrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@
* limitations under the License.
*/

import grails.util.Environment

class EmailConfirmationUrlMappings {
static mappings = {
// @todo parameterize this
"/confirm/$id?" {
controller = 'emailConfirmation'
action = "index"
}

if (Environment.current == Environment.TEST) {
"/test/tools/emailconfirmation/$action/$id" {
controller = "emailConfirmationTestTools"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class EmailConfirmationController {

// if callback specified args, do a redirect or closure invoke instead of our default view
if ( result.actionToTake ) {
flash.success = result.valid
pluginFlash.success = result.valid
if (result.valid) {
flash.email = result.email
flash.token = result.token
pluginFlash.email = result.email
pluginFlash.token = result.token
}

// Was the result a redirect args map?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2004-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.grailsrocks.emailconfirmation

import grails.util.GrailsUtil

class EmailConfirmationTestToolsController {

def emailConfirmationService

def confirmationLinksForAddressAndEvent = {
// We should not decode params.id this but this is a hack for Grails 1.0.2 bug
def result = emailConfirmationService.findConfirmationByEmailAndEvent(params.email, params.event)
if (result) {
def link = g.createLink(controller:'emailConfirmation', action:'index', params:[id:result.confirmationToken])
render(text:link)
} else {
render(status:404, text:"No pending confirmations for ${params.id}")
}

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.grailsrocks.emailconfirmation

import java.security.*

class PendingEmailConfirmation {
class PendingEmailConfirmation implements Serializable {
static prng = new SecureRandom()

String emailAddress
Expand Down
Loading