login progress
This commit is contained in:
@@ -3,7 +3,8 @@ var React = require("react/addons"),
|
||||
RibicaValidationMixin = require('../../components/shared/mixins/ribicaValidationMixin'),
|
||||
UserStore = require('../../stores/userStore'),
|
||||
NavigationActions = require('../../actions/navigationActions'),
|
||||
UserActions = require('../../actions/userActions');
|
||||
UserActions = require('../../actions/userActions'),
|
||||
ValidationUtils = require('../../utils/validation');
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +19,7 @@ var Register = React.createClass({
|
||||
password: '',
|
||||
passwordConfirmation: '',
|
||||
errors: {},
|
||||
registrationState: UserStore.getRegistrationState()
|
||||
registration: UserStore.getRegistrationState()
|
||||
};
|
||||
},
|
||||
myBabyChange: function() {
|
||||
@@ -96,12 +97,12 @@ var Register = React.createClass({
|
||||
},
|
||||
validations: {
|
||||
firstName: function(value) {
|
||||
if (!value || value === '') {
|
||||
if (!ValidationUtils.isValidRequired(value)) {
|
||||
return ["Ime je obavezno."];
|
||||
}
|
||||
},
|
||||
password: function(value, callback) {
|
||||
if(value === undefined || value === "") {
|
||||
if(!ValidationUtils.isValidRequired(value)) {
|
||||
return ["Šifra je obavezna."];
|
||||
}
|
||||
|
||||
@@ -119,16 +120,14 @@ var Register = React.createClass({
|
||||
}
|
||||
},
|
||||
lastName : function(value) {
|
||||
if (!value || value === '') {
|
||||
if (!ValidationUtils.isValidRequired(value)) {
|
||||
return ["Prezime je obavezno."];
|
||||
}
|
||||
},
|
||||
_emailRe: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
||||
_emailTimeoutId: null,
|
||||
email: function(value, callback) {
|
||||
var validEmail = this._emailRe.test(value);
|
||||
|
||||
if (validEmail) {
|
||||
if (ValidationUtils.isValidEmail(value)) {
|
||||
//clearTimeout(this._emailTimeoutId);
|
||||
//this._emailTimeoutId = setTimeout(function(){
|
||||
|
||||
@@ -162,11 +161,10 @@ var Register = React.createClass({
|
||||
},
|
||||
onUserStoreChange: function() {
|
||||
this.setState({
|
||||
registrationState: UserStore.getRegistrationState()
|
||||
registration: UserStore.getRegistrationState()
|
||||
});
|
||||
},
|
||||
register: function(e) {
|
||||
// TODO: move this to the UserRegistrationStore
|
||||
if(this.validate()) {
|
||||
var user = new UserRegistration({
|
||||
first_name: this.state.firstName,
|
||||
@@ -186,24 +184,24 @@ var Register = React.createClass({
|
||||
e.preventDefault();
|
||||
},
|
||||
renderRegistrationState: function() {
|
||||
var rs = this.state.registrationState;
|
||||
var rs = this.state.registration;
|
||||
if (!rs.performed) {
|
||||
|
||||
return (<div></div>)
|
||||
} else if(rs.performed && !rs.success){
|
||||
return (<div>
|
||||
Desila se pogreska pri registraciji. Detalji greske su:
|
||||
Desila se pogreška pri registraciji. Detalji greške su:
|
||||
{rs.error.responseJSON}
|
||||
</div>)
|
||||
} else if (rs.performed && rs.success) {
|
||||
return (<div>
|
||||
Uspjesno ste se registrovali na Ribicu. Kliknite <a onClick={this.successContinue}>ovdje</a> za nastavak.
|
||||
Uspješno ste se registrovali na Ribicu. Kliknite <a onClick={this.successContinue}>ovdje</a> za nastavak.
|
||||
</div>)
|
||||
}
|
||||
},
|
||||
render : function() {
|
||||
var cx = React.addons.classSet;
|
||||
var regSuccess = this.state.registrationState.performed && this.state.registrationState.success;
|
||||
var regSuccess = this.state.registration.performed && this.state.registration.success;
|
||||
var classes = cx({
|
||||
'hide': regSuccess
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user