Giter Site home page Giter Site logo

vahidhedayati / spcontacttest Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.87 MB

spring-security-contactus plugin demo site with a very basic example

Home Page: https://github.com/vahidhedayati/spring-security-contactus

Groovy 74.09% Shell 1.45% CSS 3.26% JavaScript 0.07% Java 21.13%

spcontacttest's Introduction

spcontacttest

is a demo grails 2.3.4 site for https://github.com/vahidhedayati/spring-security-contactus

install jquery-ui within your project

Then enable both jquery and jquery-ui in your main.gsp

<g:javascript library="jquery"/>
<g:javascript library="jquery-ui"/>

Refer to your contact page via a remotefunction like below:

 <!-- added in spring-security-contactus form here as a button for test purposes -->
 <button id=boxbtn onclick="<g:remoteFunction controller="ContactUs" action="index" update="siteContent" />">contact</button>
 <div id="siteContent"> </div>

Ensure you have enabled and configured all of these values in your config.groovy :

contactus.to.address='[email protected]'
contactus.email.view='/contactUs/emailBody'
contactus.form.view='/contactUs/index.gsp'
contactus.thanks.view='/contactUs/thanks'
contactus.dbtable='ContactUs'

simpleCaptcha {
		// font size used in CAPTCHA images
		fontSize = 30
		height = 200
		width = 200
		// number of characters in CAPTCHA text
		length = 6
		// amount of space between the bottom of the CAPTCHA text and the bottom of the CAPTCHA image
		bottomPadding = 16
		// distance between the diagonal lines used to obfuscate the text
		lineSpacing = 10
		// the charcters shown in the CAPTCHA text must be one of the following
		chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
		'/': ['permitAll'],
		'/index': ['permitAll'],
		'/index.gsp': ['permitAll'],
		'/**/js/**': ['permitAll'],
		'/**/css/**': ['permitAll'],
		'/**/images/**': ['permitAll'],
		'/**/favicon.ico': ['permitAll'],
		'/**/simpleCaptcha/captcha': ['permitAll'],
		'/simpleCaptcha/captcha': ['permitAll'],
		'/**/contactus/**': ['permitAll'],
		'/contactus/**': ['permitAll']
]

You will need a domain class called ContactUs or whatever you wish it to be called - just ensure the config in the config.grooy table name matches this name: (this is the sample domainClass taken from within the plugin - it uses to generate the form view:) it needs to be identical so far as fields and configuration goes.

package grails.plugins.springsecurity.contactus

class ContactUsMaster {
	Date dateCreated
	String name
	String email
	String username
	String subject
	String message
	String captcha
	static constraints = {
		name(blank: false)
		email(blank: false, email: true)
		subject(blank: false)
		message(minSize: 10, blank: false)
	}
	static optionals = [ 'username'  ]
	static mapping = {
		message type: 'text'
		username  defaultValue: ''
	}
	static transients = ['captcha']
	static afterContactUs = { form, params ->
		new ContactUsMaster(name:form.name, email:form.email, username:form.username, subject:form.subject, message:form.message).save()
	}
}

spcontacttest's People

Watchers

Vahid Hedayati avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.