forked from community/product-iots
Merge pull request #10 from charithag/master
Changes suggested by PC1 and Kernel upgradeapplication-manager-new
commit
08f4829eea
@ -1,26 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
|
||||
(
|
||||
ID INT(11) auto_increment NOT NULL,
|
||||
NAME VARCHAR(300) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE
|
||||
(
|
||||
ID INT auto_increment NOT NULL,
|
||||
DESCRIPTION TEXT NULL DEFAULT NULL,
|
||||
NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
||||
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
||||
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
||||
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
||||
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
||||
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
||||
TENANT_ID INTEGER DEFAULT 0,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
||||
REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
-- TO:DO - Remove this INSERT sql statement.
|
||||
Insert into DM_DEVICE_TYPE (NAME) VALUES ('android');
|
@ -1,35 +0,0 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `DM_DEVICE_TYPE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `DM_DEVICE_TYPE` (
|
||||
`ID` INT(11) NOT NULL ,
|
||||
`NAME` VARCHAR(300) NULL DEFAULT NULL ,
|
||||
PRIMARY KEY (`ID`) )
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = latin1;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `DM_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `DM_DEVICE` (
|
||||
`ID` VARCHAR(20) NOT NULL ,
|
||||
`DESCRIPTION` TEXT NULL DEFAULT NULL ,
|
||||
`NAME` VARCHAR(100) NULL DEFAULT NULL ,
|
||||
`DATE_OF_ENROLLMENT` DATETIME NULL DEFAULT NULL ,
|
||||
`DATE_OF_LAST_UPDATE` DATETIME NULL DEFAULT NULL ,
|
||||
`OWNERSHIP` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`STATUS` VARCHAR(15) NULL DEFAULT NULL ,
|
||||
`DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL ,
|
||||
`DEVICE_IDENTIFICATION` VARCHAR(300) NULL DEFAULT NULL ,
|
||||
`OWNER` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
TENANT_ID INTEGER DEFAULT 0,
|
||||
PRIMARY KEY (`ID`) ,
|
||||
INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2_idx` (`DEVICE_TYPE_ID` ASC) ,
|
||||
CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2`
|
||||
FOREIGN KEY (`DEVICE_TYPE_ID` )
|
||||
REFERENCES `DM_DEVICE_TYPE` (`ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = latin1;
|
@ -1,82 +0,0 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`REG_ID` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`IMEI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`IMSI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`VENDOR` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`MOBILE_DEVICE_ID`) );
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||
`CODE` VARCHAR(45) NOT NULL ,
|
||||
`NAME` VARCHAR(100) NULL ,
|
||||
`DESCRIPTION` VARCHAR(200) NULL ,
|
||||
PRIMARY KEY (`FEATURE_ID`) );
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
|
||||
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||
`FEATURE_CODE` VARCHAR(45) NOT NULL ,
|
||||
`CREATED_DATE` BIGINT NULL ,
|
||||
PRIMARY KEY (`OPERATION_ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE_OPERATION_MAPPING`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
|
||||
`DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`OPERATION_ID` INT NOT NULL ,
|
||||
`SENT_DATE` BIGINT NULL ,
|
||||
`RECEIVED_DATE` BIGINT NULL ,
|
||||
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
|
||||
FOREIGN KEY (`DEVICE_ID` )
|
||||
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID` )
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||
`OPERATION_ID` INT NOT NULL ,
|
||||
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||
`VALUE` TEXT NULL ,
|
||||
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) ,
|
||||
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID` )
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||
`FEATURE_ID` VARCHAR(45) NOT NULL ,
|
||||
PRIMARY KEY (`PROPERTY`) ,
|
||||
CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1`
|
||||
FOREIGN KEY (`FEATURE_ID` )
|
||||
REFERENCES `MBL_FEATURE` (`FEATURE_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
@ -1,99 +0,0 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL,
|
||||
`REG_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMEI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMSI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`VENDOR` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`MOBILE_DEVICE_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`CODE` VARCHAR(45) NULL,
|
||||
`NAME` VARCHAR(100) NULL,
|
||||
`DESCRIPTION` VARCHAR(200) NULL,
|
||||
PRIMARY KEY (`FEATURE_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
|
||||
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`FEATURE_CODE` VARCHAR(45) NULL,
|
||||
`CREATED_DATE` INT NULL,
|
||||
PRIMARY KEY (`OPERATION_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE_OPERATION_MAPING`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
|
||||
`DEVICE_ID` VARCHAR(45) NOT NULL,
|
||||
`OPERATION_ID` INT NOT NULL,
|
||||
`SENT_DATE` INT NULL,
|
||||
`RECEIVED_DATE` INT NULL,
|
||||
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`),
|
||||
INDEX `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1_idx` (`OPERATION_ID` ASC),
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
|
||||
FOREIGN KEY (`DEVICE_ID`)
|
||||
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID`)
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||
`OPERATION_PROPERTY_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`OPERATION_ID` INT NULL,
|
||||
`PROPERTY_ID` INT NULL,
|
||||
`VALUE` TEXT NULL,
|
||||
PRIMARY KEY (`OPERATION_PROPERTY_ID`),
|
||||
INDEX `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1_idx` (`OPERATION_ID` ASC),
|
||||
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID`)
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
`PROPERTY_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`PROPERTY` VARCHAR(100) NULL,
|
||||
`FEATURE_ID` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`PROPERTY_ID`),
|
||||
INDEX `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1_idx` (`FEATURE_ID` ASC),
|
||||
CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1`
|
||||
FOREIGN KEY (`FEATURE_ID`)
|
||||
REFERENCES `MBL_FEATURE` (`FEATURE_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
|
@ -0,0 +1,200 @@
|
||||
<%
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you 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.
|
||||
*
|
||||
*/
|
||||
var configs = require('/config/sso.js').config();
|
||||
var e = request.getParameter('authFailure');
|
||||
|
||||
var log = new Log();
|
||||
var relyingParty = request.getParameter('relyingParty');
|
||||
|
||||
if(!request.isSecure()){
|
||||
response.content = { 'authFailure' : e , 'relyingParty' : relyingParty };
|
||||
response.sendRedirect(configs.server.https + request.getRequestURI());
|
||||
}
|
||||
|
||||
//TODO: this should be fixed properly
|
||||
if (relyingParty instanceof Array) {
|
||||
relyingParty = relyingParty.pop();
|
||||
}
|
||||
var signInUrl;
|
||||
|
||||
if (relyingParty == 'publisher') {
|
||||
signInUrl = configs.urls.publisher;
|
||||
} else {
|
||||
signInUrl = configs.urls.store + '/login?ignoreReferer=true';
|
||||
}
|
||||
|
||||
var recoveryModule = require('account-management').recovery;
|
||||
var challengeSet = recoveryModule.getChallengeQuestionSet();
|
||||
var isPasswordRecoveryEnabled = recoveryModule.isPasswordRecoveryEnabled();
|
||||
var themeModule = require('/modules/theme.js');
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Sign in or Register | <% include(themeModule.getThemedUrl('includes/title.jag')); %></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<% include(themeModule.getThemedUrl('includes/header_file_imports.jag')); %>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<% include(themeModule.getThemedUrl('includes/header.jag')); %>
|
||||
<div class="row">
|
||||
<!-- content -->
|
||||
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-5 col-centered wr-login">
|
||||
<form id="registerForm">
|
||||
<h2 class="wr-title uppercase blue-bg padding-double white boarder-bottom-blue margin-none">Create An Account</h2>
|
||||
<div class="clearfix"></div>
|
||||
<div class="boarder-all ">
|
||||
<div class="padding-double font-large">Enter all text fields to complete registration </div>
|
||||
<!-- validation -->
|
||||
<div class="padding-double">
|
||||
<div id="regFormError" class="alert alert-error" style="display:none"></div>
|
||||
<div id="regFormSuc" class="alert alert-success" style="display:none"></div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
|
||||
<label>Username</label>
|
||||
<input id="reg-username" name="reg-username" type="text" class="form-control required usrName usrNameLength">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 form-group">
|
||||
<label>Password</label>
|
||||
<input id="reg-password" name="reg-password" type="password" class="form-control required passwordLength">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 form-group">
|
||||
<label>Confirm password</label>
|
||||
<input id="reg-password2" name="password2" type="password" class="form-control required" equalTo="#reg-password">
|
||||
</div>
|
||||
|
||||
<%
|
||||
var claimsModule = require('account-management');
|
||||
var claims = claimsModule.getDefaultClaims();
|
||||
var renderedClaims = {};
|
||||
|
||||
var claimUriOverrides = {
|
||||
USERNAME: {
|
||||
render: false // because this is already rendered by default
|
||||
},
|
||||
PASSWORD: {
|
||||
render: false // because this is already rendered by default
|
||||
},
|
||||
EMAILADDRESS: {
|
||||
render: true,
|
||||
customClass: 'email'
|
||||
}
|
||||
};
|
||||
|
||||
for (var claimIndex = 0; claimIndex < claims.length; claimIndex++) {
|
||||
var override = claimUriOverrides[claims[claimIndex].claimUri.toUpperCase()];
|
||||
// render claim if it's required and not overriden to --> render:false
|
||||
if (claims[claimIndex].isRequired && (!override || override.render !== false)) {
|
||||
var formElementName = 'reg-' + claims[claimIndex].displayTag.toLowerCase().replace(' ', '-');
|
||||
var validationClass = "";
|
||||
var span = "";
|
||||
if(claims[claimIndex].displayTag == "Email"){
|
||||
validationClass = "email";
|
||||
span = "col-xs-12 col-sm-12 col-md-12 col-lg-12";
|
||||
}else{
|
||||
span = "col-xs-12 col-sm-12 col-md-6 col-lg-6"
|
||||
}
|
||||
%>
|
||||
<div class="<%=span%> form-group">
|
||||
<label><%=claims[claimIndex].displayTag%></label>
|
||||
<input type="text" name="<%=formElementName%>" data-claim-uri="<%=claims[claimIndex].claimUri%>" class="form-control <%=validationClass%> required <%=claims[claimIndex].customClass%>">
|
||||
</div>
|
||||
<%
|
||||
renderedClaims[formElementName] = claims[claimIndex].claimUri;
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<input type="hidden" name="reg-claims" value='<%=renderedClaims%>'
|
||||
class="input-block-level required">
|
||||
<input id="reg-action" name="action" type="hidden" value="register">
|
||||
<input id="reg-relyingParty" name="relyingParty" type="hidden" value="<%=relyingParty%>">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
|
||||
<br/><br/>
|
||||
<button id="registrationSubmit" class="wr-btn grey-bg col-xs-12 col-md-12 col-lg-12 uppercase font-extra-large"
|
||||
type="button">Register
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
|
||||
<span class="margin-top padding-top-double font-large">Already have an account? </span>
|
||||
<a href="<%=signInUrl%>" id="signInLink" class="font-large">Sign in</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% include(themeModule.getThemedUrl('includes/footer_file_imports.jag')); %>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var ENTER_KEY = 13;
|
||||
function register() {
|
||||
if (!$('#registerForm').valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = $("#registerForm").serialize();
|
||||
|
||||
$.post('/sso/register', formData, function (data) {
|
||||
var regFormError = $('#regFormError');
|
||||
var regFromSuccess = $('#regFormSuc');
|
||||
if (JSON.parse(data).error == 'false') {
|
||||
regFormError.hide();
|
||||
regFromSuccess.show();
|
||||
regFromSuccess.text(JSON.parse(data).msg + ". You will be redirected to login page.");
|
||||
setTimeout(function () {
|
||||
window.location = "<%=signInUrl%>";
|
||||
}, 2000);
|
||||
} else {
|
||||
regFromSuccess.hide();
|
||||
regFormError.show();
|
||||
regFormError.text(JSON.parse(data).msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#registrationSubmit").bind('click', register);
|
||||
|
||||
$('#registerForm input').bind('keypress', function (e) {
|
||||
if (e.which == ENTER_KEY) {
|
||||
register();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.validator.addMethod("usrName", function (value, element) {
|
||||
return this.optional(element) || /^[a-zA-Z0-9\-\@\.]*$/.test(value);
|
||||
}, "Only alphanumeric characters and '-' allowed");
|
||||
jQuery.validator.addMethod("usrNameLength", function (value, element) {
|
||||
return value.length >= 3 && value.length <= 30;
|
||||
}, "username must contain minimum 3 characters and maximum 30 characters");
|
||||
jQuery.validator.addMethod("passwordLength", function (value, element) {
|
||||
return this.optional(element) || /^[\S]{5,30}$/.test(value);
|
||||
}, "Password must contain minimum 5 characters and maximum 30 characters");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue