module.exports = class ConfirmationValidator
	@detectBy: ['confirmation']
	
	constructor: (@params) ->
	
	validate: (value, valid, model) ->
		if not value and not model["#{ @params.key }_confirmation"]
			if not @params.allowBlank
				valid no, 'can\'t be blank'
			else valid yes
			return
		
		valid (value is model["#{ @params.key }_confirmation"]), 'is not confirmed'